Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/AddWallet' of https://github.com/euvini/yoroi-d…
…evelop into feature/AddWallet
- Loading branch information
Showing
40 changed files
with
1,194 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 37 additions & 56 deletions
93
...Exchange/useCases/ShowExchangeResultOrderScreen/ShowExchangeResultOrderScreen.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,73 +1,54 @@ | ||
import {NavigationRouteContext, RouteProp} from '@react-navigation/native' | ||
import {actions} from '@storybook/addon-actions' | ||
import {storiesOf} from '@storybook/react-native' | ||
import {exchangeDefaultState, ExchangeProvider, successManagerMock} from '@yoroi/exchange' | ||
import {produce} from 'immer' | ||
import {LinksProvider} from '@yoroi/links' | ||
import React from 'react' | ||
|
||
import {ModalProvider} from '../../../../components' | ||
import {InitialLinkProvider, useInitialLink} from '../../../../IntialLinkManagerProvider' | ||
import {SelectedWalletProvider} from '../../../../SelectedWallet' | ||
import {mocks as walletMocks} from '../../../../yoroi-wallets/mocks' | ||
import {ExchangeInitRoutes} from '../../common/useNavigateTo' | ||
import {ShowExchangeResultOrderScreen} from './ShowExchangeResultOrderScreen' | ||
|
||
storiesOf('Exchange ShowExchangeResultOrderScreen', module) | ||
.addDecorator((story) => <InitialLinkProvider>{story()}</InitialLinkProvider>) | ||
.add('no params', () => <Init />) | ||
.add('no info', () => <ShowExchangeResultOrderScreen onClose={() => actions('onClose')} />) | ||
.add('with params', () => <WithParams />) | ||
|
||
const Init = () => { | ||
const {setInitialUrl} = useInitialLink() | ||
const initialState = produce(exchangeDefaultState, (draft) => { | ||
draft.orderType = 'buy' | ||
}) | ||
|
||
React.useEffect(() => { | ||
setInitialUrl( | ||
'yoroi://ramp-on-off/result?&status=success&fiatAmount=10000&coinAmount=5000&coin=ADA&fiat=USD&provider=encryptus', | ||
) | ||
}, [setInitialUrl]) | ||
storiesOf('Exchange ShowExchangeResultOrderScreen', module).add('with deep link data', () => <WithDeepLinkData />) | ||
|
||
const WithDeepLinkData = () => { | ||
return ( | ||
<SelectedWalletProvider wallet={{...walletMocks.wallet}}> | ||
<ModalProvider> | ||
<ExchangeProvider manager={successManagerMock} initialState={{...initialState, providerId: 'encryptus'}}> | ||
<ShowExchangeResultOrderScreen onClose={() => actions('onClose')} /> | ||
</ExchangeProvider> | ||
<LinksProvider | ||
initialState={{ | ||
authorizations: new Map(), | ||
action: { | ||
info: { | ||
version: 1, | ||
feature: 'exchange', | ||
useCase: 'order/show-create-result', | ||
params: { | ||
coin: 'ADA', | ||
coinAmount: 1, | ||
fiat: 'USD', | ||
fiatAmount: 1, | ||
provider: 'encryptus', | ||
status: 'success', | ||
appId: 'a386e806-92f4-4796-ad61-7a1485b6e745', | ||
authorization: 'fca6fc26-abc6-4cdc-bdce-5910cc3c0a01', | ||
isSandbox: true, | ||
message: 'Your order number 131234 is under processing, bare with us.', | ||
redirectTo: 'https://yoroi-wallet.com/about', | ||
orderType: 'buy', | ||
}, | ||
}, | ||
isTrusted: false, | ||
}, | ||
}} | ||
> | ||
<ExchangeProvider | ||
manager={successManagerMock} | ||
initialState={{...exchangeDefaultState, providerId: 'encryptus'}} | ||
> | ||
<ShowExchangeResultOrderScreen /> | ||
</ExchangeProvider> | ||
</LinksProvider> | ||
</ModalProvider> | ||
</SelectedWalletProvider> | ||
) | ||
} | ||
|
||
const WithParams = () => { | ||
const {setInitialUrl} = useInitialLink() | ||
const params: RouteProp<ExchangeInitRoutes, 'exchange'>['params'] = { | ||
coin: 'ADA', | ||
coinAmount: 100, | ||
fiat: 990, | ||
fiatAmount: 199, | ||
status: 'success', | ||
} | ||
const initialState = produce(exchangeDefaultState, (draft) => { | ||
draft.orderType = 'buy' | ||
}) | ||
|
||
React.useEffect(() => { | ||
setInitialUrl( | ||
'yoroi://ramp-on-off/result?&status=success&fiatAmount=10000&coinAmount=5000&coin=ADA&fiat=USD&provider=encryptus', | ||
) | ||
}, [setInitialUrl]) | ||
return ( | ||
<NavigationRouteContext.Provider value={{key: 'key', name: 'name', params}}> | ||
<SelectedWalletProvider wallet={{...walletMocks.wallet}}> | ||
<ModalProvider> | ||
<ExchangeProvider manager={successManagerMock} initialState={{...initialState, providerId: 'encryptus'}}> | ||
<ShowExchangeResultOrderScreen onClose={() => actions('onClose')} /> | ||
</ExchangeProvider> | ||
</ModalProvider> | ||
</SelectedWalletProvider> | ||
</NavigationRouteContext.Provider> | ||
) | ||
} |
Oops, something went wrong.