Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/backend' into feature/email-su…
Browse files Browse the repository at this point in the history
…bsxription-sign
  • Loading branch information
ilya Smiyukha committed Jul 19, 2023
2 parents 23e8695 + dfcff45 commit fc5116b
Show file tree
Hide file tree
Showing 63 changed files with 2,944 additions and 2,892 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,13 @@ jobs:
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- if: ${{ steps.yarn-cache.outputs.cache-hit != 'true' }}
name: Install dependencies
- name: Install dependencies
run: yarn --immutable

- name: Verify formatting
Expand Down
38 changes: 25 additions & 13 deletions packages/ui/.storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import { Decorator } from '@storybook/react'
import { configure } from '@storybook/testing-library'
import React from 'react'
import { I18nextProvider } from 'react-i18next'
import { useForm, FormProvider } from 'react-hook-form'
import { MemoryRouter, Redirect, Route, Switch } from 'react-router'
import { createGlobalStyle } from 'styled-components'

import { NotFound } from '../src/app/pages/NotFound'
import { GlobalModals } from '../src/app/GlobalModals'
import { GlobalStyle } from '../src/app/providers/GlobalStyle'
import { OnBoardingProvider } from '../src/common/providers/onboarding/provider'
import { NotificationsHolder } from '../src/common/components/page/SideNotification'
import { TransactionStatus } from '../src/common/components/TransactionStatus/TransactionStatus'
import { Colors } from '../src/common/constants'
import { MockProvidersDecorator } from '../src/mocks/providers'
import { ModalContextProvider } from '../src/common/providers/modal/provider'
import { TransactionStatusProvider } from '../src/common/providers/transactionStatus/provider'
import { MockProvidersDecorator, MockRouterDecorator } from '../src/mocks/providers'
import { i18next } from '../src/services/i18n'

configure({ testIdAttribute: 'id' })

const stylesWrapperDecorator: Decorator = (Story) => (
<>
<GlobalStyle />
Expand Down Expand Up @@ -43,22 +50,27 @@ const RHFDecorator: Decorator = (Story) => {
)
}

const RouterDecorator: Decorator = (Story, { parameters }) => (
<MemoryRouter initialEntries={[`/story/${parameters.router?.href ?? ''}`]}>
<Switch>
<Route component={Story} path={`/story/${parameters.router?.path ?? ''}`} />
<Route exact path="/404" component={NotFound} />
<Redirect from="*" to="/404" />
</Switch>
</MemoryRouter>
const ModalDecorator: Decorator = (Story) => (
<TransactionStatusProvider>
<ModalContextProvider>
<OnBoardingProvider>
<Story />
<GlobalModals />
<NotificationsHolder>
<TransactionStatus />
</NotificationsHolder>
</OnBoardingProvider>
</ModalContextProvider>
</TransactionStatusProvider>
)

export const decorators = [
ModalDecorator,
stylesWrapperDecorator,
i18nextDecorator,
RHFDecorator,
MockProvidersDecorator,
RouterDecorator,
MockRouterDecorator,
]

export const parameters = {
Expand Down Expand Up @@ -91,7 +103,7 @@ export const parameters = {
options: {
storySort: {
method: 'alphabetical',
order: ['Common'],
order: ['App', 'Pages', 'Common'],
},
},
}
4 changes: 3 additions & 1 deletion packages/ui/src/accounts/providers/balances/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ export const BalancesContextProvider = (props: Props) => {
)

const balances = useMemo(() => {
if (!addresses.length) return {}

if (!isLoading && result)
return result.reduce((acc, balance, index) => {
return {
...{ [addresses[index]]: balance },
...acc,
}
}, {} as AddressToBalanceMap)
}, [result])
}, [result, addresses])

return <BalancesContext.Provider value={balances}>{props.children}</BalancesContext.Provider>
}
Loading

0 comments on commit fc5116b

Please sign in to comment.