Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(send): update button text from send to continue on recipient selection #4732

Merged
merged 4 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading