Skip to content

admin 0.9.0, parts 1–2: the frame and the list page - #21

Merged
jgb-solutions merged 12 commits into
mainfrom
feat/admin-frame-logic
Dec 6, 2026
Merged

jgb-solutions merged 12 commits into
mainfrom
feat/admin-frame-logic

Conversation

@jgb-solutions

@jgb-solutions jgb-solutions commented Dec 6, 2026 •

Copy link
Copy Markdown
Owner

The first parts of the new admin, which replaces kit/admin in 0.9.0: the frame and the list page. It follows spec items 1–8 in section 10.3 of the design-system plan, built on kit/ui and the admin theme from #19. The code is in src/admin-next/ and is not exported yet. The swap into src/admin, its package exports and the CHANGELOG "Upgrading" note come in the last part, so main never ships half an admin.

  • AdminFrame: a top bar (menu button below 1040 px, brand, centred search, account slot), the nav as a column that stays put while the page scrolls, and a drawer below 1040 px. The drawer uses the native modal <dialog>: focus stays inside, Esc and the scrim close it, focus returns to the menu button, and choosing a page closes it. It moves to the kit's Sheet when Fable's overlays PR lands. There is one skip link, and the admin theme and compact density apply on the frame's root only.
  • Nav: data in, via resolveNav. Exactly one item has aria-current="page"; sub-items show only under the open section; groups have titles; Settings is pinned to the bottom. Number badges show "99+" but read the full count ("1,200 pending").
  • AdminSearch: a field-shaped button, an icon on phones (its name stays for screen readers). ⌘K or Ctrl+K anywhere, and / outside text fields, open it. It calls the app's onOpen until the ⌘K palette ships.
  • PageHeader: one h1, a back link that keeps the list's URL (and so its filters), a status badge, secondary actions before the primary one, and previous/next record arrows.
  • Words in en, fr, es and ht (adminFrameText*).
  • CSS: src/admin-next/styles/10-frame.css, tokens only, every selector inside :where([data-slot…]), reduced motion respected, 44 px targets on touch screens.
  • Playground: /admin-next (?scheme=dark|light, ?path=, ?long=1). One route added to playground/serve.ts, which Fable knows about.

The list page (spec items 5–8), made to feel like Shopify's lists:

  • URL state (list/query.ts): view, search, filters, sort and keyset cursor live in the URL, checked against the list's spec (anything else is dropped). Back, Forward and shared links work. Defaults stay out of the URL. Counts are exact up to 1,000, then "about 31,500" (or exact when the app says the count is cheap).
  • Updates in place: a filter, the search (as you type), the sort, a view or a page updates the rows without a reload. The previous rows stay, faded, with a thin loading bar that waits 200 ms, until the new ones arrive (with TanStack Query: placeholderData: keepPreviousData, refreshing={isPlaceholderData}). Skeleton rows show only on the first load. Pages swap with a View Transition where the browser has one (none with reduced motion) and scroll back to the list's top.
  • ResourceIndex: views as link tabs; the filter bar (search, a menu per filter, sort), each active filter a chip removable by keyboard (focus moves to the next chip), "Clear all"; a real <table> with a caption, sort buttons with aria-sort, numbers right-aligned, and the primary cell as the row's header and link. The whole row opens the record (not on its checkbox or links, nor while text is selected).
  • Selection and bulk bar: checkboxes, Shift-click ranges, a mixed header checkbox, and "Select all 2,481 users" after selecting the page. The bulk bar slides in over the header row (which stays for screen readers) and is fixed at the bottom on phones, where a "Select" button turns tapping into selecting. Bulk actions are optimistic, with an Undo toast; "3 selected" and the result count after a change are announced politely.
  • Keyboard (admin-patterns §8): / focuses the list's search (the frame's search keeps ⌘K), j/k move between rows, x or Space selects, Shift+x selects the range, Enter opens.
  • One table that stacks (admin-patterns draft 5): under 600 px of room (a container query, so a narrow card on a desktop stacks too) each row becomes a card: the primary column as the title, then a second line, a badge at the end, and "Column: value" lines. Each column says its part with phone: 'line' | 'badge' | 'value' | 'hide' (no more rowToMobile). Table roles are set explicitly, because some browsers drop them when table parts change display. Filter menus sit in one row that scrolls sideways (a sheet once Fable's overlays land); 44 px targets.
  • Phones (where the table stacks): sort becomes a compact "Sort" button (an up-down arrow and the word) whose accessible name says the current order ("Sort: Joined, newest first"); it opens the same native options, so Status, Role and Sort fit on one line at 390 px. Narrower, the row scrolls sideways with an edge fade.
  • Wide screens: the header row sticks under the top bar. A table too wide for its room becomes a named, focusable region (role="region", tabindex="0", labelled by the caption) that scrolls sideways, with the checkbox and primary columns staying in view. The sort arrow follows aria-sort, so unsorted columns show none.
  • To test by hand (not done): VoiceOver on an iPhone and NVDA on the stacked layout, to confirm rows are still announced as rows.
  • Toast (provisional): useAdminToast(), from a small toaster the frame now holds: bottom centre, 5 s with a timer that waits on hover and focus, and a toast with an action stays until it is used or closed. It moves onto kit/ui's Toast when that lands, with the same call.
  • Empty states: the app's first-time state, or "No users found" with what was searched and Clear filters.
  • Words for all of it in en, fr, es and ht (adminListText*; the frame gained notifications and dismiss). CSS: 20-list.css, 30-toast.css, tokens only, inside :where().
  • Playground: /admin-next?path=/admin/users, 2,481 made-up users behind a pretend server that answers after 250–600 ms; ?empty=1 shows the first-time empty state.

Next on this branch: detail and the save bar (items 9–10).

  • Review fixes (Control Center, 2026-12-06):
    • Links stay on this site: isLocalPath() accepts only a path starting with "/", not "//" or "/\", and with no control characters (browsers drop tabs and newlines, so "/\t/host" would become "//host"). Every link the kit draws goes through localLinks(): nav, brand, back, record pager, list rows, views and pages. Any other href is drawn as a disabled link that keeps its name. Before window.open or click, a row click checks the raw href attribute too.
    • List spec: sorts is a non-empty tuple type. parseListQuery throws on a spec with no sort key, or with a filter option holding a comma, because commas join several values in one URL parameter.
    • Tests: commas, empty sorts, after winning over before (and a bad after falling back to before), and links to other sites in the frame, the page header and list rows.
  • Outside the admin: the auth rate-limit test (src/auth/server.integration.test.ts) now uses a frozen clock for its rate-limit store. CI failed once on it: 11 hashed sign-ins crossed the edge of a 60-second window, and the count restarted. The auth code is unchanged and identical to main.

Checks: bun run test (286 pass: query, selection, list markup, words and link guards added), bun check, bun fmt --check, build, check:package, check:size, bun audit (none). E2E: the whole suite passes on desktop and phone (170 tests), including e2e/admin-list.spec.ts (axe light/dark, fits at 390 px, skeleton then rows, filters without reload with old rows kept and the count announced, search follows typing, / and Escape, chips by keyboard and Back, views, paging and Back, optimistic suspend with an Undo toast that outlives 5 s, sorting and aria-sort, whole-row open and Back, j/k/x/Shift+x/Space, select page then all, the stacked cards with their labels and Select mode, the sticky header, the scroll region with the sticky name column, one sort arrow, 44 px targets, the compact Sort button and one-line filter menus on phones). Screenshots and a recording: e2e/admin-list-screenshots.spec.ts.
Docs/skills: the design-system plan (section 10.3) and admin-patterns draft 3, the UI SDK skill (data-slot conventions), MDN <dialog>/showModal (focus and Esc behaviour), WAI-ARIA APG (disclosure button, aria-current, aria-keyshortcuts), axe-core rules (label-content-name-mismatch); for the list: admin-patterns §3, §7, §8 and §13, WAI-ARIA APG (sortable table, aria-sort, mixed checkbox), MDN View Transitions (document.startViewTransition) with React's flushSync, TanStack Query's placeholderData (for the documented data hook), admin-patterns draft 5 (one stacking table, container query, sticky parts, scroll region), MDN container queries and position: sticky. Icons are Lucide (ISC), inline.
Security review: UI only; nothing reaches a server. Links and labels come from the app's own nav data and render as text and href through React, with no raw HTML. The key handlers ignore text fields, modified keys and open dialogs. List input from the URL is parsed against an allow-list (cursor ^[A-Za-z0-9_-]{1,512}$, search cut to 200 characters), and the search field has the same maxLength. Ctrl/⌘-click on a row opens the app's own row link with noopener. No raw HTML, no new dependencies. No findings.

🤖 Generated with Claude Code

@jgb-solutions jgb-solutions changed the title admin 0.9.0, part 1: the frame (top bar, nav, drawer, page header) admin 0.9.0, parts 1–2: the frame and the list page Dec 6, 2026
jgb-solutions and others added 7 commits December 5, 2026 20:49
Pure logic for the Shopify-style admin frame (admin-patterns draft 3, pattern 1):
nav as data, the deepest match current, its section open, the drawer below
1040 px (to measure). Not exported yet: the frame UI comes on the shared
design system's components.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ts, page header) on kit/ui and the admin theme

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… keyset cursor) and rough counts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s) that updates in place

ResourceIndex on kit/ui and the URL state: views as link tabs, search and filters with removable
chips, a real table (caption, sort buttons with aria-sort, mixed header checkbox, linked primary
cell), the bulk bar over the header row (a fixed bottom bar on phones), keyset pages with a count.
Changes update the rows in place: the previous rows stay with a thin loading bar, pages swap in a
view transition, skeletons only on the first load. Whole rows open the record; j/k, x, Shift+x,
Space and / on the keyboard. Bulk actions run optimistically with an Undo toast (a provisional
admin toaster in the frame, until kit/ui's Toast lands). Words in four languages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ft 5)

The phone's second list (rowToMobile, MobileRow) is gone: each column says its part when the table
stacks (`phone: 'line' | 'badge' | 'value' | 'hide'`, the primary column is the title), and each
cell carries its column name for "Column: value" lines. It stacks on a container query (under
600 px of room), so a narrow card on a desktop stacks too. Table roles are set explicitly, as some
browsers drop them when table parts change display. Wide screens: the header row sticks under the
top bar; a table too wide for its room becomes a named, focusable region that scrolls, with the
checkbox and primary columns sticky. The sort arrow follows aria-sort (none on unsorted columns).
One view transition name. Bulk bar and Clear laid out by our own wrappers, not kit/ui's buttons.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rlays' peers

main's package.json has the UI SDK peers from the overlays PR; bun install adds them to bun.lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jgb-solutions
jgb-solutions force-pushed the feat/admin-frame-logic branch from 5a54df6 to f1b1367 Compare December 6, 2026 01:51
… menus on one line with an edge fade

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jgb-solutions
jgb-solutions marked this pull request as ready for review December 6, 2026 01:54
jgb-solutions and others added 2 commits December 5, 2026 21:21
The per-address limit counts in 60-second windows aligned to the clock. Eleven
sign-ins with password hashing take seconds on a slow runner and can cross a
minute's edge, which restarts the count: the 11th sign-in then passes. A fixed
clock keeps each test's attempts in one window.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
isLocalPath() accepts only a path starting with "/", not "//" or "/\\", and with no control
characters. localLinks() draws every frame, page-header and list link through it; any other
href becomes a disabled link that keeps its name. A row click opens only when the row's
rowHref is a local path and the router's link stays on this origin.
ListSpec.sorts is a non-empty tuple; parseListQuery throws on no sort key or a filter option
with a comma (commas join values in the URL). Tests for both, for after winning over before,
and for links to other sites.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Dec 6, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
kit-showcase aa42431 Commit Preview URL

Branch Preview URL
Dec 06 2026, 07:10 AM

@jgb-solutions
jgb-solutions merged commit a062e3c into main Dec 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant