Skip to content

Commit

Permalink
chore(jumpstart): update jumpstart recipient button UI (#5181)
Browse files Browse the repository at this point in the history
### Description

As the title - design
[here](https://www.figma.com/file/6sJ4fCxCptTybHB6ZZ7Pqi/Escrow-Feature?node-id=2986%3A1807&mode=dev)

### Test plan

![Simulator Screenshot - iPhone 14 Pro - 2024-03-28 at 16 49
10](https://github.com/valora-inc/wallet/assets/20150449/925b9fe7-c3d5-49f2-b80d-18c42174c918)


### Related issues

n/a

### Backwards compatibility

Y

### Network scalability

Y
  • Loading branch information
kathaypacific committed Mar 28, 2024
1 parent edf6e74 commit 836ba87
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 83 deletions.
4 changes: 2 additions & 2 deletions locales/base/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -2036,8 +2036,8 @@
"subtitle": "Invite friends from your contacts list"
},
"jumpstart": {
"title": "Send with a live link",
"subtitle": "Copy the link and share it to send crypto just like a text"
"title": "Send with a Live Link",
"subtitle": "Share a link to send crypto like a text"
},
"getStarted": {
"title": "Ways to send funds on Valora",
Expand Down
13 changes: 11 additions & 2 deletions src/components/SelectRecipientButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,24 @@ type Props = {
subtitle: string
onPress: () => void
icon: ReactElement
iconBackgroundColor?: colors
testID: string
showCheckmark?: boolean
}

function SelectRecipientButton({ title, subtitle, onPress, icon, testID, showCheckmark }: Props) {
function SelectRecipientButton({
title,
subtitle,
onPress,
icon,
iconBackgroundColor = colors.gray1,
testID,
showCheckmark,
}: Props) {
return (
<Touchable testID={testID} onPress={onPress} style={styles.container}>
<View style={styles.body}>
<CircledIcon radius={40} style={styles.icon} backgroundColor={colors.gray1}>
<CircledIcon radius={40} style={styles.icon} backgroundColor={iconBackgroundColor}>
{icon}
</CircledIcon>
{showCheckmark && (
Expand Down
76 changes: 0 additions & 76 deletions src/jumpstart/SelectJumpstartRecipientButton.tsx

This file was deleted.

29 changes: 26 additions & 3 deletions src/send/SelectRecipientButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@ import {
check as checkPermission,
request as requestPermission,
} from 'react-native-permissions'
import { SendEvents } from 'src/analytics/Events'
import { JumpstartEvents, SendEvents } from 'src/analytics/Events'
import ValoraAnalytics from 'src/analytics/ValoraAnalytics'
import { phoneNumberVerifiedSelector } from 'src/app/selectors'
import Dialog from 'src/components/Dialog'
import SelectRecipientButton from 'src/components/SelectRecipientButton'
import MagicWand from 'src/icons/MagicWand'
import QRCode from 'src/icons/QRCode'
import Social from 'src/icons/Social'
import SelectRecipientJumpstartButton from 'src/jumpstart/SelectJumpstartRecipientButton'
import { navigate } from 'src/navigator/NavigationService'
import { Screens } from 'src/navigator/Screens'
import { useSelector } from 'src/redux/hooks'
import { getFeatureGate } from 'src/statsig'
import { StatsigFeatureGates } from 'src/statsig/types'
import Colors from 'src/styles/colors'
import { jumpstartSendTokensSelector } from 'src/tokens/selectors'
import Logger from 'src/utils/Logger'
import { CONTACTS_PERMISSION } from 'src/utils/contacts'
import { navigateToPhoneSettings } from 'src/utils/linking'
Expand All @@ -30,6 +34,9 @@ type Props = {
export default function SelectRecipientButtons({ onContactsPermissionGranted }: Props) {
const { t } = useTranslation()
const phoneNumberVerified = useSelector(phoneNumberVerifiedSelector)
const jumpstartSendEnabled = getFeatureGate(StatsigFeatureGates.SHOW_JUMPSTART_SEND)
const jumpstartTokens = useSelector(jumpstartSendTokensSelector)

const [contactsPermissionStatus, setContactsPermissionStatus] = useState<
PermissionStatus | undefined
>(undefined)
Expand Down Expand Up @@ -143,9 +150,25 @@ export default function SelectRecipientButtons({ onContactsPermissionGranted }:
setShowEnableContactsModal(false)
}

const onPressJumpstart = () => {
ValoraAnalytics.track(JumpstartEvents.send_select_recipient_jumpstart)
navigate(Screens.JumpstartEnterAmount)
}

const showJumpstart = jumpstartSendEnabled && jumpstartTokens.length > 0

return (
<>
<SelectRecipientJumpstartButton />
{showJumpstart && (
<SelectRecipientButton
testID={'SelectRecipient/Jumpstart'}
title={t('sendSelectRecipient.jumpstart.title')}
subtitle={t('sendSelectRecipient.jumpstart.subtitle')}
onPress={onPressJumpstart}
icon={<MagicWand />}
iconBackgroundColor={Colors.successLight}
/>
)}
<SelectRecipientButton
testID={'SelectRecipient/QR'}
title={t('sendSelectRecipient.qr.title')}
Expand Down

0 comments on commit 836ba87

Please sign in to comment.