-
-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(suite-native): Create buy screen visual stub
- Loading branch information
Showing
11 changed files
with
208 additions
and
133 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
Binary file not shown.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 0 additions & 33 deletions
33
suite-native/module-trading/src/components/buy/AmountCard.tsx
This file was deleted.
Oops, something went wrong.
93 changes: 93 additions & 0 deletions
93
suite-native/module-trading/src/components/buy/BuyCard.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 |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import React from 'react'; | ||
|
||
import { useFormatters } from '@suite-common/formatters'; | ||
import { Card, HStack, Text, VStack } from '@suite-native/atoms'; | ||
import { Icon } from '@suite-native/icons'; | ||
import { Translation, useTranslate } from '@suite-native/intl'; | ||
import { prepareNativeStyle, useNativeStyles } from '@trezor/styles'; | ||
|
||
import { useTradeableAssetsSheetControls } from '../../hooks/useTradeableAssetsSheetControls'; | ||
import { SelectTradeableAssetButton } from '../general/SelectTradeableAssetButton'; | ||
import { TradeableAssetsSheet } from '../general/TradeableAssetsSheet/TradeableAssetsSheet'; | ||
import { TradingOverviewRow } from '../general/TradingOverviewRow'; | ||
|
||
const notImplementedCallback = () => { | ||
// eslint-disable-next-line no-console | ||
console.log('Not implemented'); | ||
}; | ||
|
||
const buySectionStyle = prepareNativeStyle(({ borders, colors, spacings }) => ({ | ||
borderBottomWidth: borders.widths.small, | ||
borderBottomColor: colors.backgroundSurfaceElevation0, | ||
padding: spacings.sp20, | ||
})); | ||
|
||
export const BuyCard = () => { | ||
const { translate } = useTranslate(); | ||
const { FiatAmountFormatter, CryptoAmountFormatter } = useFormatters(); | ||
const { applyStyle } = useNativeStyles(); | ||
|
||
const { | ||
isTradeableAssetsSheetVisible, | ||
showTradeableAssetsSheet, | ||
hideTradeableAssetsSheet, | ||
selectedTradeableAsset, | ||
setSelectedTradeableAsset, | ||
} = useTradeableAssetsSheetControls(); | ||
|
||
return ( | ||
<Card noPadding> | ||
<VStack style={applyStyle(buySectionStyle)}> | ||
<Text variant="body" color="textDefault"> | ||
<Translation id="moduleTrading.tradingScreen.buyTitle" /> | ||
</Text> | ||
<HStack justifyContent="space-between" alignItems="center"> | ||
<SelectTradeableAssetButton | ||
onPress={showTradeableAssetsSheet} | ||
selectedAsset={selectedTradeableAsset} | ||
/> | ||
<Text variant="titleMedium" color="textDisabled"> | ||
0.0 | ||
</Text> | ||
</HStack> | ||
<HStack justifyContent="space-between" alignItems="center"> | ||
<Text variant="body" color="textSubdued"> | ||
{selectedTradeableAsset?.symbol ? ( | ||
<CryptoAmountFormatter | ||
value="0" | ||
symbol={selectedTradeableAsset.symbol} | ||
/> | ||
) : ( | ||
'-' | ||
)} | ||
</Text> | ||
<HStack> | ||
<Text variant="body" color="textSubdued"> | ||
<FiatAmountFormatter value={0} /> | ||
</Text> | ||
<Icon name="arrowsDownUp" color="iconSubdued" /> | ||
</HStack> | ||
</HStack> | ||
</VStack> | ||
<TradingOverviewRow | ||
title={translate('moduleTrading.tradingScreen.receiveAccount')} | ||
onPress={notImplementedCallback} | ||
noBottomBorder | ||
> | ||
<VStack spacing={0} paddingLeft="sp20"> | ||
<Text color="textSubdued" variant="body" textAlign="right"> | ||
Bitcoin Vault | ||
</Text> | ||
<Text color="textSubdued" variant="hint" ellipsizeMode="tail" numberOfLines={1}> | ||
3QJmV3qfvL9SuYo34YihAf3sRCW3qSinyC | ||
</Text> | ||
</VStack> | ||
</TradingOverviewRow> | ||
<TradeableAssetsSheet | ||
isVisible={isTradeableAssetsSheetVisible} | ||
onClose={hideTradeableAssetsSheet} | ||
onAssetSelect={setSelectedTradeableAsset} | ||
/> | ||
</Card> | ||
); | ||
}; |
47 changes: 47 additions & 0 deletions
47
suite-native/module-trading/src/components/buy/PaymentCard.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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { Box, Button, Card, Text } from '@suite-native/atoms'; | ||
import { Translation, useTranslate } from '@suite-native/intl'; | ||
|
||
import { TradingOverviewRow } from '../general/TradingOverviewRow'; | ||
|
||
const notImplementedCallback = () => { | ||
// eslint-disable-next-line no-console | ||
console.log('Not implemented'); | ||
}; | ||
|
||
export const PaymentCard = () => { | ||
const { translate } = useTranslate(); | ||
|
||
return ( | ||
<Card noPadding> | ||
<TradingOverviewRow | ||
title={translate('moduleTrading.tradingScreen.paymentMethod')} | ||
onPress={notImplementedCallback} | ||
> | ||
<Text color="textSubdued" variant="body"> | ||
Credit card | ||
</Text> | ||
</TradingOverviewRow> | ||
<TradingOverviewRow | ||
title={translate('moduleTrading.tradingScreen.countryOfResidence')} | ||
onPress={notImplementedCallback} | ||
> | ||
<Text color="textSubdued" variant="body"> | ||
Czech Republic | ||
</Text> | ||
</TradingOverviewRow> | ||
<TradingOverviewRow | ||
title={translate('moduleTrading.tradingScreen.provider')} | ||
onPress={notImplementedCallback} | ||
> | ||
<Text color="textSubdued" variant="body"> | ||
Anycoin | ||
</Text> | ||
</TradingOverviewRow> | ||
<Box padding="sp20"> | ||
<Button onPress={notImplementedCallback}> | ||
<Translation id="moduleTrading.tradingScreen.continueButton" /> | ||
</Button> | ||
</Box> | ||
</Card> | ||
); | ||
}; |
34 changes: 34 additions & 0 deletions
34
suite-native/module-trading/src/components/general/TradingFooter.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 |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { useMemo } from 'react'; | ||
import { TouchableOpacity } from 'react-native'; | ||
|
||
import { Button, HStack, Image, Text } from '@suite-native/atoms'; | ||
import { Translation } from '@suite-native/intl'; | ||
import { useOpenLink } from '@suite-native/link'; | ||
|
||
export const TradingFooter = () => { | ||
const openLink = useOpenLink(); | ||
|
||
const imageSource = useMemo(() => require('../../../assets/InvityLogo.png'), []); | ||
const openLinkToInvity = () => openLink('https://invity.io'); | ||
|
||
return ( | ||
<HStack justifyContent="space-between" alignItems="center"> | ||
<HStack alignItems="center" spacing="sp4"> | ||
<Text variant="label" color="textSubdued"> | ||
<Translation id="moduleTrading.tradingScreen.footer.poweredBy" /> | ||
</Text> | ||
<TouchableOpacity onPress={openLinkToInvity}> | ||
<Image source={imageSource} contentFit="contain" width={44} height={18} /> | ||
</TouchableOpacity> | ||
</HStack> | ||
<Button | ||
colorScheme="tertiaryElevation0" | ||
size="extraSmall" | ||
onPress={openLinkToInvity} | ||
viewRight="arrowUpRight" | ||
> | ||
<Translation id="moduleTrading.tradingScreen.footer.learnMore" /> | ||
</Button> | ||
</HStack> | ||
); | ||
}; |
13 changes: 0 additions & 13 deletions
13
suite-native/module-trading/src/components/general/TradingRowDivider.tsx
This file was deleted.
Oops, something went wrong.
94 changes: 17 additions & 77 deletions
94
suite-native/module-trading/src/screens/TradingScreen.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,81 +1,21 @@ | ||
import React from 'react'; | ||
|
||
import { Box, Button, Card, Text, VStack } from '@suite-native/atoms'; | ||
import { Text, VStack } from '@suite-native/atoms'; | ||
import { DeviceManagerScreenHeader } from '@suite-native/device-manager'; | ||
import { Translation, useTranslate } from '@suite-native/intl'; | ||
import { Translation } from '@suite-native/intl'; | ||
import { Screen } from '@suite-native/navigation'; | ||
|
||
import { AmountCard } from '../components/buy/AmountCard'; | ||
import { TradingOverviewRow } from '../components/general/TradingOverviewRow'; | ||
import { TradingRowDivider } from '../components/general/TradingRowDivider'; | ||
|
||
const notImplementedCallback = () => { | ||
// eslint-disable-next-line no-console | ||
console.log('Not implemented'); | ||
}; | ||
|
||
export const TradingScreen = () => { | ||
const { translate } = useTranslate(); | ||
import { BuyCard } from '../components/buy/BuyCard'; | ||
import { PaymentCard } from '../components/buy/PaymentCard'; | ||
import { TradingFooter } from '../components/general/TradingFooter'; | ||
|
||
return ( | ||
<Screen header={<DeviceManagerScreenHeader />}> | ||
<VStack spacing="sp16"> | ||
<Text>Trading placeholder</Text> | ||
<AmountCard /> | ||
<Card noPadding> | ||
<TradingRowDivider /> | ||
<TradingOverviewRow | ||
title={translate('moduleTrading.tradingScreen.receiveAccount')} | ||
onPress={notImplementedCallback} | ||
noBottomBorder | ||
> | ||
<VStack spacing={0} paddingLeft="sp20"> | ||
<Text color="textSubdued" variant="body" textAlign="right"> | ||
Bitcoin Vault | ||
</Text> | ||
<Text | ||
color="textSubdued" | ||
variant="hint" | ||
ellipsizeMode="tail" | ||
numberOfLines={1} | ||
> | ||
3QJmV3qfvL9SuYo34YihAf3sRCW3qSinyC | ||
</Text> | ||
</VStack> | ||
</TradingOverviewRow> | ||
</Card> | ||
<Card noPadding> | ||
<TradingOverviewRow | ||
title={translate('moduleTrading.tradingScreen.paymentMethod')} | ||
onPress={notImplementedCallback} | ||
> | ||
<Text color="textSubdued" variant="body"> | ||
Credit card | ||
</Text> | ||
</TradingOverviewRow> | ||
<TradingOverviewRow | ||
title={translate('moduleTrading.tradingScreen.countryOfResidence')} | ||
onPress={notImplementedCallback} | ||
> | ||
<Text color="textSubdued" variant="body"> | ||
Czech Republic | ||
</Text> | ||
</TradingOverviewRow> | ||
<TradingOverviewRow | ||
title={translate('moduleTrading.tradingScreen.provider')} | ||
onPress={notImplementedCallback} | ||
> | ||
<Text color="textSubdued" variant="body"> | ||
Anycoin | ||
</Text> | ||
</TradingOverviewRow> | ||
<Box padding="sp20"> | ||
<Button onPress={notImplementedCallback}> | ||
<Translation id="moduleTrading.tradingScreen.continueButton" /> | ||
</Button> | ||
</Box> | ||
</Card> | ||
</VStack> | ||
</Screen> | ||
); | ||
}; | ||
export const TradingScreen = () => ( | ||
<Screen header={<DeviceManagerScreenHeader />}> | ||
<VStack spacing="sp16"> | ||
<Text variant="titleSmall" color="textDefault"> | ||
<Translation id="moduleTrading.tradingScreen.buyTitle" /> | ||
</Text> | ||
<BuyCard /> | ||
<PaymentCard /> | ||
<TradingFooter /> | ||
</VStack> | ||
</Screen> | ||
); |