From ded6555dbca66d032c12fd1a9c499ec786d07bed Mon Sep 17 00:00:00 2001
From: afei A <57030625+NewHubBoy@users.noreply.github.com>
Date: Sat, 28 Mar 2026 00:07:26 +0800
Subject: [PATCH] docs: add shadcn ui rewrite implementation plan
---
...ual-tryon-admin-frontend-shadcn-rewrite.md | 459 ++++++++++++++++++
1 file changed, 459 insertions(+)
create mode 100644 docs/superpowers/plans/2026-03-28-auto-virtual-tryon-admin-frontend-shadcn-rewrite.md
diff --git a/docs/superpowers/plans/2026-03-28-auto-virtual-tryon-admin-frontend-shadcn-rewrite.md b/docs/superpowers/plans/2026-03-28-auto-virtual-tryon-admin-frontend-shadcn-rewrite.md
new file mode 100644
index 0000000..1fed7c2
--- /dev/null
+++ b/docs/superpowers/plans/2026-03-28-auto-virtual-tryon-admin-frontend-shadcn-rewrite.md
@@ -0,0 +1,459 @@
+# Auto Virtual Tryon Admin Frontend Shadcn Rewrite Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** Rebuild the frontend admin UI around a denser shadcn-style console shell, a clearer review workflow, and real high-density list pages for orders and workflows.
+
+**Architecture:** Keep the existing App Router routes, BFF handlers, adapters, and backend contracts intact while replacing the card-heavy presentation layer with shared shell, toolbar, and table primitives. Migrate in layers: first the dashboard shell and reusable UI primitives, then the review flow, then the orders and workflows list pages, so each step lands on top of a stable layout system instead of reworking page code twice.
+
+**Tech Stack:** Next.js App Router, React, TypeScript, Tailwind CSS v4, Vitest, React Testing Library, jsdom, Lucide React
+
+---
+
+### Task 1: Rebuild The Shared Dashboard Shell
+
+**Files:**
+- Modify: `src/components/layout/dashboard-shell.tsx`
+- Modify: `src/components/layout/nav-config.ts`
+- Modify: `src/components/ui/page-header.tsx`
+- Modify: `app/globals.css`
+- Test: `tests/ui/dashboard-shell.test.tsx`
+
+- [ ] **Step 1: Write the failing shell-density tests**
+
+```tsx
+test("uses a narrow rail and full-width desktop shell", () => {
+ render(content);
+
+ expect(screen.getByLabelText("Dashboard rail").className).toContain(
+ "md:w-[228px]",
+ );
+ expect(screen.getByLabelText("Dashboard content").className).toContain(
+ "md:overflow-y-auto",
+ );
+});
+```
+
+- [ ] **Step 2: Run the shell test to confirm it fails**
+
+Run: `npm run test -- tests/ui/dashboard-shell.test.tsx`
+Expected: FAIL because the existing shell still uses the wide `280px` rail, large radii, and old container classes
+
+- [ ] **Step 3: Rewrite the shell layout to use a thinner rail and full-width main area**
+
+```tsx
+
+
+
+
+
+
+```
+
+- [ ] **Step 4: Tighten the shared header spacing and typography**
+
+```tsx
+
+
+
+ {eyebrow}
+
+
{title}
+
+
+```
+
+- [ ] **Step 5: Update shell variables and density tokens in global CSS**
+
+```css
+:root {
+ --page-gap: 16px;
+ --panel-radius: 14px;
+ --control-height: 38px;
+}
+```
+
+- [ ] **Step 6: Re-run the shell test**
+
+Run: `npm run test -- tests/ui/dashboard-shell.test.tsx`
+Expected: PASS
+
+- [ ] **Step 7: Commit the shell rewrite**
+
+```bash
+git add src/components/layout/dashboard-shell.tsx src/components/layout/nav-config.ts src/components/ui/page-header.tsx app/globals.css tests/ui/dashboard-shell.test.tsx
+git commit -m "feat: tighten dashboard shell density"
+```
+
+### Task 2: Add Shared Dense Console Primitives
+
+**Files:**
+- Create: `src/components/ui/input.tsx`
+- Create: `src/components/ui/select.tsx`
+- Create: `src/components/ui/table.tsx`
+- Create: `src/components/ui/separator.tsx`
+- Create: `src/components/ui/page-toolbar.tsx`
+- Create: `src/components/ui/metric-chip.tsx`
+- Modify: `src/components/ui/button.tsx`
+- Modify: `src/components/ui/card.tsx`
+- Modify: `src/components/ui/status-badge.tsx`
+- Test: `tests/ui/status-badge.test.tsx`
+- Create: `tests/ui/page-toolbar.test.tsx`
+
+- [ ] **Step 1: Write failing tests for compact toolbar and compact badge behavior**
+
+```tsx
+test("renders a dense toolbar row with compact controls", () => {
+ render(
+
+
+
+ ,
+ );
+
+ expect(screen.getByLabelText("search").className).toContain("h-9");
+});
+```
+
+- [ ] **Step 2: Run the toolbar and badge tests to confirm they fail**
+
+Run: `npm run test -- tests/ui/page-toolbar.test.tsx tests/ui/status-badge.test.tsx`
+Expected: FAIL because the new primitives do not exist yet and current badge sizing is larger than the dense target
+
+- [ ] **Step 3: Implement the shared compact primitives**
+
+```tsx
+export function PageToolbar({ children }: PropsWithChildren) {
+ return (
+
+ {children}
+
+ );
+}
+```
+
+- [ ] **Step 4: Normalize button, card, and status badge sizes to the new density**
+
+```tsx
+const buttonVariants = {
+ default: "h-9 rounded-md px-3 text-sm",
+ secondary: "h-9 rounded-md px-3 text-sm",
+};
+```
+
+- [ ] **Step 5: Re-run the toolbar and badge tests**
+
+Run: `npm run test -- tests/ui/page-toolbar.test.tsx tests/ui/status-badge.test.tsx`
+Expected: PASS
+
+- [ ] **Step 6: Commit the shared primitives**
+
+```bash
+git add src/components/ui tests/ui
+git commit -m "feat: add dense console ui primitives"
+```
+
+### Task 3: Rewrite The Review Queue Page As A High-Density Table
+
+**Files:**
+- Modify: `src/features/reviews/review-workbench-list.tsx`
+- Modify: `src/features/reviews/components/review-queue.tsx`
+- Create: `src/features/reviews/components/review-filters.tsx`
+- Modify: `app/(dashboard)/reviews/workbench/page.tsx`
+- Test: `tests/features/reviews/review-workbench-list.test.tsx`
+
+- [ ] **Step 1: Replace the current list-page expectations with queue-table expectations**
+
+```tsx
+test("renders a compact review queue table with triage columns", async () => {
+ render();
+
+ expect(await screen.findByRole("columnheader", { name: "订单号" })).toBeInTheDocument();
+ expect(screen.getByRole("columnheader", { name: "修订状态" })).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "刷新队列" })).toBeInTheDocument();
+});
+```
+
+- [ ] **Step 2: Run the review queue test to confirm it fails**
+
+Run: `npm run test -- tests/features/reviews/review-workbench-list.test.tsx`
+Expected: FAIL because the current page still renders the old prose-heavy layout instead of the table and compact toolbar
+
+- [ ] **Step 3: Add a compact filter row for query, status, revision state, and refresh**
+
+```tsx
+
+
+
+
+
+
+```
+
+- [ ] **Step 4: Rebuild the queue body as a compact table**
+
+```tsx
+