feat: warn about no funds in dashboard instructions (CPL-248)#282
feat: warn about no funds in dashboard instructions (CPL-248)#282
Conversation
Add a warning banner in the Instructions section when the credit balance is zero. The banner includes a link to the Add Funds modal. Hidden when billing is unavailable or the account has credits.
- Hide no-funds warning when billing becomes unavailable (prevents contradictory UI with 'Payment Not Required' banner) - Guard balance_cents with type check to prevent null coercion producing a false 'no funds' warning
There was a problem hiding this comment.
Pull request overview
Adds a “no funds available” warning to the Lit Express dashboard Instructions section, driven by the billing balance API, so users are prompted to add credits before running Lit Actions.
Changes:
- Introduces a hidden
#no-funds-warningbanner in the Instructions card with an “add funds” call-to-action. - Adds JS logic to show/hide the banner based on
billing/balance(balance_centssign semantics) and to hide it on logout / billing-disabled states. - Adds amber warning styles for the new banner.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
lit-static/dapps/dashboard/index.html |
Adds the warning banner markup in the Instructions section. |
lit-static/dapps/dashboard/app.js |
Implements show/hide logic for the banner and wires the banner CTA to the Add Funds modal. |
lit-static/dapps/dashboard/styles.css |
Adds styling for the new warning banner. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| <div class="card-body"> | ||
| <div id="no-funds-warning" class="no-funds-warning" role="alert" style="display: none;"> | ||
| <strong>No funds available</strong> | ||
| <p>Your account has no credit balance. Please <a href="#" id="no-funds-add-funds">add funds</a> for Lit Actions to work.</p> |
There was a problem hiding this comment.
The “add funds” control is implemented as an <a href="#"> with a click handler. For accessibility/semantics this should be a <button type="button"> (styled like a link), or a real navigational link, so it behaves correctly for keyboard users and assistive tech without relying on preventDefault().
| <p>Your account has no credit balance. Please <a href="#" id="no-funds-add-funds">add funds</a> for Lit Actions to work.</p> | |
| <p>Your account has no credit balance. Please <button type="button" id="no-funds-add-funds">add funds</button> for Lit Actions to work.</p> |
Summary
Adds a warning banner in the dashboard's Instructions section when the account has zero credit balance (CPL-248).
balance_cents >= 0, with a link to the Add Funds modalbalance_centsis guarded with a type check to preventnullcoercion from showing a false warningFiles Changed
lit-static/dapps/dashboard/index.html— new#no-funds-warningelementlit-static/dapps/dashboard/app.js— show/hide logic inloadBillingBalance(),updateAuthUI(),refreshBillingUI(), and click handler ininitBilling()lit-static/dapps/dashboard/styles.css—.no-funds-warningamber warning stylesPre-Landing Review
No issues found. Adversarial review (Claude + Codex) identified two edge cases that were fixed:
nullcoercion onbalance_centsproducing a false positive warningScope Drift
Scope Check: CLEAN. All changes directly implement CPL-248.
Test plan
cargo checkpassed)🤖 Generated with Claude Code