Repository navigation
Admin screens on the design kit (#96 part C) - #101
Conversation
Moves every page under /admin onto the #95 kit with no behaviour change: the same data calls, server actions, form fields, confirms and role checks. - admin/layout.tsx: role-aware tabs for the admin pages (moderator, finance, admin), replacing the per-page link rows and back links; a non-staff visitor sees no tabs. The current tab scrolls into view on phones. - admin/_components/ui.tsx: page frame, section with count, item card, label/value grid and a focusable table that scrolls sideways on phones. - loading.tsx and error.tsx for the admin section; EmptyState for empty queues; Notice for blocked actions, own-item warnings and load errors. - New kit file components/ui/Notice.tsx (existing kit files unchanged). - Audit trails, resolved statement rows and role changes are tables; organizers to verify and staff stay wrapping lists so their actions stay on screen at 375 px. Refs #96 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
PO acceptance (part C of #96): merge at ef6299f. CI green, DOS Code Review passed, vitest 920, Lighthouse a11y 100 on all 9 admin pages desktop + mobile, independent review found no behaviour change. No file overlap with part A (merged). Follow-ups: fold components/ui/Notice into part A's Callout if they duplicate; wrap isStaff/getSession in React cache(). |
Refs #96
Part C of #96: every page under
/adminon the #95 design kit. Parts A (public flows) and B (/me) are separate PRs under the same issue.What changed
required/maxLength, confirm texts and role checks on every page (checked line by line againstorigin/devby an independent reviewer). The one call removed is the/adminpage'sisStaff(["admin"])lookup that only decided whether to show a link to/admin/roles; the new tabs do that now.admin/layout.tsx,_components/AdminNav.tsx): one row of tabs, built from the visitor's roles: moderators get review, evidence and payment requests; finance gets accounts, account swaps, statements, unmatched and stopped inbound events; admins get all of them plus roles. A signed-out or non-staff visitor sees no tabs (pages still 404 on their own). They replace the per-page button rows and "← back" links. On phones the row scrolls sideways and the current tab is scrolled into view.admin/_components/ui.tsx): page frame (title, action, rules text at a readable width), section heading with a count, item card with the actions under a hairline, label/value grid, and a table in a named, focusable scroll box.EmptyStatefor every empty queue,Noticefor blocked actions, "this is your own item" warnings, a stopped payment request, a hidden image and the waiting list that failed to load;admin/loading.tsx(skeleton under the tabs) andadmin/error.tsx(retry, tabs stay).components/ui/Notice.tsx(info / warning / danger / success, optional title, one text colour per tone). Existing kit files are unchanged. The oldrounded-fullpill and thebtn-secondary text-red-700double colour are gone (Badge,btn-danger).Not in this PR:
/admin/unmatchedstill renders the sharedcomponents/UnmatchedTransaction.tsxandcomponents/Reconciliation.tsx, which/me/campaigns/[id]/unmatchedalso uses; part B owns them (noted on #96).Evidence
tsc --noEmit,eslint,prettier --check: clean.vitest run: 72 files, 920 tests passed.Screenshots
Seeded local stack (DOS.Me
devmigrations, the #95 seed plus admin data: campaigns in review, a campaign waiting for an account, organizers and accounts to verify, an account swap, ambiguous statement rows, stopped inbound events, audit entries, reported and hidden evidence, succeeded back campaigns with one stopped). Desktop 1440 px full page; phone 375 px, top of the page. Images live on theassets/pr-96c-screenshotsbranch./admin
/admin/evidence
/admin/payment-requests
/admin/accounts
/admin/account-swaps
/admin/statements
/admin/unmatched
/admin/inbound
/admin/roles
🤖 Generated with Claude Code
📌 TL;DR
This PR refactors the admin dashboard to use a new, consistent set of UI primitives (
AdminPage,ItemCard,Facts, etc.) and introduces a role-based navigation layout with loading/error states. It significantly improves the visual consistency, accessibility, and mobile responsiveness of the finance and moderation queues.🎯 Type of Change
🔍 Changes Walkthrough
apps/web/src/app/admin/_components/AdminNav.tsxapps/web/src/app/admin/_components/ui.tsxAdminPage,AdminSection,ItemCard,Facts,DataTable). Standardizes layout, spacing, and accessibility (ARIA labels).apps/web/src/app/admin/layout.tsxAdminNavtabs.apps/web/src/app/admin/loading.tsxapps/web/src/app/admin/error.tsxapps/web/src/app/admin/page.tsxAdminPage/AdminSection. Updated campaign review cards to useItemCardandFacts.apps/web/src/app/admin/accounts/page.tsxFieldcomponents and addedEmptyStatefor empty queues.apps/web/src/app/admin/account-swaps/page.tsxItemActionsandField.apps/web/src/app/admin/evidence/page.tsxapps/web/src/app/admin/inbound/page.tsxDataTablefor better mobile scrolling.📊 Architectural Flow
flowchart TD subgraph AdminLayout["Admin Layout (layout.tsx)"] Session[getSession] --> Roles{Check Roles} Roles -->|Moderation| ModLinks[Mod Links] Roles -->|Finance| FinLinks[Fin Links] Roles -->|Admin| AdminLinks[Admin Links] ModLinks & FinLinks & AdminLinks --> Nav[AdminNav] end subgraph AdminPages["Admin Pages"] Page[Page Component] --> UI[UI Primitives] UI --> AdminPage[AdminPage] UI --> AdminSection[AdminSection] UI --> ItemCard[ItemCard] UI --> Facts[Facts] UI --> DataTable[DataTable] end Nav --> AdminPages Loading[loading.tsx] -.-> AdminPages Error[error.tsx] -.-> AdminPages