Skip to content

feat(providers): show live usage in the sidebar - #726

Merged
nixuuu merged 2 commits into
devfrom
feat/sidebar-usage-indicator
Nov 14, 2026
Merged

nixuuu merged 2 commits into
devfrom
feat/sidebar-usage-indicator

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

The sidebar now shows provider plan usage without opening Settings. One quiet, reserved footer slot contains a mini-bar for each provider with data, showing its highest active window across enabled instances. Hover on desktop or tap opens per-instance meters, reset times, billing notices and Open provider settings. The native mobile drawer has the same glance and details.

  • Below 70% is neutral, 70–89% warning, and 90%+ danger. Explicit extra usage uses a violet split bar; available credits alone never imply paid activity.
  • Reads the existing incremental worker overview. No additional requests or polling. Shared client clocks expire old windows and refresh reset labels, stopping when hidden.
  • Proxy instances are excluded. ProxyUsageSection exposes the small typed shape for a later upstream-account section without fetching or rendering proxy status.
  • Existing settings, worker and update controls retain their positions when usage disappears. Overlays reuse compact kit typography, truncated-name hints and existing motion with reduced-motion support.

Related: #697

Validation

  • bun install, bun run gen:check, whole-repo typecheck, lint, formatting and the web production build passed. Final overlay primitive changes were checked again with typecheck, lint, formatting and web build.
  • Focused tests: 9 passed, covering the new aggregation/projection and existing provider usage/bot WorkerLink integration. Includes threshold boundaries, worst active window across computers, expired windows, explicit extra usage, credit availability, missing data and proxy exclusion. No UI test suite was added or run.
  • iOS and Android exports passed with one Metro worker. Native fingerprints are unchanged: iOS 138e0c6b171c82b4933e86808cdfef56da73b8c6, Android 906dc944f94eb8333fa384ed9f198834fdd30d13. Tracked fingerprint source inputs have no differences from dev. No native dependency or configuration changes; eligible for the normal OTA release pipeline, no update published manually.
  • Manual browser review used a private remote gateway/BFF/database with synthetic usage and long instance/computer names: light and dark, 1280 px desktop, 760 px narrow drawer and 390 px phone sheet. Verified hover/tap, reset labels, neutral/warning/danger meters, distinct extra-usage glance, Settings navigation and no horizontal overflow. Removing all usage hid the trigger while settings/workers/updates retained identical measured positions. Review services, database container, tunnel and temporary checkout were removed afterwards.
  • Native mobile visuals remain unverified: no running simulator was available; device discovery reported a device-hub timeout. Exports and native fingerprints passed. No live provider calls or charges.

Copy audit (§8)

Before After Reason
No sidebar usage text “Show provider usage” and accessible provider percentages or “extra usage active” Name the action and convey meaning without relying only on colour.
Settings required for details “Provider usage”, instance and computer labels, existing “5-hour”, “Weekly”, “Resets in …” Keep the overlay compact and reuse established, localized meter copy.
No sidebar details action “Open provider settings” Verb-first action points directly to Providers.
No sidebar billing notice Existing “Extra usage credits are active.” / “Plan limit reached. Further turns may use credits.” Preserve the distinction between confirmed extra usage and available credits.

New copy uses sentence case, short labels, glossary terms, localized numbers and reset times. No new jargon, errors, empty states, destructive actions or humour. Full labels remain available through truncated-text hints; short, typical and long names were reviewed at desktop and phone widths. Status meaning is present in text and accessible labels as well as bar colour/shape.

