fix: disable generate invoice button when no amount is entered#258
Merged
benthecarman merged 1 commit intoHarborWallet:masterfrom Aug 25, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes issue #257 by disabling the "Generate Invoice" button when no amount is entered in the receive flow. The button becomes interactive only when the user has entered an amount value.
- Conditionally adds the
on_presshandler to the generate invoice button based on amount input - Updates button styling to show disabled state with gray text color for both regular and small buttons
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| harbor-ui/src/routes/receive.rs | Conditionally enables the generate invoice button only when amount is entered |
| harbor-ui/src/components/button.rs | Updates button styling to display gray text for disabled buttons |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| let generate_invoice_button = | ||
| h_button("Generate Invoice", SvgIcon::Qr, generating).on_press(Message::GenerateInvoice); | ||
| let mut generate_invoice_button = h_button("Generate Invoice", SvgIcon::Qr, generating); | ||
| if !harbor.receive_amount_str.is_empty() { |
There was a problem hiding this comment.
The condition only checks if the string is not empty, but doesn't validate if it contains a valid amount. An empty string, whitespace-only string, or invalid input like 'abc' would be treated differently. Consider checking for a valid parsed amount instead of just non-empty string.
Suggested change
| if !harbor.receive_amount_str.is_empty() { | |
| if harbor | |
| .receive_amount_str | |
| .trim() | |
| .parse::<u64>() | |
| .map_or(false, |amt| amt > 0) | |
| { |
benthecarman
approved these changes
Aug 25, 2025
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #257