fix(dashboard): wrap usage stat tiles into a responsive grid on mobile#418
Conversation
StatCard is flex-1 with min-w-0 (sized by its container track), so the usage page's wrapping flex row never wrapped: all seven tiles shrank onto one unusable line on phone widths. The tiles now use the same responsive grid as the overview page (2 columns on phones, 3 from sm, 4 from xl), verified at a 390px viewport: two tiles per row, no horizontal overflow. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
WalkthroughThe Usage tiles now use responsive grid columns. Generated dashboard bundles and the HTML entrypoint reference updated hashed assets, while compiled component logic remains unchanged. ChangesDashboard updates
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
web/src/pages/UsagePage.tsx (1)
652-656: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a regression test for the responsive tiles layout.
web/src/pages/UsagePage.test.tsxverifies that tile content renders, but not that the container uses the responsive grid. Add a focused Vitest assertion or viewport/visual test so a future regression toflex-wrapis caught.As per coding guidelines, changes under
web/src/**/*.{ts,tsx,css}must include colocated Vitest tests for changed behavior.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/src/pages/UsagePage.tsx` around lines 652 - 656, Add a colocated Vitest regression test in UsagePage.test.tsx that renders UsagePage and asserts the tiles container uses the responsive grid classes, including grid-cols-2, sm:grid-cols-3, and xl:grid-cols-4, rather than a wrapping flex layout. Keep the test focused on the responsive layout behavior and preserve existing tile-content assertions.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@web/src/pages/UsagePage.tsx`:
- Around line 652-656: Add a colocated Vitest regression test in
UsagePage.test.tsx that renders UsagePage and asserts the tiles container uses
the responsive grid classes, including grid-cols-2, sm:grid-cols-3, and
xl:grid-cols-4, rather than a wrapping flex layout. Keep the test focused on the
responsive layout behavior and preserve existing tile-content assertions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ff43ff2f-b3d1-40d4-9c86-a312b2998b32
📒 Files selected for processing (17)
src/gateway/static/dashboard/assets/ActivityPage-B6j_aVh9.jssrc/gateway/static/dashboard/assets/AliasesPage-Chlhfn8l.jssrc/gateway/static/dashboard/assets/BudgetsPage-BAJNRbKO.jssrc/gateway/static/dashboard/assets/ConfirmDialog-CCJnWoSc.jssrc/gateway/static/dashboard/assets/KeysPage-D5EjvMLy.jssrc/gateway/static/dashboard/assets/ModelScopeControl-Dz7NaZdS.jssrc/gateway/static/dashboard/assets/ModelsPage-rWHJVsLp.jssrc/gateway/static/dashboard/assets/OverviewPage-qo0xwTL4.jssrc/gateway/static/dashboard/assets/ProvidersPage-BKCHydlE.jssrc/gateway/static/dashboard/assets/SettingsPage-D0bz-SUp.jssrc/gateway/static/dashboard/assets/TablePagination-DlTV4kUZ.jssrc/gateway/static/dashboard/assets/ToolsGuardrailsPage-BVn9h5wq.jssrc/gateway/static/dashboard/assets/UsagePage-DOWOrs0n.jssrc/gateway/static/dashboard/assets/UsersPage-B7fcuwaB.jssrc/gateway/static/dashboard/assets/index-BzgMrLHf.jssrc/gateway/static/dashboard/index.htmlweb/src/pages/UsagePage.tsx
Description
On phone widths the usage page's seven stat tiles all squeezed onto a single row instead of wrapping, leaving them unreadably narrow. Root cause:
StatCardisflex-1withmin-w-0(deliberately sized by its container track, per its own comment), and the usage page wrapped them inflex flex-wrap; with a zero flex basis and no minimum width the items shrink forever, so wrapping never triggers.The tiles now use the same responsive grid as the overview page (
grid-cols-2,sm:grid-cols-3,xl:grid-cols-4), which is the container shape StatCard was designed for.Verified in a scripted 390px viewport: two tiles per row across four rows, no horizontal overflow; at 1440px the tiles sit 4+3 with no overflow.
PR Type
Relevant issues
None filed; reported directly by the maintainer from a deployed instance in mobile view.
Checklist
npm --prefix web run typecheckandnpm --prefix web testpass; dashboard bundle rebuilt and committed; no Python touched).AI Usage
AI Model/Tool used: Claude Code (Claude Fable 5)
Any additional AI details you'd like to share:
Diagnosed and fixed by Claude Code under njbrake's direction from his report of the mobile layout; verified with scripted browser checks at 390px and 1440px viewports.
🤖 Generated with Claude Code
Summary
This prevents tiles from becoming too narrow and avoids horizontal overflow on small screens.