Skip to content

Conversation

@tvolk131
Copy link
Contributor

Fixes #257

Copilot AI review requested due to automatic review settings August 20, 2025 00:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_press handler 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() {
Copy link

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

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

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)
{

Copilot uses AI. Check for mistakes.
@benthecarman benthecarman merged commit 2420124 into HarborWallet:master Aug 25, 2025
1 check passed
@tvolk131 tvolk131 deleted the disable_generate_invoice_button branch September 4, 2025 03:51
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.

"Generate Invoice" button should be greyed out until an amount is entered

2 participants