--sidebar-background: #09233f (dark navy) instead of plan's #ffffff — preserves existing visual; white would have unreadable light-on-light text
SidebarProvider open={!sidebarCollapsed} with inverted onOpenChange — fixes the literal bug in my prompt (was open={sidebarCollapsed} which would render collapsed on first mount)
Added @theme inline { --color-sidebar-* } mapping in app.css — required for shadcn's bg-sidebar/etc. utilities to resolve CSS vars in Tailwind v4
Compatibility note:
<SidebarTrigger> overrides its children with shadcn's built-in PanelLeftIcon + sr-only label; the <span>收起菜单</span> text I included won't show. Trigger still works for collapse/expand. Acceptable shadcn standard behavior; original common/Sidebar.tsx showed the text when expanded — minor visible regression, not a functional one.
Manual smoke test still required in browser (per plan §Verification):
1-11 covering workbench/scripts/system navigation, edit-session guard, workspace switch key-remount, isSystemAdmin gating, mobile hide, etc.
**tao.chen** commented:
> Implementation complete + validated.
**Validation:**
- `pnpm typecheck` — passed (EXIT=0)
- `pnpm build` — passed (EXIT=0; client + ssr bundles built; SystemAdminIndexRoute/UserManagementRoute/ProjectManagementRoute chunks emitted)
- Git diff scope: 9 files exactly, no scope leak (vite.config.ts M is pre-existing dev proxy target, unrelated)
**Build outputs of interest:**
- `platform-*.js` 128.69 kB (main layout with shadcn Sidebar)
- `SystemAdminIndexRoute-*.js` 0.15 kB (Navigate redirect)
- `UserManagementRoute-*.js` 9.12 kB / `ProjectManagementRoute-*.js` 17.68 kB
- `Icon-*.js` retained (brand mark)
**Codex-resolved ambiguities (all good calls):**
- `--sidebar-background: #09233f` (dark navy) instead of plan's `#ffffff` — preserves existing visual; white would have unreadable light-on-light text
- `SidebarProvider open={!sidebarCollapsed}` with inverted `onOpenChange` — fixes the literal bug in my prompt (was `open={sidebarCollapsed}` which would render collapsed on first mount)
- `data-active="true" : undefined` (Tailwind attribute presence, not boolean) — matches repo convention
- Added `@theme inline { --color-sidebar-* }` mapping in app.css — required for shadcn's `bg-sidebar`/etc. utilities to resolve CSS vars in Tailwind v4
**Compatibility note:**
- `<SidebarTrigger>` overrides its children with shadcn's built-in `PanelLeftIcon` + sr-only label; the `<span>收起菜单</span>` text I included won't show. Trigger still works for collapse/expand. Acceptable shadcn standard behavior; original `common/Sidebar.tsx` showed the text when expanded — minor visible regression, not a functional one.
**Manual smoke test** still required in browser (per plan §Verification):
1-11 covering workbench/scripts/system navigation, edit-session guard, workspace switch key-remount, isSystemAdmin gating, mobile hide, etc.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
把
components/common/Sidebar.tsx(117 行)替换为components/ui/sidebar.tsx(shadcn 727 行),并将/system单路由拆为嵌套路由(/system/users、/system/projects),让"系统管理"在 sidebar 内变为带SidebarMenuSub的父节点。Plan: /Users/taochen/.claude/plans/crispy-nibbling-perlis.md
改动文件:
frontend/app/routes.ts(system 改 nested)frontend/app/features/admin/SystemAdminRoute.tsx(缩成<Outlet/>壳)frontend/app/features/admin/SystemAdminPage.tsx(删除)frontend/app/features/admin/SystemAdminIndexRoute.tsx(新增,<Navigate>)frontend/app/features/admin/UserManagementRoute.tsx(新增 + key-remount)frontend/app/features/admin/ProjectManagementRoute.tsx(新增 + key-remount)frontend/app/components/common/Sidebar.tsx(删除)frontend/app/routes/platform.tsx(shadcn Sidebar + SidebarProvider + guardedNavigate 闭包 + 修pageFromPath隐藏 bug)frontend/app/styles/*.css(新增--sidebar-*CSS 变量,沿用现蓝色板)关键约束:
platform.tsx的guardedNavigate闭包<aside>外层md:block hidden兜底lucide-react(Home/Code/Calendar/Settings/Users/Folder/PanelLeft),brand 仍走<Icon name="brand" />验收:
pnpm typecheck过pnpm build过Task: n99qu3rpnd5aszvcifewefpv
MODEL-DEVELOP-PLATFORM-62
tao.chen commented:
Plan:
/Users/taochen/.claude/plans/crispy-nibbling-perlis.mdScope (modify only these):
frontend/app/routes.ts— system nestedfrontend/app/features/admin/SystemAdminRoute.tsx— Outlet shellfrontend/app/features/admin/SystemAdminPage.tsx— DELETEfrontend/app/features/admin/SystemAdminIndexRoute.tsx— NEWfrontend/app/features/admin/UserManagementRoute.tsx— NEW (key-remount)frontend/app/features/admin/ProjectManagementRoute.tsx— NEW (key-remount)frontend/app/components/common/Sidebar.tsx— DELETEfrontend/app/routes/platform.tsx— shadcn + guardedNavigate + pageFromPath fixAwaiting Codex completion.
tao.chen commented:
Validation:
pnpm typecheck— passed (EXIT=0)pnpm build— passed (EXIT=0; client + ssr bundles built; SystemAdminIndexRoute/UserManagementRoute/ProjectManagementRoute chunks emitted)Build outputs of interest:
platform-*.js128.69 kB (main layout with shadcn Sidebar)SystemAdminIndexRoute-*.js0.15 kB (Navigate redirect)UserManagementRoute-*.js9.12 kB /ProjectManagementRoute-*.js17.68 kBIcon-*.jsretained (brand mark)Codex-resolved ambiguities (all good calls):
--sidebar-background: #09233f(dark navy) instead of plan's#ffffff— preserves existing visual; white would have unreadable light-on-light textSidebarProvider open={!sidebarCollapsed}with invertedonOpenChange— fixes the literal bug in my prompt (wasopen={sidebarCollapsed}which would render collapsed on first mount)data-active="true" : undefined(Tailwind attribute presence, not boolean) — matches repo convention@theme inline { --color-sidebar-* }mapping in app.css — required for shadcn'sbg-sidebar/etc. utilities to resolve CSS vars in Tailwind v4Compatibility note:
<SidebarTrigger>overrides its children with shadcn's built-inPanelLeftIcon+ sr-only label; the<span>收起菜单</span>text I included won't show. Trigger still works for collapse/expand. Acceptable shadcn standard behavior; originalcommon/Sidebar.tsxshowed the text when expanded — minor visible regression, not a functional one.Manual smoke test still required in browser (per plan §Verification):
1-11 covering workbench/scripts/system navigation, edit-session guard, workspace switch key-remount, isSystemAdmin gating, mobile hide, etc.
tao.chen commented:
Root cause: shadcn Sidebar 桌面分支的内部 sidebar-container 用
position: fixed; inset-y-0(绝对定位,出流),真正占布局空间的是同级的data-slot="sidebar-gap"div(w-(--sidebar-width))。原本的<div className="flex min-h-screen bg-[#eef2f6]">+<aside className="hidden md:block">双层包装与 SidebarProvider 内置的flex min-h-svh w-full叠加,把 gap div 隔离在 aside 内,SidebarInset 拿不到 gap 推动,布局错位。Fix: 删掉外层 flex div 和 aside wrapper,
<Sidebar>和<SidebarInset>直接做SidebarProvider子节点;bg-[#eef2f6]移到 SidebarProvider 的 className 上。<Toast>作为 SidebarProvider 末位 sibling 保留。验证:
pnpm typecheck— EXIT=0pnpm build— EXIT=0tao.chen commented:
方案: 用 base-ui 的
Collapsible(从@base-ui/react/collapsible,base-ui 1.7.0 已装)包住父SidebarMenuItem。Collapsible.Root defaultOpen={activePage === "system"}— 首屏按 URL 决定展开/折叠Collapsible.Trigger render={<SidebarMenuButton ... />}— base-ui 的renderprop 等价 radixasChild,把触发器行为合并到菜单按钮Collapsible.Panel包住SidebarMenuSubgroup-data-[open]/collapsible:rotate-90(Collapsible.Root设group/collapsible,展开时data-open自动 rotate)UX:
/system/users或/system/projects→ 子菜单默认展开/system/*→ 子菜单保持上次状态(uncontrolled),不在 URL 变化时强改activePage === "system")依赖:
@base-ui/react@^1.7.0已存在,无需新增包。验证:
pnpm typecheck— EXIT=0pnpm build— EXIT=0tao.chen commented:
方案: 用 base-ui 的
Collapsible(从@base-ui/react/collapsible,base-ui 1.7.0 已装)包住父SidebarMenuItem。Collapsible.Root defaultOpen={activePage === "system"}— 首屏按 URL 决定展开/折叠Collapsible.Trigger render={<SidebarMenuButton ... />}— base-ui 的renderprop 等价 radixasChild,把触发器行为合并到菜单按钮Collapsible.Panel包住SidebarMenuSubgroup-data-[open]/collapsible:rotate-90(Collapsible.Root设group/collapsible,展开时data-open自动 rotate)UX:
/system/users或/system/projects→ 子菜单默认展开/system/*→ 子菜单保持上次状态(uncontrolled),不在 URL 变化时强改activePage === "system")依赖:
@base-ui/react@^1.7.0已存在,无需新增包。验证:
pnpm typecheck— EXIT=0pnpm build— EXIT=0tao.chen commented:
方案: 用 base-ui 的
Collapsible(从@base-ui/react/collapsible,base-ui 1.7.0 已装)包住父SidebarMenuItem。Collapsible.Root defaultOpen={activePage === "system"}— 首屏按 URL 决定展开/折叠Collapsible.Trigger render={<SidebarMenuButton ... />}— base-ui 的renderprop 等价 radixasChild,把触发器行为合并到菜单按钮Collapsible.Panel包住SidebarMenuSubgroup-data-[open]/collapsible:rotate-90(Collapsible.Root设group/collapsible,展开时data-open自动 rotate)UX:
/system/users或/system/projects→ 子菜单默认展开/system/*→ 子菜单保持上次状态(uncontrolled),不在 URL 变化时强改activePage === "system")依赖:
@base-ui/react@^1.7.0已存在,无需新增包。验证:
pnpm typecheck— EXIT=0pnpm build— EXIT=0tao.chen commented:
改动:
frontend/app/components/ui/sidebar.tsxshadcn 默认值SidebarMenu:gap-0.5→gap-1.5(顶层项之间从 2px 拉到 6px)sidebarMenuButtonVariantsbase:py-2→py-3(按钮垂直内边距从 8px 增到 12px,实际高度从 ~40px 升到 ~48px,贴近原h-12)验证:
pnpm typecheck— EXIT=0pnpm build— EXIT=0子按钮高度未调整(用户未要求)。如果也要跟着调,告诉我。
tao.chen commented:
迁移交付后,在 sidebar 间距调优阶段(顶层
SidebarMenugap 0.5 → 1.5,sidebarMenuButtonVariantsbasepy-2→py-3)触及了frontend/app/components/ui/sidebar.tsx。用户指示回滚这两处改动 + 立规:今后禁止修改
components/ui/*下任何组件样式。已回滚
components/ui/sidebar.tsxSidebarMenu类名:gap-1.5→gap-0.5components/ui/sidebar.tsxsidebarMenuButtonVariantsbase:py-3→py-2验证
pnpm typecheck干净通过pnpm build干净通过(client + ssr bundle 全部生成)新约束(已存 memory:
never-modify-ui-components.md)components/ui/*是 shadcn base-ui 风格的原子原语,被多处复用。改一处污染所有消费方,且会让后续 shadcn 升级/diff-copy 产生合并冲突。未来任何视觉调整(间距、字号、颜色、动效)必须通过
className在调用方覆盖,例如:或在调用方引入本地 css(如
routes/platform.css)集中@apply。调整前先问用户"是单点覆盖还是全局默认?"。