Repository navigation
Overview page: design kit, skeleton and error states, live edge, clickable breakdowns - #196
Merged
Merged
Conversation
…kable breakdowns Split the 1151-line Dashboard.tsx into src/overview/ on the UI kit from #187: OverviewPage, useOverview (useResource per range, cached, previous range kept on screen while a new one loads), HeroStats, TrendSection, CacheSection, LatencySection, SecuritySection, OverviewStatus, OverviewSkeleton, parts.tsx, and series.ts (pure data shaping, tested). useLive.ts moves into the folder and splits into useInFlight (header) and useLiveWindow (live range). - Loading skeleton laid out box for box like the loaded page; ErrorState with Retry when the first read of a range fails; outlined EmptyState before the first request, whose "Add upstream" opens the Upstreams create dialog. - Hero: header summary (in progress, upstreams, unavailable), three columns with a delta chip ("—" when the prior period is empty), failed / unpriced qualifiers link to Traffic. - Motion: AnimatedNumber everywhere (scoped to the range), motion-bar on all bars, ranking rows slide in and out, one left-to-right chart draw on range change, live badge and a one-shot ping at the live edge. - Model, cache, latency and upstream rows, failure marks and security rows open Traffic (or the security log) filtered to what was clicked. - Latency uses the same window as the rest of the page (dashboard.rs). - A model with tokens but no cost shows "—" instead of "$0"; let-through security findings are amber, not red; the "Other" layer is grey. - Removed the dead RequestDrawer state, triggers.ts, the dashboard command's history field and shadcn chart's unused parts. Kit additions: --chart-other and motion-ping. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn
added a commit
that referenced
this pull request
Sep 25, 2026
The Keys and Clients redesign (#190) changed `key_usage` to take `{sinceMs, bucketMs}` and return `KeyUsage`, and `upstream_stats` gained hourly buckets. The mock still answered the old shapes, and nothing failed: its command handlers returned `unknown`, so the pages rendered error states that the capture accepted. - Every Tauri command handler now returns the type the interface reads (`KeyUsage`, `UpstreamStats`, `Dashboard`, `ConnView`, ...), and the stored core answers are checked against the core types. `pnpm typecheck`, which CI runs, now includes `scripts/shots/`, so a changed generated type fails the Frontend job. It already caught the Overview redesign (#196) dropping `history` from `Dashboard`. - At capture time, a command the mock does not answer or one called without the arguments it expects is logged as an error and stops the run, instead of falling back to a default time window. - `key_usage` and `upstream_stats` return totals plus sparse buckets, as tw-store's `cost_by` / `cost_buckets_by` do; `input_tokens` in the totals no longer includes cache reads and writes. `dashboard` computes latency over the same window as the summary, with tw-store's percentile rule, as dashboard.rs now asks for. - The menu bar images take the page's fixed clock (`--now`) instead of the system clock, so runs on different days are byte-identical. Run on its own, `menubar_shots` uses the same instant. - A scene with a table that does not fit the window fails instead of being captured with its last columns cut off. The MCP scene collapses the sidebar so the six client columns fit. - Demo configuration: every secret keeps the first 5 and last 4 characters shown in the masked views, with EXAMPLE in the middle (zeros for the hex control key). Cursor's key gets its own route to a `cheapest` group, so the routing page has three routes and three groups; the core answers are regenerated with oracle.sh (core v0.47.0). - Review fixes: the hidden-text event counts 74 characters, the length of the text it reveals; the remote MCP finding uses tw-scan's rule id `remote-mcp`; CONTRIBUTING names `fetch-core.sh` and uses US spelling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fylorn
added a commit
that referenced
this pull request
Sep 25, 2026
) * build(shots): regenerate the product screenshots from the real interface The screenshots in docs/screenshots/ were taken with a pipeline that lived in an ignored local directory and was lost. This one is in the repository and runs with one command, `pnpm shots` (macOS only): - scripts/shots/ is a separate Vite entry that mounts src/main.tsx on mocked IPC. It is not part of the app build, and src/index.css now keeps scripts/ out of Tailwind's source scan, so the app bundle is the same with or without it. - The configuration views (upstreams, keys, routes, security rules, prices, dry runs) are what the pinned core answers for a demo configuration, stored in scripts/shots/core/ and regenerated by oracle.sh. Masking, detected protocols, rule flags and prices are therefore core's own, and sentences carry their real message codes. - The clock is fixed and the traffic comes from a fixed seed, so two runs write byte-identical files. - capture.swift renders each scene in the system WKWebView, the engine the app uses on macOS, and frames it as a macOS 26 window. - examples/menubar_shots.rs draws the menu bar item and its menu with the app's own rendering code, at exactly 2x. - finish.mjs writes 256-colour PNGs to docs/screenshots/ and the website's WebP variants to docs/screenshots/web/. sharp is a new dev dependency; its install script is not needed and not allowed to run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * build(shots): follow the redesigned pages and catch mock drift in CI The Keys and Clients redesign (#190) changed `key_usage` to take `{sinceMs, bucketMs}` and return `KeyUsage`, and `upstream_stats` gained hourly buckets. The mock still answered the old shapes, and nothing failed: its command handlers returned `unknown`, so the pages rendered error states that the capture accepted. - Every Tauri command handler now returns the type the interface reads (`KeyUsage`, `UpstreamStats`, `Dashboard`, `ConnView`, ...), and the stored core answers are checked against the core types. `pnpm typecheck`, which CI runs, now includes `scripts/shots/`, so a changed generated type fails the Frontend job. It already caught the Overview redesign (#196) dropping `history` from `Dashboard`. - At capture time, a command the mock does not answer or one called without the arguments it expects is logged as an error and stops the run, instead of falling back to a default time window. - `key_usage` and `upstream_stats` return totals plus sparse buckets, as tw-store's `cost_by` / `cost_buckets_by` do; `input_tokens` in the totals no longer includes cache reads and writes. `dashboard` computes latency over the same window as the summary, with tw-store's percentile rule, as dashboard.rs now asks for. - The menu bar images take the page's fixed clock (`--now`) instead of the system clock, so runs on different days are byte-identical. Run on its own, `menubar_shots` uses the same instant. - A scene with a table that does not fit the window fails instead of being captured with its last columns cut off. The MCP scene collapses the sidebar so the six client columns fit. - Demo configuration: every secret keeps the first 5 and last 4 characters shown in the masked views, with EXAMPLE in the middle (zeros for the hex control key). Cursor's key gets its own route to a `cheapest` group, so the routing page has three routes and three groups; the core answers are regenerated with oracle.sh (core v0.47.0). - Review fixes: the hidden-text event counts 74 characters, the length of the text it reveals; the remote MCP finding uses tw-scan's rule id `remote-mcp`; CONTRIBUTING names `fetch-core.sh` and uses US spelling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs(screenshots): add screenshots of the current interface Generated with `pnpm shots` on dev at 3b8638e (after the Keys, Clients, Routing, Upstreams, Settings, Traffic and Overview redesigns, #190-#199), core v0.47.0. Two complete runs produce byte-identical files. - `{zh,en}/<scene>-{light,dark}.png`: 13 scenes, 2360x1540. - `menubar-{light,dark}.png` (178x64) and `{zh,en}/menubar-menu-*.png` (664x1120). - `web/`: the website variants (WebP from the dark images, and the dark menu bar item as PNG). The English menu images were drawn with the menu bar layout fix from #195 applied, which this branch does not contain: without it, "Resets in 3 days" and "4 failed" run into the text beside them. Every other image, including the Chinese menus, is the same with or without that fix. The old images and the README references are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * shots: wait for the traffic table's deferred render before capturing The table body renders through useDeferredValue; on a busy machine the capture's idle and stable-snapshot checks pass before that render commits, and the scene is shot with only the in-flight row while the run succeeds. Wait until the table has its rows. Images are unchanged at normal speed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The overview was one 1151-line
Dashboard.tsxwith a bare "loading" line, an error branch that could never render, jumping numbers and nothing to click. It is now split intosrc/overview/and built on the UI kit from #187.Structure
OverviewPage(Page / PageHeader, range picker in the header),useOverview(oneuseResourceentry per range: revisits and switching back to a range show cached data at once; while an uncached range loads, the previous one stays on screen and dims only after 120 ms),HeroStats,TrendSection(chart, failure strip, ticks, and the model ranking that doubles as its legend),CacheSection,LatencySection,SecuritySection,OverviewStatus(header summary),OverviewSkeleton,parts.tsx(LinkRow, LinkText, Meter, ModelMark, LiveBadge).series.ts: the data shaping as pure functions (stack order hysteresis, pinned y-axis ceiling, tick placement, cache and latency rows), covered byseries.test.ts.useLive.tsmoves intosrc/overview/and splits intouseInFlight(header, always on) anduseLiveWindow(live range only).RequestDrawer/openstate and the recent-requests list it served,triggers.ts, thehistoryfield of thedashboardcommand, and the unused config / legend / tooltip-content parts of shadcn'schart.tsx.States
ErrorStatewith Retry when the first read of a range fails; it stays in place while retrying. A failed background refresh keeps the data on screen.EmptyState. With no upstreams its button opens the Upstreams "new upstream" dialog directly (thecreatedeep link from Command palette: search entities, open page dialogs, shortcut sheet #192); otherwise it opens Clients. Sections with nothing in the selected range keep their height and say so in one line, so switching ranges does not make the page jump.Hero
/in-flightand follows the event stream), enabled upstreams, and unavailable upstreams as a link to the first one on the Upstreams page. All animated.Motion (medium, reduced-motion aware)
AnimatedNumberscoped to the range: refreshes count up, switching range jumps.motion-bar; ranking rows slide in and out.charts.tsxheader comment).motion-ping) each time a request lands.Clickable breakdowns
role="link", open with Enter or Space, and show a chevron on hover. Hovering a ranking row highlights its layer in the chart.Data fixes
src-tauri/src/dashboard.rs). It used core's default window ("today"), so under "7 days" the latency section silently meant something else.--chart-other), no longer the fifth model's shade.Kit additions (additive)
--chart-othertoken,motion-pingutility (off under reduced motion), and their rows insrc/ui/README.md. The range picker's Live dot is aStatusDot.Core follow-up (not in this PR)
CostBucketGroup(/summary/buckets/by) should carryunpriced_requests(andno_usage_requests) per model, likeCostBucketandCostGroupdo. Then the ranking can show which model's cost is missing instead of "—".Checks
pnpm typecheck,pnpm test,pnpm build;cargo fmt --check,cargo clippy --all-targets -D warnings,cargo test(with twcore 0.47.0). Checked in the full-app preview harness in light and dark, zh and en, at 1100×720 and 820×560, live / 24 h / 7 d / 30 d / cost, empty, failing and slow reads, hover states, and click-through to Traffic, Upstreams and the security log.🤖 Generated with Claude Code