Repository navigation
improve(ui): simplify Usage controls at phone width - #190387
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs changes before merge. What this changesThis PR condenses phone-width Usage controls into a filter sheet and actions menu and improves narrow provider-card layouts. Example: Open Usage at 390px with the 30-day range selected.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 3 items remain Keep this PR open: the phone layout provides clear value, but three concrete integration and validation defects need repair. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe Control UI Usage page renders Gateway usage data and forwards filter, refresh, and export actions to existing page owners. flowchart TD
A[Gateway usage data] --> B[Usage page owner]
B --> C[Usage presentation]
C --> D[Phone toolbar and filter sheet]
C --> E[Desktop controls]
D --> F[Existing filter and export callbacks]
E --> F
Technical reviewBest possible solution: Keep the compact layout while reusing existing focus traversal, updating every typed consumer, and reducing CSS enough to satisfy the existing asset gate. Do we have a high-confidence way to reproduce the issue? The current-main toolbar structure and inspected before screenshot establish the phone-width crowding; no target code was executed during this review. Is this the best way to solve the issue? The responsive layout is worthwhile and preserves existing domain callbacks, but its focus traversal, consumer cutover, and CSS growth need the repairs listed below. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 51be373f6b15. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceAcceptance criteria:
What I checked:
PR surfaceSource +651, Tests +123. Total +774 across 12 files. Added test files: 1. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 1, 2026, 9:43 AM ET / 14:43 UTC. |
Simplify Usage controls on phones while preserving analytical state and export actions. Reuse the shared PhoneSheet and remove duplicate lifecycle and styles. Validation:52 focused tests, UI/test typechecks, interaction checks and fresh integrated review passed. Lands after the shared sheet fix in190374. CI41444581769 retains only the explicitly accepted CSS budget failure (+982 bytes gzip/+5726 raw) and aggregate; all other planned jobs passed.
What Problem This Solves
At phone width the Usage toolbar wraps into 13 stacked controls and 4 filter menus, so the first chart starts about 775px down the page. Provider plan cards also overflow their card on phones, on both Usage and Models.
User Impact
On phones, the range presets stay on the page, followed by the agent picker, Tokens/Cost and a filter button. The first chart now starts at 308px. Dates, time zone, identity, instance/lineage, query and the Channel, Provider, Model and Tool filters open in a bottom sheet. The filter button shows when any of them is active. Chart selections and query terms sit together in one row above the results, with the match count after them. Refresh and the three exports move to a three-dots menu with the same surface as the filter button.
Provider plan windows stack inside their card, and long Top models and Cost categories values wrap. The totals line starts at the card's left edge: the sparkline beside it draws nothing, because its color token
--oc-accentisn't defined on main, so on phones its empty box is dropped. At 360px and below, the daily chart shows five date labels instead of six so they don't collide. Desktop is unchanged.Removed on phones: Pin header (a sticky header would take too much of the viewport), the "Tip" line, and the "sessions in range" count when it only repeats the Sessions tile. The "x of y sessions match" count stays.
Why This Change Was Made
Range is the control people change most on a phone, and the rest are used rarely. The three-dots menu remains in the page header. The sheet is drawn in the top layer, so the page's stacking can't reach its backdrop. Inside the sheet every control follows one rhythm: a 16px side inset, 12px between rows, a 13px label above a 40px field, and a 16px value, which is iOS's input floor. Channel, Provider, Model and Tool read as labelled selects with the same chevron. Time zone and Identity are plain selects here, because a customizable select can't ellipsize its own label: a long value truncates and the chevron holds its place in every theme. Their list is the system's on phones. At 320px each date takes its own row, because a full date and its calendar don't fit in half the width. The date fields' calendar uses the selects' chevron color, stroke, size and inset, and still opens the picker. Safari on macOS draws no calendar icon, so it keeps its own field, and clicking a date opens its calendar. The close button is the plain 32px X the other sheets use. The two chip styles are left as they are: chart selections and query terms are different filter types with different owners.
Evidence
Screenshots use the mock data layer and real taps at 390px. Images show today's top bar until the floating header PR lands. For these captures only, a local mock change added filter options, per-provider daily rows and session detail data, because the stock mock has none of them; without provider rows, By Provider draws every bar as grey "Other". That mock change isn't part of this PR.
Real Safari: the filter button opened the final sheet with an OS click, in the mock's default dark theme. An OS click on Start date opened Safari's calendar, and choosing the 21st changed the range. The three-dots menu and the backdrop were checked with OS clicks on the previous revision.
Tapping a chart bar adds its day chip, and Daily CSV downloads from the menu. The page has no horizontal scroll at 390px or 320px. At 1280px, Usage header and provider boxes and the Models provider usage boxes match an unmodified page. At 390px, Models provider usage used to run off the screen and now fits.
The sheet images use the stock mock, opened with real taps at 390px and 320x568, with default and long values and no horizontal overflow.
Original revision checks: oxfmt, stylelint, oxlint,
tsgo:uiand the Usage and provider usage unit and browser tests pass (233 tests); the Usage tests, oxfmt and stylelint were rerun on this head.ui:check-performance:basefails on the total CSS budget: main is already over the cap, and this PR adds to it.Integration validation
The filter wrapper now uses the shared PhoneSheet from #190499, removing duplicate gesture, focus and dismissal code. Dates, timezone, identity, scope, query, facet values, chart selections and export callbacks are retained. Fifty-two focused tests, UI and UI-pages test typechecks, touched-file checks, a Chromium interaction check and shared PhoneSheet browser tests passed. The integrated source review found no blocking issues. This lands after #190374 and retains its closed-sheet dismissal fix. The captures above document the approved original visual revision.
CI 41444581769 completed with only the CSS budget and its aggregate failing: +982 bytes gzip and +5,726 bytes raw. The duplicate sheet implementation and styles have been removed; the remaining increase uses the authorized budget exception. All other planned jobs passed.