refactor(frontend): 删顶部「AI 工具条」,--chrome 归位 4rem(写作台 UX P0-3)

顶栏「AI 工具条」5 项全是重复左栏的导航链接,且让「写本章」同时是导航
Link 与生成动作两种相反含义。删掉后导航只归左栏,同时消灭最严重的三重复
+ 假「AI」标签 + 「写本章」双重含义,并省下 48px(--chrome 7rem→4rem)。
死代码 AiToolbar/AiToolbarMoreMenu/ai-tools 全仓仅 AppShell 引用,一并移除。
This commit is contained in:
Yaojia Wang
2026-07-10 17:43:46 +02:00
parent 5317d601dd
commit 61a6931bb1
5 changed files with 1 additions and 272 deletions

View File

@@ -1,44 +0,0 @@
import { describe, expect, it } from "vitest";
import {
aiToolItems,
primaryAiToolItems,
secondaryAiToolItems,
} from "./ai-tools";
describe("aiToolItems", () => {
it("returns 5 items", () => {
expect(aiToolItems("p1")).toHaveLength(5);
});
it("leads with 写本章 (primary, key write)", () => {
const [first] = aiToolItems("p1");
expect(first?.label).toBe("写本章");
expect(first?.primary).toBe(true);
expect(first?.key).toBe("write");
});
it("scopes every href under the project path", () => {
for (const item of aiToolItems("abc")) {
expect(item.href.startsWith("/projects/abc/")).toBe(true);
}
});
it("maps 审稿 to the review page and key", () => {
const review = aiToolItems("p1").find((item) => item.label === "审稿");
expect(review?.href).toBe("/projects/p1/review");
expect(review?.key).toBe("review");
});
it("keeps high-frequency tools outside the mobile more menu", () => {
expect(primaryAiToolItems("p1").map((item) => item.key)).toEqual([
"write",
"review",
]);
expect(secondaryAiToolItems("p1").map((item) => item.key)).toEqual([
"outline",
"codex",
"toolbox",
]);
});
});

View File

@@ -1,35 +0,0 @@
// T4-a · 顶部 AI 工具条数据纯逻辑UX §3/§5
// 把高频 AI 动作(写本章/审稿/大纲/设定库/工具箱)做成常驻一排,根治「命令面板太隐蔽」。
// 只露已实现能力;新生成器(创作工具箱 B 组)落地后并入工具箱入口。
// 组件只渲染;条目与激活键集中在此,复用 ActiveNav 高亮规则。
import type { ActiveNav } from "./items";
export interface AiToolItem {
href: string;
label: string;
// 高亮键(与 AppShell activeNav 比对)。
key: ActiveNav;
// 主动作(写本章)朱砂强调,其余次级。
primary?: boolean;
}
// 项目内页 AI 工具条条目(按已实现能力露出)。
export function aiToolItems(projectId: string): AiToolItem[] {
const base = `/projects/${projectId}`;
return [
{ href: `${base}/write`, label: "写本章", key: "write", primary: true },
{ href: `${base}/review`, label: "审稿", key: "review" },
{ href: `${base}/outline`, label: "大纲", key: "outline" },
{ href: `${base}/codex`, label: "设定库", key: "codex" },
{ href: `${base}/toolbox`, label: "工具箱", key: "toolbox" },
];
}
export function primaryAiToolItems(projectId: string): AiToolItem[] {
return aiToolItems(projectId).slice(0, 2);
}
export function secondaryAiToolItems(projectId: string): AiToolItem[] {
return aiToolItems(projectId).slice(2);
}