Skip to content

Restyle the UI to follow the CloudCLI host theme (from ango-dev fork) - #8

Merged
HandyS11 merged 4 commits into
mainfrom
feat/host-theme-restyle
Nov 1, 2026
Merged

HandyS11 merged 4 commits into
mainfrom
feat/host-theme-restyle

Conversation

@HandyS11

@HandyS11 HandyS11 commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Brings in the UI restyle from the ango-dev fork. The four commits are cherry-picked with ango-dev kept as the author. Only src/index.ts changes; the server, data and API logic are untouched.

What changes

  • Uses the host theme: colours read the CloudCLI CSS variables (--background, --card, --border, --primary, --destructive, …), with light and dark fallbacks. Fonts switch to the host's Geist / Geist Mono / Source Serif 4, and corners follow --radius. Success and warning colours are tuned for 4.5:1 contrast in both modes.
  • Header bar like the host's built-in tabs: icon, title, plan badge, subtitle, and a refresh icon button that spins while loading. The header stays fixed while the body scrolls, and the scroll position is kept across re-renders.
  • Phone and narrow widths: the layout follows the container width. Stats drop to two columns, the model and project tables stack, and padding tightens. Hover styles only apply on devices with a mouse.
  • Chart readout: a day's date, tokens and cost appear under the chart on mouse hover, tap or finger drag, or with the arrow keys / Home / End. Escape, tapping elsewhere or leaving the chart puts the date range back. Before, this was only in a title tooltip, which touch screens never show.

Differences from the fork

Testing

  • npm run build: no type errors
  • npm test: 33/33 pass
  • Not yet checked visually in a running CloudCLI instance. Please check the tab in light and dark mode and at phone width before merging.

🤖 Generated with Claude Code

Colours read the host's CSS variables (background, card, border, input,
foreground, muted-foreground, primary, accent, ring, destructive) with
light/dark fallbacks for hosts that lack them. Fonts switch to the host's
Geist / Geist Mono / Source Serif 4, corners derive from --radius, danger
uses --destructive, and success/warning are tuned for 4.5:1 contrast in
both modes. The refresh button gains hover and focus-visible states.
Appearance only: no behaviour, server or manifest changes.
- Replace the large serif page title with a header bar like the host's
  built-in Browser tab: icon, title, plan badge, subtitle and a ghost
  refresh icon button that spins during a full load.
- Update colour fallbacks to the host's exact token values, including the
  darker, neutral dark-mode border.
- Hover styles apply only on devices with a real pointer, as in the host.
- Lay out by container width so the panel fits phones and a narrowed
  workspace: stats drop to two columns, the model and project tables
  stack, and padding tightens.
- The header stays fixed while the body scrolls, and the body keeps its
  scroll position across re-renders.

The plan badge moves to the header; the "updated" age stays on the plan
limits card. The tab keeps its "Claude Usage" name.

(cherry picked from ango-dev/cloudcli-plugin-claude-usage@53b4809)
The day's tokens and cost were only in a title tooltip, which touch
screens never show. Hovering a bar with a mouse, tapping or dragging a
finger along the bars, or using the arrow keys once the chart has focus
now marks that day's column and puts its date, tokens and cost in the
line under the chart, in place of the date range. Leaving the chart,
tapping elsewhere or Escape goes back to the range.

Also drops a stale duplicate of the State interface.
Copilot AI balanced review requested due to automatic review settings November 1, 2026 20:51
@HandyS11
HandyS11 merged commit 5d4c7da into main Nov 1, 2026
3 checks passed
@HandyS11
HandyS11 deleted the feat/host-theme-restyle branch November 1, 2026 20:54
HandyS11 added a commit that referenced this pull request Nov 1, 2026
Includes the usage endpoint rate-limit fix (#7) and the host theme
restyle (#8).

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

An unresolved moderate accessibility issue remains, where periodic re-renders replace the chart's DOM and drop keyboard focus, interrupting arrow-key navigation until the user re-focuses the chart.

1 open issue
What changed in this PR

This PR restyles the Claude Usage plugin's UI (src/index.ts only) to inherit the CloudCLI host theme instead of hard-coded colours. Colours now read host CSS variables (--background, --card, --primary, --destructive, …) with light/dark fallbacks, fonts switch to the host's Geist / Geist Mono, and corners derive from --radius. It also reworks the layout into a fixed header + scrollable body, adds container-query responsiveness, and introduces an interactive chart readout (pointer hover, touch drag, and keyboard navigation) to replace the touch-invisible title tooltip. Server, data, and API logic are untouched, and the 5‑minute poll / 1‑minute re-render cadence from #7 is preserved.

Changes:

  • Theme refactored to resolve host HSL CSS variables via a FALLBACKS map + radius() helper, with tuned success/warning colours for 4.5:1 contrast.
  • Header/body split in mount() (sticky header with icon, title, plan badge, spinning refresh button; scrollable reused body), plus a <style> block of classes and container queries.
  • New chart interaction: activeDay state, chartReadout(), and pointer/touch/keyboard handlers with matching cleanup for the added window listeners.
File Description
src/​index.ts Rewrites the plugin UI to follow the host theme (CSS variables, fonts, radius), splits layout into a fixed header and scrollable body, adds responsive container-query styles, and implements an interactive daily-usage chart with pointer, touch, and keyboard navigation plus listener cleanup.

Review effort: Balanced

Comment thread src/index.ts
Comment on lines +339 to 342
body.innerHTML = `
${renderLive(c, state.live, state.liveError)}
${renderHistory(c, state.history, state.historyError)}
${renderHistory(c, state.history, state.historyError, state.activeDay)}
`;
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.

3 participants