refactor(web): 随路径式入口清理失效的管理链接(设计:用户端不提供管理入口)
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

- TopBar / Nav 的 hash 形式管理入口(#/admin、#/admin/system)**删除**(design/07 §0.2:用户端不提供任何
  管理入口、bundle 不含该路径串);面板只经 ADMIN_PATH 路径直入
- AdminApp 三处 window.location.hash = "" 改调 router 导出的 navigateUserShell()
- 复核:tsc 0 错 + vite build 成功;用户端源码 grep "#/admin" 0 命中(仅在 channels/useAdapterNav.ts
  尚有模块内闭环的 hash 字面量,属另一决策,仅报告未改)
- 局限:无 playwright/puppeteer 且不许加依赖 ⇒ 「布局未塌」为结构+静态样式依赖推断(无子元素数量相关样式)
This commit is contained in:
AskaEth committed 2026-10-04 14:01:43 +08:00
1 parent a398dc9b92
commit 852c327360
3 files changed
+5 -29

No files matched your search

+4 -4
View File
@@ -5,7 +5,7 @@ import { useAppStore } from "../store/useAppStore";
import type { WsStatus } from "../lib/types";
import { UiModeSwitch } from "../design/UiModeSwitch";
import { ADMIN_GROUPS, ADMIN_SECTIONS } from "./sections";
import { navigateAdmin, type AdminSectionId } from "./router";
import { navigateAdmin, navigateUserShell, type AdminSectionId } from "./router";
import { Button, Tag, type TagTone } from "../components/primitives";
import { Icon } from "../components/Icon";
import { DashboardModule } from "./modules/Dashboard";
@@ -239,7 +239,7 @@ function AdminTopBar({ section, onMenu }: { section: AdminSectionId; onMenu?: ()
>
<Icon name={theme === "dark" ? "sun" : "moon"} size={18} />
</button>
<Button size="sm" variant="ghost" className="shrink-0" onClick={() => { window.location.hash = ""; }}>
<Button size="sm" variant="ghost" className="shrink-0" onClick={() => { navigateUserShell(); }}>
返回用户端
</Button>
</header>
@@ -256,7 +256,7 @@ function LoginGate(): React.ReactNode {
<p className="max-w-md text-sm text-[var(--mu-text-lo)]">
管理面板需持有 JWT。请先在用户端 <span className="text-[var(--mu-text-hi)]">登录页</span> 完成登录后,再返回本页。
</p>
<Button variant="primary" onClick={() => { window.location.hash = ""; }}>前往用户端登录</Button>
<Button variant="primary" onClick={() => { navigateUserShell(); }}>前往用户端登录</Button>
</div>
);
}
@@ -273,7 +273,7 @@ function Forbidden403(): React.ReactNode {
当前角色 <Tag tone="neutral">{role ?? "?"}</Tag>(viewer 只读)。管理面板需 <Tag tone="accent">owner</Tag> 或 <Tag tone="ok">admin</Tag> 角色;管理端写操作仅 owner。
</p>
<div className="flex gap-2">
<Button variant="primary" onClick={() => { window.location.hash = ""; }}>返回用户端</Button>
<Button variant="primary" onClick={() => { navigateUserShell(); }}>返回用户端</Button>
</div>
</div>
);