diff --git a/frontend/src/components/ui/Page.tsx b/frontend/src/components/ui/Page.tsx index 1a1c446..380447d 100644 --- a/frontend/src/components/ui/Page.tsx +++ b/frontend/src/components/ui/Page.tsx @@ -18,7 +18,8 @@ * 这里把 antd 的那对引进来叫 AntRow/AntCol,铺列由本文件的 Layout 负责。 */ import { type CSSProperties, type ReactNode } from 'react' -import { useNavigate } from 'react-router-dom' +import { useLocation, useNavigate } from 'react-router-dom' +import { pathOf, projectIdOf, projectModules, type NavItem } from '../../app/layout/nav' import { Avatar, Breadcrumb as AntBreadcrumb, Col as AntCol, Divider, Flex, Row as AntRow, Typography } from 'antd' import { cn } from '../../lib/cn' import { ActionGroup } from './Controls' @@ -161,11 +162,68 @@ export function PageHead({ title, sub, meta, actions, className }: { className="!mb-0 block max-w-[72ch] text-xs leading-relaxed">{sub} )} - {actions && {actions}} + {/* auto={false}:页头的窄屏方案是「整组满宽 + 按钮等分」(WRAP_ACTIONS), + 不需要 ActionGroup 再把它翻成竖排一列 */} + {actions && {actions}} ) } +/** 路由 → 这一站(项目环节页专用):算不出(全局页 / 未知段)就返回 null */ +function moduleAt(pathname: string): { item: NavItem; index: number } | null { + const pid = projectIdOf(pathname) + if (!pid) return null + const index = projectModules.findIndex((m) => pathOf(m, pid) === pathname.replace(/\/+$/, '')) + return index < 0 ? null : { item: projectModules[index], index } +} + +/** + * 环节页头(项目七站专用)= **单独一张带底纹描边的面板**里装的 PageHead。 + * + * 症状(2026-11 第十一轮 · 用户第 1 条原话「项目中切到每个节点应该是其对应的 + * Header,这部分应该放入一个有样式的单独面板中」):环节页的页头是一行裸 + * 浮在页面底色上的字(标题 + 一句说明 + 右端按钮),它和正文第一张卡之间 + * 只有 16px 空白,读起来像「正文上面漏了半句话」;而它上面还压着外壳那条 + * 同样裸着的面包屑工具条,两层没有边界的东西叠在一起,分不清哪句说的是 + * 项目、哪句说的是这一站。 + * 做法:页头自己成为一张卡(`.nex-nodehead`:主色浅底渐变 + 主色描边), + * 和下面的正文卡同级同宽;眉标由路由算出「项目环节 · 第 N / 7 站」, + * 这一站在七站里的位置第一次被写在页面上(侧栏只有名字,没有序号)。 + * 为什么放在 kit 而不是每个页面自己套 Panel:七站是同一个层级, + * 底纹、描边、眉标算法必须一模一样;页面只该决定标题、说明和主按钮。 + * 用法:项目环节页把 `` 换成 ``,其余属性不变; + * 非项目路由(平台资产库这种全局页)算不出站次,眉标自动不出现, + * 面板皮肤照样成立。 + */ +export function NodeHead({ title, sub, meta, actions, className }: { + title?: ReactNode + /** 标题下方的一句话职责说明 */ + sub?: ReactNode + /** 标题上方一行(与自动生成的站次眉标同排,追加在后面) */ + meta?: ReactNode + actions?: ReactNode + className?: string +}) { + const location = useLocation() + const at = moduleAt(location.pathname) + return ( + + + + {at.item.icon} + + 项目环节 · 第 {at.index + 1} / {projectModules.length} 站 · {at.item.label} + + + {meta} + + ) : meta} /> + + ) +} + /** * 面包屑 = antd Breadcrumb(层级导航的唯一实现)。 * diff --git a/frontend/src/lib/pipeline.ts b/frontend/src/lib/pipeline.ts index 3451195..5f4c1ba 100644 --- a/frontend/src/lib/pipeline.ts +++ b/frontend/src/lib/pipeline.ts @@ -21,6 +21,41 @@ export function allNodesDone(nodes: any[] | null | undefined) { return ns.length > 0 && ns.every((n: any) => n.state === 'done') } +/* ── 12 节点 ↔ 七个环节页(2026-11 第十一轮:项目概况搬进顶栏抽屉)──────────────── + 顶栏那条轨道回答「12 个节点走到哪儿了」,抽屉里的环节列表回答「下一步去哪个页面」, + 两者必须用同一张表换算——否则侧栏加一个环节、抽屉里汇总的状态还在说旧话。 + 键 = 后端 PIPELINE_STAGES 的 node.key;值 = 路由最后一段(与 app/layout/nav.tsx + 的 projectModules 一一对应:create_project/preflight 落在流程概览这一站, + 因为「素材预检」面板就在那一页)。 */ +export const NODE_MODULE: Record = { + create_project: 'overview', + import_storyboard: 'storyboard', + bind_assets: 'library', + plan_tasks: 'dispatch', + preflight: 'overview', + dispatch: 'dispatch', + generate: 'dispatch', + save_output: 'dispatch', + quality_check: 'review', + review: 'review', + revise: 'storyboard', + compose: 'timeline', + export: 'delivery' +} + +/** + * 一个环节(它覆盖的那几个节点)现在算什么状态:需处理 > 进行中 > 全部完成 > 待处理。 + * 环节没覆盖任何节点(或流程还没生成)时返回空串,页面显示「—」而不是假报「待处理」。 + */ +export function moduleState(nodes: any[] | null | undefined, mod: string): string { + const ns = (nodes || []).filter((n: any) => NODE_MODULE[n.key] === mod) + if (!ns.length) return '' + if (ns.some((n: any) => n.state === 'failed')) return 'failed' + if (ns.some((n: any) => n.state === 'active')) return 'active' + if (ns.every((n: any) => n.state === 'done')) return 'done' + return 'pending' +} + /** * 列表 / 卡片 / 页签上那一行「当前节点」文案。 * 流程全部走完的项目不再报最后一个节点名,否则会和旁边的「已交付」自相矛盾。 diff --git a/frontend/src/styles/app.css b/frontend/src/styles/app.css index d240fab..323464f 100644 --- a/frontend/src/styles/app.css +++ b/frontend/src/styles/app.css @@ -149,6 +149,74 @@ textarea) { width: 100%; min-width: 0 } .nex-panel .ant-card-body { min-width: 0 } .nex-panel .ant-card-body > * { min-width: 0 } +/* ── 环节页头(NodeHead):项目七站的页头是一张**有底纹描边的卡** ────────── + 症状(2026-11 第十一轮 · 用户第 1 条原话「项目中切到每个节点应该是其对应的 + Header,这部分应该放入一个有样式的单独面板中」):页头是一行裸浮在页面 + 底色上的字,和正文第一张卡之间只有 16px 空白,读起来像「正文上面漏了半句 + 话」;上面还叠着外壳那条同样裸着的面包屑条,两层无边界的东西贴在一起, + 分不清哪句说项目、哪句说这一站。 + 做法:页头坐进自己的 Card,底纹 = 主色 7%(深色 14%)斜向渐变收进卡底色, + 描边取主色描边那一族——它是全站唯一带主色描边的卡,一眼就是「这一层的门牌」, + 下面的正文卡都是中性描边,主次不再靠字号硬撑。 + 特异度:antd 5.29 把样式注进 与 app.css 抢先后,两个类起步, + body 内边距那条堆到三个类才压得住 `.ant-card-small > .ant-card-body`。 */ +.nex-panel.nex-nodehead { + border-color: var(--ant-color-primary-border); + background: linear-gradient(115deg, + color-mix(in srgb, var(--ant-color-primary) 7%, var(--ant-color-bg-container)) 0%, + var(--ant-color-bg-container) 58%); +} +html[data-theme='dark'] .nex-panel.nex-nodehead { + background: linear-gradient(115deg, + color-mix(in srgb, var(--ant-color-primary) 14%, var(--ant-color-bg-container)) 0%, + var(--ant-color-bg-container) 58%); +} +.nex-panel.nex-nodehead > .ant-card-body { padding: var(--ant-padding-sm) var(--ant-padding-lg) } +/* 眉标左侧那枚环节图标:与统计卡那只 32px 色块同族,只是页头这行字矮,降到 20px */ +.nex-nodehead-mark { + display: inline-flex; align-items: center; justify-content: center; + inline-size: 20px; block-size: 20px; flex: none; + border-radius: var(--ant-border-radius-sm); + background: color-mix(in srgb, var(--ant-color-primary) 14%, transparent); + color: var(--ant-color-primary); + font-size: var(--ant-font-size-sm); +} + +/* ── 顶栏流程控制台(PipelineConsole):一颗**打开项目概况抽屉**的按钮 ────── + 症状(用户第 2 条):项目身份在站内说了三遍——顶栏这颗胶囊、外壳那条面包屑、 + 概览页的「流程概览」页头,而「归档 / 删除」这两颗项目级操作又散在 + 面包屑和概览页页头两处。胶囊本身是个 跳到流程概览,点下去既不是 + 「项目详情」也不是「项目操作」,语义含混。 + 做法:胶囊改成 antd 的 text Button(整站按钮只有一个来源,R15/R8), + 点击不再跳页而是打开右侧「项目概况」抽屉——项目身份、指标、流程、 + 七站跳转、归档与删除全部收进那一处(见 app/layout/ProjectBriefDrawer)。 + 外观仍是那条 32px 胶囊:底走 bg-elevated(比 Header 底色亮一档, + 与同排控件等高),描边跟流程色调由组件自己写 inline。 + 为什么不是 :跳转语义已经还给抽屉里的七站列表,这颗只管「展开/收起」, + 那是 button 的活(aria-haspopup="dialog" + aria-expanded)。 */ +.nex-console.ant-btn.ant-btn-text { + display: flex; align-items: center; gap: var(--ant-margin-xs); + flex: 0 1 auto; min-width: 0; max-width: 640px; + height: var(--ant-control-height); line-height: normal; + padding-inline: var(--ant-padding-sm); + border: 1px solid var(--ant-color-primary-border); + background: var(--ant-color-bg-elevated); + color: var(--ant-color-text); + font-weight: 400; +} +/* text 按钮的悬停底色是一整块 fill,压在胶囊上会把里面的彩色轨道糊掉 */ +.nex-console.ant-btn.ant-btn-text:hover { + background: var(--ant-color-bg-elevated); + border-color: var(--ant-color-primary-border-hover); + color: var(--ant-color-text); +} + +/* ── 项目概况抽屉里的「七站」列表行(ProjectBriefDrawer)────────────────── + 一行 = 图标 + 环节名 + 右端状态,整行可点。antd Button 是居中排版, + block 之后要让内容左对齐并撑满,右端状态才有 ms-auto 可推。 */ +.nex-brief-row.ant-btn { justify-content: flex-start; text-align: start; height: auto; padding-block: var(--ant-padding-xxs) } +.nex-brief-row.ant-btn > span { min-width: 0 } + /* ── 控件容器 ───────────────────────────────────────────────────────────── Ctlbar / CardActions / BarRight 现在就是 antd (排布由组件给),