Skip to content

feat: warn about no funds in dashboard instructions (CPL-248)#282

Merged
GTC6244 merged 2 commits intonextfrom
feature/cpl-248-warn-about-no-funds
Apr 13, 2026
Merged

feat: warn about no funds in dashboard instructions (CPL-248)#282
GTC6244 merged 2 commits intonextfrom
feature/cpl-248-warn-about-no-funds

Conversation

@GTC6244
Copy link
Copy Markdown
Contributor

@GTC6244 GTC6244 commented Apr 13, 2026

Summary

Adds a warning banner in the dashboard's Instructions section when the account has zero credit balance (CPL-248).

  • No-funds warning — amber banner appears above instructions when balance_cents >= 0, with a link to the Add Funds modal
  • State management — warning is hidden on logout, when billing is unavailable ("Payment Not Required"), and when the API response is missing/invalid
  • Null safetybalance_cents is guarded with a type check to prevent null coercion from showing a false warning

Files Changed

  • lit-static/dapps/dashboard/index.html — new #no-funds-warning element
  • lit-static/dapps/dashboard/app.js — show/hide logic in loadBillingBalance(), updateAuthUI(), refreshBillingUI(), and click handler in initBilling()
  • lit-static/dapps/dashboard/styles.css.no-funds-warning amber warning styles

Pre-Landing Review

No issues found. Adversarial review (Claude + Codex) identified two edge cases that were fixed:

  • Contradictory UI when billing toggles from available to unavailable (warning + "Payment Not Required" both visible)
  • null coercion on balance_cents producing a false positive warning

Scope Drift

Scope Check: CLEAN. All changes directly implement CPL-248.

Test plan

  • Dashboard with zero credit balance shows amber "No funds available" warning above instructions
  • Dashboard with negative balance (has credits) does not show warning
  • Clicking "add funds" link in warning opens the Add Funds modal
  • Warning hidden when billing is unavailable (Stripe disabled)
  • Warning hidden after logging out
  • Rust backend compiles clean (cargo check passed)

🤖 Generated with Claude Code

GTC6244 added 2 commits April 13, 2026 15:57
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
Copy link
Copy Markdown
Contributor

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

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-warning banner in the Instructions card with an “add funds” call-to-action.
  • Adds JS logic to show/hide the banner based on billing/balance (balance_cents sign 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>
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

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

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().

Suggested change
<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>

Copilot uses AI. Check for mistakes.
Comment thread lit-static/dapps/dashboard/app.js
@GTC6244 GTC6244 changed the base branch from main to next April 13, 2026 20:16
@GTC6244 GTC6244 merged commit f474b40 into next Apr 13, 2026
14 checks passed
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.

2 participants