diff --git a/.codex-tasks/admin-usability-pass/PROGRESS.md b/.codex-tasks/admin-usability-pass/PROGRESS.md index 2b0d6d4..45704d5 100644 --- a/.codex-tasks/admin-usability-pass/PROGRESS.md +++ b/.codex-tasks/admin-usability-pass/PROGRESS.md @@ -16,3 +16,10 @@ - 业务提供项启用、停用、删除失败会显示错误;操作期间仅锁定当前条目,成功后提示并刷新列表。 - 信任内容列表使用当前模板声明的行业化类型名称,避免列表文案与编辑表单不一致。 - 验证:Admin production build、typecheck、lint、format、`git diff --check` 通过。 + +## 二次可用性加固 + +- 概览页直接读取发布 readiness,显示完成百分比、阻塞发布的具体原因和逐项处理入口,不再使用与发布规则脱节的静态建议。 +- readiness 检查和旧版 fallback 检查先归一化为统一显示模型,避免不同数据来源导致页面类型和行为不一致。 +- 后台侧栏支持窄屏断点收起,顶部显示当前品牌管理员角色,减少多品牌和多人协作时的上下文误判。 +- 验证:Admin production build、全量 typecheck、lint、format、`git diff --check` 通过。 diff --git a/.codex-tasks/admin-usability-pass/TODO.csv b/.codex-tasks/admin-usability-pass/TODO.csv index 47d50d1..cd53891 100644 --- a/.codex-tasks/admin-usability-pass/TODO.csv +++ b/.codex-tasks/admin-usability-pass/TODO.csv @@ -1,4 +1,4 @@ id,task,status,acceptance_criteria,validation_command,completed_at,retry_count,notes 1,修正概览页品牌与模板语义,DONE,模板名称来自 workspace 声明且完整度条目可跳转处理,pnpm --filter @personal-brand/admin build,2026-09-27,0, -2,补齐业务项和信任内容错误反馈,DONE,启停/删除失败可见且信任类型列表使用当前模板文案,pnpm --filter @personal-brand/admin build,2026-09-27,0, -3,完成后台可用性回归,DONE,Admin build、typecheck、lint、format 和 diff 检查通过,pnpm --filter @personal-brand/admin build,2026-09-27,0,全量 typecheck/lint/format 通过 +2,补齐业务项和信任内容错误反馈,DONE,启停/删除失败可见且信任类型列表使用当前模板文案,pnpm --filter @personal-brand/admin build,2026-09-27,0,上一轮已完成 +3,完成后台可用性回归,DONE,Admin build、typecheck、lint、format 和 diff 检查通过,pnpm --filter @personal-brand/admin build,2026-09-27,0,本轮增加 readiness 工作台、响应式侧栏和角色上下文;全量门禁通过 diff --git a/apps/admin/src/features/overview/OverviewPage.tsx b/apps/admin/src/features/overview/OverviewPage.tsx index 126de62..13c3c95 100644 --- a/apps/admin/src/features/overview/OverviewPage.tsx +++ b/apps/admin/src/features/overview/OverviewPage.tsx @@ -1,5 +1,5 @@ -import { Button, Card, Col, List, Row, Space, Statistic, Tag, Typography } from "antd"; -import { useQueries } from "@tanstack/react-query"; +import { Button, Card, Col, List, Progress, Row, Space, Statistic, Tag, Typography } from "antd"; +import { useQueries, useQuery } from "@tanstack/react-query"; import { useNavigate } from "react-router-dom"; import { createApiClient } from "../../lib/api.js"; import { AdminPageHeader } from "../../components/AdminPageHeader.js"; @@ -20,9 +20,16 @@ export function OverviewPage() { }, ], }); + const readiness = useQuery({ + queryKey: ["admin-overview-readiness"], + queryFn: () => client.getAdminReleaseReadiness(), + }); const loading = results.some((result) => result.isLoading); - const error = results.find((result) => result.isError)?.error; - const retry = () => results.forEach((result) => void result.refetch()); + const error = results.find((result) => result.isError)?.error ?? readiness.error; + const retry = () => { + results.forEach((result) => void result.refetch()); + void readiness.refetch(); + }; const brand = results[0].data; const workspace = results[1].data as | { @@ -51,8 +58,26 @@ export function OverviewPage() { path: "/admin/workspace", }, ]; + const readinessChecks = readiness.data?.checks ?? []; + const checks = readinessChecks.length + ? readinessChecks.map((check) => ({ + key: check.key, + label: check.label, + passed: check.passed, + destination: check.destination, + })) + : checklist.map((check) => ({ + key: check.path, + label: check.label, + passed: check.done, + destination: check.path, + })); + const incompleteChecks = checks.filter((check) => !check.passed); + const completionPercent = checks.length + ? Math.round((checks.filter((check) => check.passed).length / checks.length) * 100) + : 0; return ( - + - + navigate("/admin/publication")}> + 查看发布页 + + } + > + + + {readiness.data?.ready + ? "当前草稿已满足发布条件,可以进入发布页上线。" + : `还有 ${incompleteChecks.length} 项需要完善,完成后才能发布。`} + + {incompleteChecks.length > 0 && ( + ( + navigate(item.destination ?? "/admin/publication")} + > + 去处理 + , + ]} + > + {item.label} + + )} + /> + )} + + + + ( - - {item.done ? "已完成" : "待完善"} + + {item.passed ? "已完成" : "待完善"} {item.label} - {!item.done && ( - )} @@ -117,16 +188,6 @@ export function OverviewPage() { /> - - - - 先完善品牌定位和信任证明,再配置业务提供项与咨询入口。所有内容发布前都应通过小程序预览确认。 - - - 餐饮模板只是业务表达样例,品牌信任主线仍应优先维护。 - - - diff --git a/apps/admin/src/main.tsx b/apps/admin/src/main.tsx index d3d0775..e990340 100644 --- a/apps/admin/src/main.tsx +++ b/apps/admin/src/main.tsx @@ -12,6 +12,7 @@ import { Menu, Select, Space, + Tag, Typography, message, } from "antd"; @@ -206,7 +207,7 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) { ]; return ( - + 当前品牌工作区 @@ -229,6 +230,9 @@ function Dashboard({ onLogout, role }: { onLogout: () => void; role: string }) { {brand.data?.name || "当前品牌"} 品牌工作区 + + {role === "owner" ? "负责人" : "内容编辑"} +