@nixuuu
nixuuu marked this pull request as ready for review November 14, 2026 14:42
@nixuuu
nixuuu merged commit 2e58804 into dev Nov 14, 2026
12 checks passed
@nixuuu
nixuuu deleted the feat/sidebar-usage-indicator branch November 14, 2026 14:52
nixuuu added a commit that referenced this pull request Nov 14, 2026
Stage 3 of 3 (on #728). Adds proxy accounts to the sidebar usage glance
from #726, using its typed `ProxyUsageSection` slot. Also has the
gateway's first account check run shortly after startup.

- **Popover, web and mobile:** one row per CLIProxyAPI proxy that a
profile uses and whose accounts the gateway has read. The row shows
"Through <proxy>" (truncated) over "N accounts · M cooling down" and
links to the proxy card. Its accessible label is the full sentence
"Through <proxy>: N accounts · M cooling down".
  - Plan windows are never inferred from these accounts.
- Proxies without a key, unused proxies, unread or rejected accounts,
and non-CLIProxyAPI proxies are left out.
- **Trigger:** without plan usage but with proxy sections, the slot
shows a connection icon instead of bars. The aria label lists both.
- **Data source:** the existing shared `ListProxies` read, patched by
`OverviewUpdate.proxy_accounts`. Reading it never calls a proxy.
- **Gateway:** the first periodic check now runs about 15 s after
startup instead of 5 min, so the sidebar fills without opening settings.
- **Also in this stack (#728):** the mobile bot-chat failure card now
uses the proxy wording for proxy instances, matching web.
- **Tests and docs:** `sidebar-usage.test.ts` covers the section
projection and text. `docs/provider-accounts.md` replaces the old "not
rendered yet" note for `ProxyUsageSection`.

## Browser review
Reviewed on a separate review host with a fake CLIProxyAPI and a Codex
instance using the proxy, in light and dark at 1280 px:
- With only a proxy (no plan usage), the trigger showed the connection
icon.
- The popover row read "Through Team CLIProxyAPI" over "3 accounts · 1
cooling down" and linked to the proxy card.
- The first version truncated the counts ("1 co…"). Moving them to a
second line fixed it.

At phone width the page has no horizontal scroll. I did not check the
popover itself on a phone: it closes when the sidebar collapses, and I
didn't open the drawer. Mobile native visuals were not checked on a
device, but the Android and iOS exports pass. The change is JS only, so
the native fingerprint is unchanged.

## Checks
typecheck, lint, format:check, gen:check, web build, `expo export`
(android, ios). Domain tests pass, and the proxy-accounts, proxies,
provider-usage and schema integration tests pass.

## Copy audit (§8)
| Before | After | Reason |
| --- | --- | --- |
| (slot unused) | "Through Team CLIProxyAPI" / "3 accounts · 1 cooling
down" | Names the proxy; counts are the proxy's accounts, not the user's
plan. Short, no repeated facts. |
| Trigger label "Show provider usage. Codex: 42% used" | "Show provider
usage. … Through Team: 3 accounts · 1 cooling down" | The section is
spoken too; the icon is never the only cue. |
| (mobile bot failure) "A usage or turn limit was reached. … check your
plan …" | "The proxy reported a usage limit. Wait for it to reset or
check the proxy's accounts, then retry." | Same wording as web and as
thread failures. |
nixuuu added a commit that referenced this pull request Nov 15, 2026
Touch fires pointerleave right after the tap, before its click, so the
hover close timer shut the Updates and Provider usage popovers as soon
as the tap opened them. Only a mouse leaving closes them now.

Fixes: #726
Related: #98

Co-Authored-By: Claude Opus 5.5 <[email protected]>
nixuuu added a commit that referenced this pull request Nov 15, 2026
## Problem
On touch screens (mobile browsers) the sidebar **Updates** and
**Provider usage** popovers close right after a tap opens them.

Touch fires `pointerleave` right after the tap, before its `click`. At
that moment the popover isn't pinned yet, so `leave()` schedules the 250
ms hover close; the click then opens the popover and the timer closes
it.

## Fix
Only a mouse leaving schedules the close, as `HoverCard` already does.
On touch, a tap toggles the popover.

## Verification
- Local: oxfmt on the two edited files (no changes). Lint, typecheck and
tests are left to CI.
- Not checked yet on a real phone or in mobile emulation.
- Copy audit: no UI text changes.

Fixes: #726
Related: #98

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <[email protected]>
nixuuu added a commit that referenced this pull request Nov 18, 2026
## Problem

The Updates and Provider usage panels in the sidebar footer can overlap
when the pointer moves quickly between their triggers. Each panel
manages its own open state, so the first panel can stay open during its
250 ms pointer-leave grace period while the second opens.

## Change

- Share the active panel between the two footer controls and skip the
outgoing panel’s exit animation on handoff.
- Preserve the pointer grace period for moving into panel content. A
panel opened by activating its button takes priority over hover.
- Keep keyboard activation, Escape dismissal, focus return, and
narrow-screen sheets.

## Verification

Retested PR head `192bac0ae0c032b3a95b75bc51d9d03dad3ce116` locally on
`nix-pc` after syncing with `dev`. The isolated Chromium 155 regression
using the shared Popover passed all four viewport and theme
combinations. The three edited Svelte components compiled without
warnings. The sync includes #979, which fixes the worker shutdown race
that caused the route migration test to time out in CI.

- An isolated Chromium regression using the shared Popover reproduced
simultaneous open panels with the previous independent state and passed
with the fix.
- Verified handoff in both directions, entry into panel content,
pointer-leave dismissal, keyboard activation, Escape and focus return on
the applicable widths. Checked light and dark at 390 px and 1024 px.
- Compiled the three edited Svelte components and ran the formatter on
the edited TypeScript and CSS. Repository-wide checks remain with CI.
- Copy audit: no UI text changes.

Fixes: #726
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.

1 participant