feat(spa): responsive record-cards for the list on narrow viewports (#421)#528
Merged
Merged
Conversation
…421) On phones/tablets a wide changelist table is unreadable. Below Tailwind's `md` breakpoint the list now renders each object as a stacked, tappable record-card instead of the table. - @dar/ui `RecordCardList<Row>`: a generic, model-agnostic card layout that consumes the SAME `TableColumn<Row>[]` descriptors, rows, selection and navigation props as `Table` — a page defines its columns once and renders either layout. First column = card title (carries the open-in-new-tab anchor, #253); the rest become a label/value list. Selection checkboxes, loading skeletons, and the empty-state mirror `Table`. - @dar/ui `useMediaQuery(query)`: a generic `useSyncExternalStore`-based hook (no first-paint flash, inert without `matchMedia`). Switching the layout in JS keeps a single layout in the DOM, so there are no duplicate inputs/checkboxes. - ListPage swaps `Table` → `RecordCardList` under `(max-width: 767px)`, reusing the existing columns, selection and preserved-filter nav. Unit tests: RecordCardList (render, tap-to-open, new-tab anchor, modified-click guard, selection, loading, empty) + useMediaQuery (initial match, change, unsubscribe, no-matchMedia). Full vitest 124 passed; typecheck + eslint + stylelint + dark-mode guard clean; build ok. Closes #421 Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
On phones/tablets a wide changelist table is unreadable. Below Tailwind's
mdbreakpoint (768px),ListPagenow renders each object as a stacked, tappable record-card instead of the table — a long-standing mobile-parity gap (PM priorities §4 responsive UI / §7 mobile-tablet).Implements #421. No backend or wire-contract change — Tier 4 (frontend only).
What
@dar/uiRecordCardList<Row>— a generic, model-agnostic card layout that consumes the sameTableColumn<Row>[]descriptors, rows, selection, and navigation props asTable. A page defines its columns once and renders either layout. The first column is the card title (and carries the open-in-new-tab anchor, Navigation: Cmd/Ctrl+click (and middle-click) should open links in a new tab #253); the rest become a label/value list. Selection checkboxes, loading skeletons, and the empty-state mirrorTable.@dar/uiuseMediaQuery(query)— a genericuseSyncExternalStore-based hook: correct first-paint value (no flash), syncs across resizes, inert whenmatchMediais unavailable.ListPageswapsTable→RecordCardListunder(max-width: 767px), reusing the existingcolumns, selection state, and preserved-filter navigation. Switching in JS (not a CSShidden/md:blockpair) keeps a single layout in the DOM, so there are no duplicate inputs/checkboxes.Design notes
@dar/uigeneric (CLAUDE.md §7); inlinelist_editablecells still work in cards because they're the same render functions.Verification (matches the new CI gate #506)
pnpm -r typecheckclean (13 pkgs) ·pnpm lintclean (eslint--max-warnings 0+ stylelint + dark-mode coverage guard) ·pnpm -r buildok.pnpm test→ 124 passed (20 files), incl. newRecordCardList(7) +useMediaQuery(4) suites: render, tap-to-open, new-tab anchor, modified-click guard, selection-without-nav, loading skeletons, empty-state; hook initial-match / change / unsubscribe / no-matchMedia.Role / autonomy
Author / Architect. Tier 4 (frontend only, no contract/security surface) → agent-mergeable per
autonomy-policy.md.Closes #421
🤖 Generated with Claude Code