Skip to content

Commit

Permalink
refactor(send): update button text from send to continue on recipient…
Browse files Browse the repository at this point in the history
… selection (#4732)

### Description

Per Laura's request. Updated this button on selecting a recipient with
address to Continue instead of Send. Also, made specific translation
keys so this can be updated OTA

### Test plan

Unit tests, manual

### Related issues

N/A

### Backwards compatibility

Yes
  • Loading branch information
satish-ravi authored Jan 11, 2024
1 parent 93ccca7 commit f7b371e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 11 deletions.
6 changes: 5 additions & 1 deletion locales/base/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -1974,7 +1974,11 @@
"title": "Connect your phone number",
"description": "You need to connect your phone number so you can start sending crypto to your friends"
},
"unknownAddressInfo": "Please make sure this address supports the asset you are trying to send. Your funds may not be recoverable if this address is invalid."
"unknownAddressInfo": "Please make sure this address supports the asset you are trying to send. Your funds may not be recoverable if this address is invalid.",
"buttons": {
"send": "Continue",
"invite": "Invite"
}
},
"transactionStatus": {
"transactionIsCompleted": "Completed",
Expand Down
27 changes: 18 additions & 9 deletions src/send/SendSelectRecipient.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ describe('SendSelectRecipient', () => {
})

expect(getByTestId('SendOrInviteButton')).toBeTruthy()
expect(getByTestId('SendOrInviteButton')).toHaveTextContent('sendSelectRecipient.buttons.send')

await act(() => {
fireEvent.press(getByTestId('SendOrInviteButton'))
Expand All @@ -203,15 +204,13 @@ describe('SendSelectRecipient', () => {
}
)

// Uncomment once we can actually navigate to this screen

// expect(navigate).toHaveBeenCalledWith(Screens.SendEnterAmount, {
// isFromScan: false,
// defaultTokenIdOverride: undefined,
// forceTokenId: undefined,
// recipient: expect.any(Object),
// origin: SendOrigin.AppSendFlow,
// })
expect(navigate).toHaveBeenCalledWith(Screens.SendEnterAmount, {
isFromScan: false,
defaultTokenIdOverride: undefined,
forceTokenId: undefined,
recipient: expect.any(Object),
origin: SendOrigin.AppSendFlow,
})
})
it('navigates to send amount when address recipient is pressed', async () => {
const store = createMockStore(defaultStore)
Expand All @@ -231,10 +230,17 @@ describe('SendSelectRecipient', () => {
})

expect(getByTestId('SendOrInviteButton')).toBeTruthy()
expect(getByTestId('SendOrInviteButton')).toHaveTextContent('sendSelectRecipient.buttons.send')

await act(() => {
fireEvent.press(getByTestId('SendOrInviteButton'))
})
expect(ValoraAnalytics.track).toHaveBeenCalledWith(
SendEvents.send_select_recipient_send_press,
{
recipientType: RecipientType.Address,
}
)
expect(navigate).toHaveBeenCalledWith(Screens.SendEnterAmount, {
isFromScan: false,
defaultTokenIdOverride: undefined,
Expand Down Expand Up @@ -265,6 +271,9 @@ describe('SendSelectRecipient', () => {
})

expect(getByTestId('SendOrInviteButton')).toBeTruthy()
expect(getByTestId('SendOrInviteButton')).toHaveTextContent(
'sendSelectRecipient.buttons.invite'
)

await act(() => {
fireEvent.press(getByTestId('SendOrInviteButton'))
Expand Down
6 changes: 5 additions & 1 deletion src/send/SendSelectRecipient.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,11 @@ function SendOrInviteButton({
style={styles.sendOrInviteButton}
onPress={() => onPress(shouldInviteRecipient)}
disabled={sendOrInviteButtonDisabled}
text={shouldInviteRecipient ? t('invite') : t('send')}
text={
shouldInviteRecipient
? t('sendSelectRecipient.buttons.invite')
: t('sendSelectRecipient.buttons.send')
}
size={BtnSizes.FULL}
/>
)
Expand Down

0 comments on commit f7b371e

Please sign in to comment.