-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add jumpstart button to select recipients screen (#4965)
### Description This PR adds the remote config and button for the start of the escrow jumpstart flow. I think that the most straightforward way to implement the escrow flow is to use the existing send flow rather than separate the flows. I've made a POC that is working e2e in #4964, in case it helps to understand this decision. ### Test plan ![Simulator Screenshot - iPhone 14 Pro - 2024-02-23 at 12 22 01](https://github.com/valora-inc/wallet/assets/20150449/8b524157-4c52-481b-af68-b7a3d47885ca) ### Related issues - Related to RET-993 ### Backwards compatibility Y ### Network scalability If a new NetworkId and/or Network are added in the future, the changes in this PR will: - [x] Continue to work without code changes, OR trigger a compilation error (guaranteeing we find it when a new network is added)
- Loading branch information
1 parent
88b7ba9
commit eeb813c
Showing
13 changed files
with
152 additions
and
5 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import * as React from 'react' | ||
import Svg, { Path } from 'react-native-svg' | ||
import Colors from 'src/styles/colors' | ||
|
||
const MagicWand = ({ size = 24, color = Colors.successDark }) => ( | ||
<Svg width={size} height={size} viewBox="0 0 24 24"> | ||
<Path | ||
fill={color} | ||
d="m8.573 6.085-2.143 1.2 1.2-2.142L6.43 3l2.143 1.2L10.716 3l-1.2 2.143 1.2 2.142-2.143-1.2Zm10.284 8.4 2.143-1.2-1.2 2.142L21 17.57l-2.143-1.2-2.142 1.2 1.2-2.143-1.2-2.143 2.142 1.2ZM21 3l-1.2 2.143L21 7.285l-2.143-1.2-2.142 1.2 1.2-2.142L16.715 3l2.142 1.2L21 3Zm-7.422 9.239 2.091-2.091-1.817-1.817-2.09 2.091 1.816 1.817Zm.883-4.705 2.005 2.005c.334.317.334.874 0 1.209L6.465 20.749c-.335.335-.892.335-1.209 0l-2.005-2.005c-.335-.317-.335-.874 0-1.209L13.252 7.534c.335-.335.892-.335 1.209 0Z" | ||
/> | ||
</Svg> | ||
) | ||
|
||
export default MagicWand |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import React from 'react' | ||
import { useTranslation } from 'react-i18next' | ||
import { StyleSheet, Text, View } from 'react-native' | ||
import { SendEvents } from 'src/analytics/Events' | ||
import ValoraAnalytics from 'src/analytics/ValoraAnalytics' | ||
import { SendOrigin } from 'src/analytics/types' | ||
import Touchable from 'src/components/Touchable' | ||
import CircledIcon from 'src/icons/CircledIcon' | ||
import MagicWand from 'src/icons/MagicWand' | ||
import { navigate } from 'src/navigator/NavigationService' | ||
import { Screens } from 'src/navigator/Screens' | ||
import { getFeatureGate } from 'src/statsig' | ||
import { StatsigFeatureGates } from 'src/statsig/types' | ||
import colors from 'src/styles/colors' | ||
import { typeScale } from 'src/styles/fonts' | ||
import { Spacing } from 'src/styles/styles' | ||
import { useTokensWithTokenBalance } from 'src/tokens/hooks' | ||
|
||
function SelectRecipientJumpstartButton() { | ||
const { t } = useTranslation() | ||
const showJumpstart = getFeatureGate(StatsigFeatureGates.SHOW_JUMPSTART_SEND) | ||
const tokensWithBalance = useTokensWithTokenBalance() | ||
|
||
const handlePress = () => { | ||
ValoraAnalytics.track(SendEvents.send_select_recipient_jumpstart) | ||
navigate(Screens.SendEnterAmount, { | ||
isFromScan: false, | ||
origin: SendOrigin.Jumpstart, | ||
}) | ||
} | ||
|
||
if (!showJumpstart || tokensWithBalance.length === 0) { | ||
return null | ||
} | ||
|
||
return ( | ||
<Touchable onPress={handlePress} style={styles.container}> | ||
<View style={styles.body}> | ||
<CircledIcon radius={40} backgroundColor={colors.successLight}> | ||
<MagicWand /> | ||
</CircledIcon> | ||
<View style={styles.textSection}> | ||
<Text style={styles.title}>{t('sendSelectRecipient.jumpstart.title')}</Text> | ||
<Text style={styles.subtitle}>{t('sendSelectRecipient.jumpstart.subtitle')}</Text> | ||
</View> | ||
</View> | ||
</Touchable> | ||
) | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
padding: Spacing.Regular16, | ||
borderWidth: 1, | ||
borderColor: colors.primary, | ||
borderRadius: 12, | ||
marginHorizontal: Spacing.Thick24, | ||
}, | ||
subtitle: { | ||
...typeScale.bodyXSmall, | ||
color: colors.gray3, | ||
}, | ||
title: { | ||
...typeScale.labelMedium, | ||
}, | ||
body: { | ||
flexDirection: 'row', | ||
alignItems: 'center', | ||
}, | ||
textSection: { | ||
paddingLeft: Spacing.Small12, | ||
flexDirection: 'column', | ||
flex: 1, | ||
}, | ||
}) | ||
|
||
export default SelectRecipientJumpstartButton |
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 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