Skip to content

improve(ui): simplify Usage controls at phone width - #190387

Merged
vyctorbrzezowski merged 7 commits into
mainfrom
brzezowski/mobile-usage-controls
Nov 2, 2026
Merged

vyctorbrzezowski merged 7 commits into
mainfrom
brzezowski/mobile-usage-controls

Conversation

@vyctorbrzezowski

@vyctorbrzezowski vyctorbrzezowski commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

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-accent isn'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.

Before After Filter sheet
Applied filters Actions, dark Filter sheet, CRT
Provider plans Real Safari 27.0.1, date picker open

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:ui and 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:base fails 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.

@vyctorbrzezowski vyctorbrzezowski self-assigned this Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added the clawsweeper:intake:feature Preliminary submission classification; full source review pending. label Nov 1, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Nov 1, 2026
@clawsweeper

clawsweeper Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This 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.

  • Before: Stacked controls push the first chart about 775px down the page.
  • After: Presets, agent selection, metric selection, and a filter button leave the first chart about 308px down.

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) Strong visual evidence supports the improvement, but explicit guard, typed-consumer, and asset-budget defects prevent a passing patch verdict.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (screenshot): Inspected browser screenshots exercise the actual Usage presentation with synthetic Gateway data at 390px, showing the compact toolbar, opened sheet, chart selection, and query chips; additional Safari and provider-card attachments were unavailable locally, which is a reviewer-side inspection limit.
Patch quality 🦪 silver shellfish (2/6) 3 actionable review findings remain.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Phone users must scroll past a large control stack before seeing usage charts, and provider details can overflow narrow cards.
Reason: The inspected comparison shows substantially more useful content above the fold; maintainer authorship supplies the direction decision.

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
Reviewed head: d64f1d45c60044ef88486715d1ba8169b9ed7076

Before merge

  • Reuse the existing focus traversal instead of querying owned DOM (P2) - The new panel.querySelectorAll call is deterministically rejected by scripts/check-control-ui-controllers.mts:460 because this file is outside the foreign-DOM owner list. This violates the explicit UI guard and prevents the changed lint gate from passing. Use the existing tabbableElements traversal over panel.children, or registered refs, without widening the guard.
  • Update the existing caller for the required placement property (P2) - Making placement required leaves createComponent(UsageQueryFilter, ...) in ui/src/components/menu-check-alignment.browser.test.ts:74 without a required property. That caller no longer satisfies the component's TypeScript contract, even though the production-only UI typecheck excludes test files. Pass the desktop placement from this consumer or preserve the existing bottom-start default through an optional property.
  • Bring the added styles within the enforced CSS growth budget (P2) - The current-head performance annotations explicitly identify additional raw and gzip CSS growth beyond an already-over-budget base: 1569.1 versus 1564.6 KiB raw and 303.3 versus 302.5 KiB gzip. The gate permits only 64 bytes of variance in that situation, so the existing base failure does not exempt this added styling. Consolidate or reuse existing sheet and control styles until the comparison passes without raising the budget.

Findings

  • [P2] Reuse the existing focus traversal instead of querying owned DOM — ui/src/pages/usage/view-filter-sheet.tsx:36-38
  • [P2] Update the existing caller for the required placement property — ui/src/pages/usage/view-query-filter.tsx:16
  • [P2] Bring the added styles within the enforced CSS growth budget — ui/src/styles/usage.css:1957-1958

Tests

  • Low-value test ui/src/pages/usage/view-phone-layout.browser.test.ts: Remove or replace the test named “routes Refresh and every export through the three-dots menu”: it only enumerates static item IDs and never selects an action or verifies routing.
  • Missing end-to-end proof: No red-on-base result is supplied for the added phone-layout regressions.
Agent review details

How this fits together

The 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
Loading

Technical review

