Skip to content

feat(billing): add persistent funding banner with reusable banner variants - #3442

Merged
ygrishajev merged 1 commit into
mainfrom
feat/billing-funding-banner
Jul 16, 2026
Merged

feat(billing): add persistent funding banner with reusable banner variants#3442
ygrishajev merged 1 commit into
mainfrom
feat/billing-funding-banner

Conversation

@ygrishajev

@ygrishajev ygrishajev commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Why

Closes CON-321
Ref CON-679

Trial users only had a path to fund their account from a gated template tile or the billing page. This adds a persistent funding prompt in the global navigation so an unfunded user can start their first purchase from anywhere — the funding-based unlock that improves trial-to-paid conversion.

Along the way, the app-wide banners were each bespoke <div>s with ad-hoc styling and duplicated positioning. This standardizes them into one reusable, theme-aware primitive with semantic variants, so every global banner shares a consistent look.

What

@akashnetwork/ui — new Banner primitive

  • cva-based variants (error / warning / success / info / neutral), theme-aware for light and dark, with optional click (» affordance, keyboard-activatable) and dismiss () controls. Layout-agnostic.

deploy-web — funding banner (replaces the credit-card banner)

  • New FundingBanner (info variant, Figma copy) shown to signed-in trial users who haven't funded yet, via a new useHasFundingBanner hook. Hidden once the account is funded, and suppressed inside the stripped onboarding deploy funnel (the configure page for first-time users) where the page owns its own funding / GPU-unlock UI. Clicking it opens the Add Credits sheet.
  • The old CreditCardBanner / useHasCreditCardBanner are removed.

deploy-web — existing banners + layout

  • Network-status → error, maintenance → warning, announcements → neutral, all now rendered through the shared Banner.
  • The banner now lives inside the header's fixed container (above the nav row) instead of being a second fixed element with a hardcoded 40px gap — so the nav can never cover it. The header publishes its real height (--app-header-height), and the content offset tracks it, so the banner stays fully visible and wraps correctly on small screens.
Screenshot 2026-07-16 at 16 57 50 Screenshot 2026-07-16 at 16 58 08 Screenshot 2026-07-16 at 16 58 29 Screenshot 2026-07-16 at 16 58 40 Screenshot 2026-07-16 at 16 58 53 Screenshot 2026-07-16 at 16 59 04

Verification

  • Unit tests green: Banner (ui), FundingBanner, useHasFundingBanner (visibility truth table incl. the onboarding-funnel case), plus the existing TopBanner / useTopBanner specs.
  • ESLint clean on all changed files. tsc --noEmit introduces no new errors over the pre-existing baseline (verified by stashing the change and diffing the erroring-file set — 81 pre-existing, none in the changed files).

Summary by CodeRabbit

  • New Features

    • Added an always-on funding banner for eligible trial accounts, with an “add credits” sheet.
    • Introduced a reusable, variant-based Banner component with click, dismiss, and keyboard accessibility.
    • Updated top banners to use funding-related visibility and standardized network/maintenance banners.
  • Bug Fixes

    • Refined banner visibility rules using funding status, wallet readiness, and onboarding funnel context.
    • Improved layout spacing by measuring header height so content offsets correctly when the banner wraps.
  • Tests

    • Added/expanded Vitest coverage for funding banner behavior, Banner interactions, and top-banner messaging.

@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c19da592-dc6c-4fbf-a5fc-646408851228

📥 Commits

Reviewing files that changed from the base of the PR and between 1b38515 and b49420a.

📒 Files selected for processing (14)
  • apps/deploy-web/src/components/layout/FundingBanner/FundingBanner.spec.tsx
  • apps/deploy-web/src/components/layout/FundingBanner/FundingBanner.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/layout/Nav.tsx
  • apps/deploy-web/src/components/layout/Sidebar.tsx
  • apps/deploy-web/src/components/layout/TopBanner.spec.tsx
  • apps/deploy-web/src/components/layout/TopBanner.tsx
  • apps/deploy-web/src/hooks/useHasCreditCardBanner.ts
  • apps/deploy-web/src/hooks/useHasFundingBanner.spec.ts
  • apps/deploy-web/src/hooks/useHasFundingBanner.ts
  • apps/deploy-web/src/hooks/useTopBanner.tsx
  • packages/ui/components/banner/banner.spec.tsx
  • packages/ui/components/banner/banner.tsx
  • packages/ui/components/index.tsx
💤 Files with no reviewable changes (1)
  • apps/deploy-web/src/hooks/useHasCreditCardBanner.ts
🚧 Files skipped from review as they are similar to previous changes (11)
  • packages/ui/components/index.tsx
  • apps/deploy-web/src/hooks/useHasFundingBanner.ts
  • apps/deploy-web/src/hooks/useHasFundingBanner.spec.ts
  • packages/ui/components/banner/banner.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/layout/TopBanner.spec.tsx
  • apps/deploy-web/src/components/layout/FundingBanner/FundingBanner.tsx
  • packages/ui/components/banner/banner.spec.tsx
  • apps/deploy-web/src/components/layout/Nav.tsx
  • apps/deploy-web/src/hooks/useTopBanner.tsx
  • apps/deploy-web/src/components/layout/TopBanner.tsx

📝 Walkthrough

Walkthrough

Adds a reusable Banner, introduces funding-banner eligibility and AddCreditsSheet interaction, replaces credit-card banner state with funding state, and measures the navigation header to maintain layout offsets as top banners resize.

Changes

Funding banner and top-app layout

Layer / File(s) Summary
Shared Banner component
packages/ui/components/banner/*, packages/ui/components/index.tsx
Adds styled banner variants with click, keyboard activation, dismissal behavior, tests, and public exports.
Funding eligibility and sheet interaction
apps/deploy-web/src/hooks/useHasFundingBanner.*, apps/deploy-web/src/components/layout/FundingBanner/*
Determines funding-banner visibility from user, wallet, and onboarding state, then opens and closes AddCreditsSheet with wallet-readiness props.
Top-banner state and rendering
apps/deploy-web/src/hooks/useTopBanner.tsx, apps/deploy-web/src/components/layout/TopBanner.*
Switches top-banner routing to funding eligibility and uses the shared Banner for network, maintenance, and generic messages, with expanded component tests.
Measured header layout offset
apps/deploy-web/src/components/layout/Nav.tsx, apps/deploy-web/src/components/layout/Layout.tsx, apps/deploy-web/src/components/layout/Sidebar.tsx
Places TopBanner inside the navigation header, publishes its measured height through ResizeObserver, and uses CSS-variable-backed offsets for the main content and desktop sidebar.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested reviewers: baktun14

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/billing-funding-banner

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.76812% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.62%. Comparing base (5339649) to head (b49420a).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
apps/deploy-web/src/components/layout/Nav.tsx 6.25% 14 Missing and 1 partial ⚠️
...pps/deploy-web/src/components/layout/TopBanner.tsx 79.31% 4 Missing and 2 partials ⚠️
apps/deploy-web/src/components/layout/Layout.tsx 50.00% 2 Missing ⚠️
apps/deploy-web/src/hooks/useTopBanner.tsx 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3442      +/-   ##
==========================================
- Coverage   72.62%   71.62%   -1.00%     
==========================================
  Files        1167     1078      -89     
  Lines       29552    27228    -2324     
  Branches     7330     6873     -457     
==========================================
- Hits        21463    19503    -1960     
+ Misses       7104     6776     -328     
+ Partials      985      949      -36     
Flag Coverage Δ *Carryforward flag
api 85.98% <ø> (ø) Carriedforward from 5339649
deploy-web 61.61% <63.76%> (+0.21%) ⬆️
log-collector ?
notifications 91.44% <ø> (ø) Carriedforward from 5339649
provider-console 81.38% <ø> (ø)
provider-inventory ?
provider-proxy 86.42% <ø> (ø) Carriedforward from 5339649
tx-signer ?

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
.../components/layout/FundingBanner/FundingBanner.tsx 100.00% <100.00%> (ø)
apps/deploy-web/src/components/layout/Sidebar.tsx 6.45% <100.00%> (ø)
apps/deploy-web/src/hooks/useHasFundingBanner.ts 100.00% <100.00%> (ø)
apps/deploy-web/src/components/layout/Layout.tsx 14.89% <50.00%> (+3.52%) ⬆️
apps/deploy-web/src/hooks/useTopBanner.tsx 40.98% <0.00%> (ø)
...pps/deploy-web/src/components/layout/TopBanner.tsx 73.33% <79.31%> (+59.69%) ⬆️
apps/deploy-web/src/components/layout/Nav.tsx 10.34% <6.25%> (-5.04%) ⬇️

... and 91 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/deploy-web/src/components/layout/Layout.tsx (1)

108-108: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Desktop sidebar offset should use the header height var. mdDrawerClassName is applied to the permanent md drawer, but it still hardcodes mt-[97px] / h-[calc(100%-40px)] off hasBanner. If the banner wraps, the sidebar can drift out of sync with the actual header height.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/deploy-web/src/components/layout/Layout.tsx` at line 108, Update the
mdDrawerClassName styling for the permanent desktop drawer in Layout so its top
offset and height derive from the shared header-height variable rather than
hardcoded values or only hasBanner. Keep the drawer aligned with the actual,
potentially wrapped header height in all banner states.
🧹 Nitpick comments (1)
packages/ui/components/banner/banner.spec.tsx (1)

1-63: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Good, meaningful assertions — one coverage gap worth adding.

Consider a test asserting that keyboard-activating the dismiss button (Enter/Space) while onClick is also set does not invoke onClick — this is exactly the scenario the bubbling bug in banner.tsx (Lines 66-71) breaks today.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/components/banner/banner.spec.tsx` around lines 1 - 63, Add a
Banner test covering keyboard activation of the dismiss control when both
onClick and onClose are provided. In the existing dismiss-control interaction
coverage, trigger Enter and Space on the button named “Dismiss,” assert onClose
is invoked appropriately, and verify the parent onClick handler is never called.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/ui/components/banner/banner.tsx`:
- Around line 36-71: Update activateOnEnterOrSpace to ignore keydown events
whose target is the nested dismiss button, while preserving Enter/Space
activation for the banner itself and other valid targets. Keep the existing
dismiss stopPropagation behavior unchanged.

---

Outside diff comments:
In `@apps/deploy-web/src/components/layout/Layout.tsx`:
- Line 108: Update the mdDrawerClassName styling for the permanent desktop
drawer in Layout so its top offset and height derive from the shared
header-height variable rather than hardcoded values or only hasBanner. Keep the
drawer aligned with the actual, potentially wrapped header height in all banner
states.

---

Nitpick comments:
In `@packages/ui/components/banner/banner.spec.tsx`:
- Around line 1-63: Add a Banner test covering keyboard activation of the
dismiss control when both onClick and onClose are provided. In the existing
dismiss-control interaction coverage, trigger Enter and Space on the button
named “Dismiss,” assert onClose is invoked appropriately, and verify the parent
onClick handler is never called.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1df83de7-fa38-445a-9a82-ff2eb6c8f868

📥 Commits

Reviewing files that changed from the base of the PR and between 5339649 and 2338a8c.

📒 Files selected for processing (12)
  • apps/deploy-web/src/components/layout/FundingBanner/FundingBanner.spec.tsx
  • apps/deploy-web/src/components/layout/FundingBanner/FundingBanner.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/layout/Nav.tsx
  • apps/deploy-web/src/components/layout/TopBanner.tsx
  • apps/deploy-web/src/hooks/useHasCreditCardBanner.ts
  • apps/deploy-web/src/hooks/useHasFundingBanner.spec.ts
  • apps/deploy-web/src/hooks/useHasFundingBanner.ts
  • apps/deploy-web/src/hooks/useTopBanner.tsx
  • packages/ui/components/banner/banner.spec.tsx
  • packages/ui/components/banner/banner.tsx
  • packages/ui/components/index.tsx
💤 Files with no reviewable changes (1)
  • apps/deploy-web/src/hooks/useHasCreditCardBanner.ts

Comment thread packages/ui/components/banner/banner.tsx
@ygrishajev
ygrishajev force-pushed the feat/billing-funding-banner branch from 2338a8c to 1b38515 Compare July 16, 2026 15:40

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/deploy-web/src/components/layout/TopBanner.tsx`:
- Line 16: Update the effect in TopBanner to clear the isUpgrading state when
date is absent before returning. Preserve the existing date-based upgrade
handling for non-empty dates.
- Around line 107-108: Update the sidebar layout logic associated with hasBanner
to use the --app-header-height CSS variable for its top margin and remaining
height instead of fixed mt-[97px] and h-[calc(100%-40px)] values. Preserve the
existing non-banner layout and ensure the desktop drawer remains positioned
below the rendered header, including when FundingBanner wraps.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2416bce0-2aea-44b3-9f71-839bb24bc72b

📥 Commits

Reviewing files that changed from the base of the PR and between 2338a8c and 1b38515.

📒 Files selected for processing (13)
  • apps/deploy-web/src/components/layout/FundingBanner/FundingBanner.spec.tsx
  • apps/deploy-web/src/components/layout/FundingBanner/FundingBanner.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/components/layout/Nav.tsx
  • apps/deploy-web/src/components/layout/TopBanner.spec.tsx
  • apps/deploy-web/src/components/layout/TopBanner.tsx
  • apps/deploy-web/src/hooks/useHasCreditCardBanner.ts
  • apps/deploy-web/src/hooks/useHasFundingBanner.spec.ts
  • apps/deploy-web/src/hooks/useHasFundingBanner.ts
  • apps/deploy-web/src/hooks/useTopBanner.tsx
  • packages/ui/components/banner/banner.spec.tsx
  • packages/ui/components/banner/banner.tsx
  • packages/ui/components/index.tsx
💤 Files with no reviewable changes (1)
  • apps/deploy-web/src/hooks/useHasCreditCardBanner.ts
🚧 Files skipped from review as they are similar to previous changes (8)
  • apps/deploy-web/src/components/layout/FundingBanner/FundingBanner.tsx
  • apps/deploy-web/src/components/layout/Nav.tsx
  • packages/ui/components/banner/banner.spec.tsx
  • apps/deploy-web/src/hooks/useHasFundingBanner.spec.ts
  • packages/ui/components/banner/banner.tsx
  • apps/deploy-web/src/hooks/useTopBanner.tsx
  • apps/deploy-web/src/components/layout/Layout.tsx
  • apps/deploy-web/src/hooks/useHasFundingBanner.ts

Comment thread apps/deploy-web/src/components/layout/TopBanner.tsx Outdated
Comment thread apps/deploy-web/src/components/layout/TopBanner.tsx
…iants

Introduce a theme-aware Banner primitive in @akashnetwork/ui with toast-like
variants (error/warning/success/info/neutral) and optional click and dismiss
affordances.

Replace the credit-card top banner with a funding banner shown to signed-in
trial users who haven't funded yet. Clicking it opens the Add Credits sheet,
and it hides once the account is funded.

Move the existing network-status, maintenance, and announcement banners onto
the shared Banner with semantic variants.
@ygrishajev
ygrishajev force-pushed the feat/billing-funding-banner branch from 1b38515 to b49420a Compare July 16, 2026 16:35
@ygrishajev
ygrishajev added this pull request to the merge queue Jul 16, 2026
Merged via the queue into main with commit e7d9050 Jul 16, 2026
59 checks passed
@ygrishajev
ygrishajev deleted the feat/billing-funding-banner branch July 16, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants