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

change input type=number in send and recieve amount #242

Merged
merged 23 commits into from
Dec 19, 2022
Merged

change input type=number in send and recieve amount #242

merged 23 commits into from
Dec 19, 2022

Conversation

benalleng
Copy link
Collaborator

@benalleng benalleng commented Dec 17, 2022

as referenced in MutinyWallet/mutiny-web-poc#15 the inputs for where only numbers should be are actually text currently. Hoping to prevent non-numbers and negative numbers where those would cause errors

Comment on lines 28 to 33
if (amount) {
const params = objectToSearchParams<ReceiveParams>({ amount, description })
// Important! Otherwise we might see a stale bip21 code
queryClient.invalidateQueries({ queryKey: ['bip21'] })
navigate(`/receive/qr?${params}`)
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this formatting looks weird, should run the linter

@benalleng

This comment was marked as resolved.

@benalleng benalleng marked this pull request as draft December 17, 2022 22:08
@benalleng benalleng marked this pull request as ready for review December 17, 2022 22:42
@benalleng benalleng marked this pull request as draft December 18, 2022 00:42
@benalleng
Copy link
Collaborator Author

sorry for the wave of commits, I kept thinking of more and more edge cases...
It should now accept only numbers while allowing you to still create zero-amount invoices along with adding commas for when you need to keep track of typing larger numbers.
As well on phones it appears to be a number text field but still behaves like a text field so any non-numeric characters pasted in accidentally will still be treated with the same logic as a on desktop.
Shout out to chatGPT for coming in clutch.

@futurepaul futurepaul marked this pull request as ready for review December 19, 2022 17:30
Copy link
Contributor

@futurepaul futurepaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice, thank you! I have some followup changes so we can format this with underscores like in the ui (100_000) but this is a great start

@futurepaul futurepaul merged commit 7d41a7d into MutinyWallet:master Dec 19, 2022
@futurepaul futurepaul mentioned this pull request Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants