diff --git a/frontend/src/app/App.tsx b/frontend/src/app/App.tsx index 45d2af3..b50f782 100644 --- a/frontend/src/app/App.tsx +++ b/frontend/src/app/App.tsx @@ -22,7 +22,6 @@ import { Alert, Button, Flex, Layout, Spin } from 'antd' import { authState, refreshState, useAuthStore, useIsAuthenticated } from '../stores/auth' import { loadSystem, useSystemStore } from '../stores/system' import { toggleTheme } from '../stores/theme' -import { useProjectStore } from '../stores/project' import { useLocalStorage } from '../hooks/use-local-storage' import MediaLightbox from '../components/media/MediaLightbox' import AppHeader from './layout/AppHeader' @@ -71,7 +70,6 @@ export default function App() { const auth = useAuthStore() const isAuthenticated = useIsAuthenticated() const systemError = useSystemStore((s) => s.error) - const project = useProjectStore((s) => s.project) const pollRef = useRef(undefined) const [ready, setReady] = useState(() => authState().checked) /* 侧栏折叠:记忆到人,换页不换档;窄屏由 Sider 的 breakpoint 自己收 */ @@ -117,10 +115,6 @@ export default function App() { return () => window.removeEventListener('keydown', onKey) }, []) - /* 认「加载成功的那份项目数据自己的 id」,项目 404 时不残留上一个项目的名字 */ - const proj = projectId && project?.id === Number(projectId) ? project : null - const projectTitle = proj?.name || (projectId ? '项目 #' + projectId : '') - if (chromeless) { /* 已经登录就不再停在登录页 */ if (location.pathname === '/login' && auth.checked && auth.user && !auth.offline) return @@ -142,8 +136,7 @@ export default function App() { - + {systemError && !auth.offline && isAuthenticated && ( diff --git a/frontend/src/app/layout/AppSider.tsx b/frontend/src/app/layout/AppSider.tsx index d427233..0d67f3e 100644 --- a/frontend/src/app/layout/AppSider.tsx +++ b/frontend/src/app/layout/AppSider.tsx @@ -11,34 +11,35 @@ * Menu 自带(role=menu + roving tabindex),不必再自证。 * * 结构(**只到两级**,这是产品定的口径,别再往深里加): - * 一级 = 全局三项 + 「当前项目」;二级 = 「当前项目」下的七个环节。 + * 一级 = 全局三项 + 「项目环节」;二级 = 七个环节。 * 不用 `type:'group'` 分组标题:group 虽然自己不可展开,但会在菜单里多占一层 - * 视觉层级(标题行 → 项 → 子项 = 看着像三级)。项目名不在菜单里占层级, - * 挪到侧栏底部的状态块显示。 + * 视觉层级(标题行 → 项 → 子项 = 看着像三级)。 + * + * 侧栏**不出现任何当前项目信息**(项目名 / 当前节点 / 进度都不写): + * 这三样顶栏的流程控制台已经全程显示,侧栏再写一遍就是同一份状态两个出处, + * 两边还会因为刷新时机不同出现「侧栏还在讲上一个节点」的错位。 + * 一级分组因此叫「项目环节」这种中性词,`title` 也不再拼项目名。 * * 侧栏 theme="light":深色观感由 darkAlgorithm 的 token 负责,走 antd Menu 的 * dark 分支会把它自己的 navy 默认值混进来(itemColor / subMenuItemBg 各一套)。 */ import { useEffect, useMemo, useState } from 'react' import { useLocation, useNavigate } from 'react-router-dom' -import { Divider, Layout, Menu, Typography } from 'antd' +import { Layout, Menu } from 'antd' import type { MenuProps } from 'antd' import { IconFolder } from '../../components/icons' import { HEADER_HEIGHT } from '../../theme/antd' -import { useCurrentStageNote } from './PipelineConsole' import { globalNav, pathOf, projectModules } from './nav' const PROJECT_KEY = 'project' -export function AppSider({ projectId, projectTitle, collapsed, onCollapse }: { +export function AppSider({ projectId, collapsed, onCollapse }: { projectId: string - projectTitle: string collapsed: boolean onCollapse: (next: boolean) => void }) { const { pathname } = useLocation() const navigate = useNavigate() - const stageNote = useCurrentStageNote(projectId) /* 展开态:进入某个项目就展开它的七个环节,用户手工折叠后本页不再强行展开 */ const [openKeys, setOpenKeys] = useState(projectId ? [PROJECT_KEY] : []) useEffect(() => { if (projectId) setOpenKeys((keys) => (keys.includes(PROJECT_KEY) ? keys : [...keys, PROJECT_KEY])) }, [projectId]) @@ -54,8 +55,8 @@ export function AppSider({ projectId, projectTitle, collapsed, onCollapse }: { /* 只能给字符串:antd 的 SubMenu 见到裸 会用它顶掉 .ant-menu-submenu-title-content 那层壳,而省略号正长在那层壳上 (node_modules/antd/es/menu/SubMenu.js 的 titleIsSpan 分支)。 */ - label: '当前项目', - title: projectTitle ? `当前项目:${projectTitle}` : '当前项目', + label: '项目环节', + title: '项目环节', children: projectModules.map((m) => ({ key: pathOf(m, projectId), icon: m.icon, @@ -68,7 +69,7 @@ export function AppSider({ projectId, projectTitle, collapsed, onCollapse }: { }) } return list - }, [projectId, projectTitle]) + }, [projectId]) return ( navigate(key)} style={{ borderInlineEnd: 0, paddingBlock: 8 }} /> - {/* 项目名从菜单里挪到这里:菜单只留两级,名字仍然全程可见 */} - {!collapsed && projectId && ( - <> - -
- 当前项目 - - {projectTitle || `项目 #${projectId}`} - - {stageNote && ( - - 当前节点 · {stageNote} - - )} -
- - )}
) } diff --git a/frontend/src/app/layout/PipelineConsole.tsx b/frontend/src/app/layout/PipelineConsole.tsx index 1b5781c..6126881 100644 --- a/frontend/src/app/layout/PipelineConsole.tsx +++ b/frontend/src/app/layout/PipelineConsole.tsx @@ -25,10 +25,11 @@ * 工具区比品牌区宽约 140px,整块会偏左 70px。 */ import { NavLink } from 'react-router-dom' -import { Tag, Typography } from 'antd' +import { Typography } from 'antd' +import { Tag, type TagTone } from '../../components/ui' import { cn } from '../../lib/cn' import { statusLabel } from '../../lib/format' -import { openNode, stageNote } from '../../lib/pipeline' +import { openNode } from '../../lib/pipeline' import { useProjectStore } from '../../stores/project' /** 12 节点流程的分组,和后端 PIPELINE_STAGES 对齐;驳回时多出来的 revise 归入审核组 */ @@ -49,11 +50,18 @@ const PIPE_GHOST = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map((i) => ({ key: 'ghost' + i, label: '', state: 'pending', detail: '', groupEnd: i === 2 || i === 4 || i === 7 || i === 9 })) -/** 节点状态 → antd 状态色(实心 / 文字)与状态 Tag 的预设色名 */ -const TONE: Record = { - active: { fg: 'var(--ant-color-primary)', tag: 'processing' }, - failed: { fg: 'var(--ant-color-error)', tag: 'error' }, - done: { fg: 'var(--ant-color-success)', tag: 'success' }, +/** + * 节点状态 → 状态色(实心 / 文字)与标签色调。 + * + * 2026-11 第七轮:这里的 tag 原本是 antd 的**预设色名**(`color="success"`), + * 渲染出来是一块浅绿底(#f6ffed)——顶栏上「已交付」的项目长期顶着这块绿, + * 和用户要退役的浅绿标签是同一个来源。改成 kit 的 `Tag`:底一律中性, + * 语义只由标签头部那颗 6px 圆点承载(口径见 components/ui/Status.tsx)。 + */ +const TONE: Record = { + active: { fg: 'var(--ant-color-primary)', tag: 'accent' }, + failed: { fg: 'var(--ant-color-error)', tag: 'bad' }, + done: { fg: 'var(--ant-color-success)', tag: 'ok' }, pending: { fg: 'var(--ant-color-text-tertiary)', tag: 'default' }, idle: { fg: 'var(--ant-color-text-tertiary)', tag: 'default' } } @@ -127,8 +135,7 @@ export function PipelineConsole({ projectId }: { projectId: string }) { {projectTitle} {proj?.status && ( - + {statusLabel(proj.status)} )} @@ -162,15 +169,3 @@ export function PipelineConsole({ projectId }: { projectId: string }) { } export default PipelineConsole - -/** - * 侧栏项目名下那一行「当前节点」。 - * 和顶栏控制台同一口径(lib/pipeline.ts),两处不能各算各的。 - */ -export function useCurrentStageNote(projectId: string): string { - const project = useProjectStore((s) => s.project) - const workflow = useProjectStore((s) => s.workflow) - const proj = projectId && project?.id === Number(projectId) ? project : null - if (!proj) return '' - return stageNote(proj, workflow && workflow.length ? workflow : proj.workflow) -} diff --git a/frontend/src/app/layout/nav.tsx b/frontend/src/app/layout/nav.tsx index 8481a0c..49d141b 100644 --- a/frontend/src/app/layout/nav.tsx +++ b/frontend/src/app/layout/nav.tsx @@ -1,5 +1,5 @@ /** - * 导航表:侧栏两级菜单的唯一来源(一级 = 全局三项 + 当前项目,二级 = 七个项目环节)。 + * 导航表:侧栏两级菜单的唯一来源(一级 = 全局三项 + 项目环节,二级 = 七个环节)。 * * 为什么不是 zustand:这张表是静态表不是状态。加一个项目环节 = 这里加一行 * + `app/router.tsx` 加一条子路由(含 handle 标题),两边顺序保持一致即可。 @@ -13,7 +13,7 @@ * * 本轮重设计换掉了侧栏里四枚图形,理由都写在登记表对应那一行旁边,这里只记结论: * 项目总览 Appstore(四方块) → Project(看板格) —— 原来和「资产管理」的素材墙撞脸 - * 资产管理 FolderOpen(文件夹) → Appstore(方块) —— 原来和父级「当前项目」上下同图 + * 资产管理 FolderOpen(文件夹) → Appstore(方块) —— 原来和父级「项目环节」上下同图 * 质检审核 Audit(夹板) → SafetyCertificate(盾牌) —— 夹板的勾在 14px 下糊成一块板 * 时间线 NodeIndex(节点连线) → Scissor(剪刀) —— 节点连线读不出「剪辑」 * 尺寸也不由这里写:菜单图标走 Menu 的 iconSize token(16),按钮图标走 @@ -40,7 +40,7 @@ export const globalNav: NavItem[] = [ { to: '/models', icon: , label: '模型管理中心', hint: '大模型 / 视频 / 图像 / 声音' } ] -/** 当前项目的七个环节:顺序就是流程顺序,别按字母排 */ +/** 项目的七个环节:顺序就是流程顺序,别按字母排。侧栏只放环节名,不放项目名 */ export const projectModules: NavItem[] = [ { to: (id) => `/projects/${id}/overview`, icon: , label: '流程概览', hint: '总控台 / 全节点进度' }, { to: (id) => `/projects/${id}/library`, icon: , label: '资产管理', hint: '人物 / 声音 / 场景' },