Best 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:

  • [P2] Reuse the existing focus traversal instead of querying owned DOM — ui/src/pages/usage/view-filter-sheet.tsx:36-38
    The new panel.querySelectorAll call is deterministically rejected by scripts/check-control-ui-controllers.mts:460 because this file is outside the foreign-DOM owner list. This violates the explicit UI guard and prevents the changed lint gate from passing. Use the existing tabbableElements traversal over panel.children, or registered refs, without widening the guard.
    Confidence: 1
  • [P2] Update the existing caller for the required placement property — ui/src/pages/usage/view-query-filter.tsx:16
    Making placement required leaves createComponent(UsageQueryFilter, ...) in ui/src/components/menu-check-alignment.browser.test.ts:74 without a required property. That caller no longer satisfies the component's TypeScript contract, even though the production-only UI typecheck excludes test files. Pass the desktop placement from this consumer or preserve the existing bottom-start default through an optional property.
    Confidence: 0.99
  • [P2] Bring the added styles within the enforced CSS growth budget — ui/src/styles/usage.css:1957-1958
    The current-head performance annotations explicitly identify additional raw and gzip CSS growth beyond an already-over-budget base: 1569.1 versus 1564.6 KiB raw and 303.3 versus 302.5 KiB gzip. The gate permits only 64 bytes of variance in that situation, so the existing base failure does not exempt this added styling. Consolidate or reuse existing sheet and control styles until the comparison passes without raising the budget.
    Confidence: 1

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 51be373f6b15.

Provenance checked

Testing

Proof path: shipped entry point.

Security

None.

Evidence

Acceptance criteria:

  • pnpm check:control-ui-controllers
  • pnpm tsgo:ui
  • pnpm tsgo:test:ui
  • pnpm lint:ui:styles
  • pnpm ui:check-performance:base

What I checked:

  • Introduced change and current main: Reviewed the pinned merge-base-to-head diff; current main retains the full toolbar and lacks this phone sheet. (ui/src/pages/usage/view.tsx:151, d64f1d45c600)
  • Visual evidence: Inspected the four prepared screenshots: before, after, open filter sheet, and applied filters. They show real rendered controls with synthetic data and substantiate the central visual improvement. (d64f1d45c600)
  • Forbidden DOM query: The new sheet queries its own rendered controls; the existing guard explicitly rejects querySelectorAll outside its foreign-DOM owner list. (scripts/check-control-ui-controllers.mts:460, d64f1d45c600)
  • CSS failure attributable to growth: The performance check reports raw CSS of 1569.1 KiB against 1564.6 KiB and gzip CSS of 303.3 KiB against 302.5 KiB; its annotations explicitly prohibit growth beyond 64 bytes when the base already exceeds the cap. (ui/src/styles/usage.css:1958, d64f1d45c600)
  • Unmigrated typed consumer: The existing menu-alignment browser test constructs UsageQueryFilter without the newly required placement property. (ui/src/components/menu-check-alignment.browser.test.ts:74, d64f1d45c600)
  • History and existing ownership: History identifies the native-menu migration, retained Usage presentation work, provider-card redesign, and recent shared field styling as the relevant ownership trail. (ui/src/pages/usage/view-query-filter.tsx:16, 51be373f6b15)

PR surface

Source +651, Tests +123. Total +774 across 12 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 11 1053 402 +651
Tests 1 123 0 +123
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 1176 402 +774

Labels

Label changes:

  • add P2: A useful phone-layout improvement with focused integration defects and limited runtime blast radius.
  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦞 diamond lobster and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: A useful phone-layout improvement with focused integration defects and limited runtime blast radius.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦞 diamond lobster and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 1, 2026, 9:43 AM ET / 14:43 UTC.

@vyctorbrzezowski
vyctorbrzezowski merged commit 11d0746 into main Nov 2, 2026
86 of 89 checks passed
@vyctorbrzezowski
vyctorbrzezowski deleted the brzezowski/mobile-usage-controls branch November 2, 2026 12:41
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 3, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant