Skip to content

feat(web): Redesign the usage page as a black and blue dashboard - #115

Merged
4ndreello merged 2 commits into
mainfrom
feat/web-usage-redesign
Sep 23, 2026
Merged

4ndreello merged 2 commits into
mainfrom
feat/web-usage-redesign

Conversation

@4ndreello

Copy link
Copy Markdown
Owner

Summary

The /usage page of codedeck ui showed raw numbers, a single table and unstyled controls. This rebuilds it as a black and blue analytics dashboard and adds the first CodeDeck brand assets.

  • src/web/brand.ts: palette tokens, the edge-on deck logo as inline SVG, the favicon and a shared top bar with navigation. Home and Setup can adopt it later.
  • Masked numbers everywhere: 16.8M tokens, $1,865.42, one-decimal shares, the exact value in title. Incomplete cost shows ≥ $X with an "N unpriced" pill instead of a bare ?.
  • KPI cards (spend, sessions, total tokens, cache hit) with sparklines and deltas against the previous equal window (3d, 7d, 30d only, hidden on a zero base).
  • Line chart with a Spend / Tokens / Sessions switch and a crosshair, sized to the measured container width so axis text stays at 11px on any viewport.
  • Model donut (top 6 plus Other, spend in the center), ranked repos, outcome bar with failures in red, harness and origin shares.
  • One range picker (Today, 3d, 7d, 30d, All, Custom), filter chips, and a live refresh toggle that polls without a loading flash. The state lives in the URL (period, repo, model, agent, since, until, by).
  • Table with tabs, sorting, top 10 plus "Show all N", search with the / hotkey, and RFC 4180 CSV export.

Hardening found in review and fixed here:

  • bucket labels are escaped inside SVG <title>. A model id like <img src=x onerror=...> used to run script through innerHTML.
  • stale poll responses no longer overwrite a newer filter's result.
  • search runs before the top 10 cut and keeps focus and caret across polls.
  • the previous window uses calendar days, so it does not drift an hour across DST.

Spec and tasks: .specs/features/web-usage-redesign/. The static mock used as the visual reference stays local because it was built from real usage data.

Out of scope: Home and Setup restyle, the repo grouping of worktree paths, a recent sessions widget, and daemon or API changes. The default range is still Today.

Testing

  • npx vitest run tests/usage-page.test.ts tests/usage-web.test.ts tests/web-brand.test.ts tests/ui-render.test.ts tests/web-cli.test.ts: 5 files, 98 tests passed.
  • npx tsc --noEmit and npm run build pass.
  • Headless Chromium at 1440px (Today, 7d) and 390px (30d): no horizontal scroll, smallest text 10px, no light controls, one range picker, no console errors.
  • Mutation probe in a scratch copy: 15 behavior faults injected (unbound fetch, masking thresholds, ≥ prefix, delta rules, donut limit, loading on poll, query param ignored, unescaped title, stale response guard, focus restore, search order, fixed-ms DST windows, single-point sparkline). All 15 killed.

4ndreello and others added 2 commits September 23, 2026 17:39
Define the black and blue brand tokens, the edge-on deck logo, and the usage dashboard requirements with a coverage matrix.
Add a shared brand module with the palette, the edge-on deck logo, the favicon and the top bar. Rebuild /usage with masked numbers, KPI cards with sparklines and deltas, a line chart with a crosshair, a model donut, repo, outcome, harness and origin breakdowns, one range picker, filter chips, and a searchable table with CSV export.

Escape bucket labels in SVG titles, ignore stale poll responses, keep search focus across polls, and compute the previous window in calendar days.

Co-Authored-By: Claude <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@4ndreello
4ndreello merged commit 813a97c into main Sep 23, 2026
4 checks passed
@4ndreello
4ndreello deleted the feat/web-usage-redesign branch September 23, 2026 21:06
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