-
Notifications
You must be signed in to change notification settings - Fork 4
fix: Clicking on the PayButton in Button Generator #1084
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -363,7 +363,7 @@ export default function ButtonGenerator (): JSX.Element { | |||||
| <PayButtonWidget | ||||||
| key={`widget-${JSON.stringify(button)}`} | ||||||
| to={button.to} | ||||||
| amount={parseFloat(button.amount)} | ||||||
| amount={button.amount === '' ? undefined : parseFloat(button.amount)} | ||||||
| currency={button.currency} | ||||||
| text={button.text === '' ? undefined : button.text} | ||||||
| hoverText={ | ||||||
|
|
@@ -385,7 +385,7 @@ export default function ButtonGenerator (): JSX.Element { | |||||
| ? undefined | ||||||
| : button.onTransaction | ||||||
| } | ||||||
| randomSatoshis={button.randomSatoshis} | ||||||
| randomSatoshis={button.amount !== '' ? button.randomSatoshis : undefined} | ||||||
| hideToasts={button.hideToasts} | ||||||
| disableEnforceFocus={button.disableEnforceFocus} | ||||||
| contributionOffset={button.contributionOffset} | ||||||
|
|
@@ -398,7 +398,7 @@ export default function ButtonGenerator (): JSX.Element { | |||||
| <PayButton | ||||||
| key={`button-${JSON.stringify(button)}`} | ||||||
| to={button.to} | ||||||
| amount={button.amount} | ||||||
| amount={button.amount === '' ? undefined : button.amount} | ||||||
| currency={button.currency} | ||||||
| text={button.text === '' ? undefined : button.text} | ||||||
| hoverText={ | ||||||
|
|
@@ -420,16 +420,16 @@ export default function ButtonGenerator (): JSX.Element { | |||||
| ? undefined | ||||||
| : button.onTransaction | ||||||
| } | ||||||
| randomSatoshis={button.randomSatoshis} | ||||||
| randomSatoshis={button.amount !== '' ? button.randomSatoshis : undefined} | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent check for The check Apply the same fix as suggested for line 388: - randomSatoshis={button.amount !== '' ? button.randomSatoshis : undefined}
+ randomSatoshis={parseFloat(button.amount) > 0 ? button.randomSatoshis : undefined}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| hideToasts={button.hideToasts} | ||||||
| disableEnforceFocus={button.disableEnforceFocus} | ||||||
| contributionOffset={button.contributionOffset} | ||||||
| disableAltpayment={button.disableAltpayment} | ||||||
| disabled={button.disabled} | ||||||
| editable={button.editable} | ||||||
| autoClose={button.autoClose} | ||||||
| onOpen={button.onOpen} | ||||||
| onClose={button.onClose} | ||||||
| onOpen={button.onOpen === '' ? undefined : button.onOpen} | ||||||
| onClose={button.onClose === '' ? undefined : button.onClose} | ||||||
| wsBaseURL={button.wsBaseURL} | ||||||
| apiBaseURL={button.apiBaseURL} | ||||||
| /> | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent checks for
amountandrandomSatoshislogic.Line 366 correctly parses
amountto float for the widget. However, line 388's checkbutton.amount !== ''is inconsistent with the UI visibility logic at line 325, which usesparseFloat(button.amount) > 0. This mismatch means that if a user enters "0" or "0.0", therandomSatoshisfield won't be shown in the form (line 325 returnsnull), but the prop would still be passed to the component (line 388 would evaluate totrue).Consider aligning the check with the UI visibility logic:
Also applies to: 388-388
🤖 Prompt for AI Agents