Files
UHD_Media_Tool/apps/web/app/components/downloads/business-timeline.tsx
T
rootandClaude Opus 5.5 4480fc346d refactor(copy): 术语统一——收录版本、模型服务、智能体等(DEAI-2)
- 版本目标 → 收录版本(前后端用户可见字符串、能力描述、给模型的提示)
- Agent 上游 / 上游 → 模型服务;界面上的 Agent / Agent 会话 → 智能体 / 智能体会话
- 身份歧义 / 识别有歧义 / 无法确定作品 → 没识别出作品;待识别(池) → 未识别
- 建档 → 加入媒体库;资产 → 文件;库根 → 媒体库目录;纳管 → 本工具 / 外部任务;
  哨兵 → 标记文件 / 检查目录;站点快照 → 抓取;Feed / RSS 订阅 / 来源健康 → RSS
- 代码标识符、API 字段名、迁移文件不改;glossary.md 同步;smoke 选择器跟随

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-29 20:35:43 +08:00

69 lines
2.5 KiB
TypeScript

import { ExternalLink } from "lucide-react";
import { Link } from "react-router";
import type { TimelineEvent, TimelineStage } from "~/api/tasks.ts";
import { LoadingState } from "~/components/console/empty-state.tsx";
import { StatusBadge } from "~/components/console/status-badge.tsx";
import { Timeline } from "~/components/console/timeline.tsx";
// 业务时间线(参考 MovieClaw task-activity):把观察 → 计划 → 下载 → 整理 → Agent 串成一个业务过程,
// 阶段计数与首页/侧栏同口径;每条事件都有文字说明,不只靠颜色。
export const STAGE_LABEL: Record<TimelineStage, string> = {
observation: "观察",
plan: "计划",
download: "下载",
organization: "整理",
agent: "智能体",
engine: "任务",
};
const ORDER: TimelineStage[] = ["observation", "plan", "download", "organization", "agent", "engine"];
export function BusinessTimeline({ events, loading }: { events: TimelineEvent[]; loading?: boolean }) {
const counts = new Map<TimelineStage, number>();
for (const e of events) counts.set(e.stage, (counts.get(e.stage) ?? 0) + 1);
const ongoing = events.filter((e) => e.ongoing);
return (
<div className="space-y-3">
<div className="flex flex-wrap gap-1.5">
{ORDER.map((s) => {
const n = counts.get(s) ?? 0;
const bad = events.some((e) => e.stage === s && e.tone === "destructive");
return (
<StatusBadge key={s} tone={bad ? "destructive" : n ? "success" : "neutral"}>
{STAGE_LABEL[s]} {n ? `· ${n}` : "· 无"}
</StatusBadge>
);
})}
</div>
{ongoing.length ? (
<p className="text-caption text-muted-foreground">当前:{ongoing.map((e) => e.title).join(";")}</p>
) : null}
{loading && !events.length ? (
<LoadingState rows={3} />
) : (
<Timeline
items={events.map((e) => ({
id: e.key,
at: e.at,
tone: e.tone,
meta: STAGE_LABEL[e.stage],
title: e.href ? (
<Link to={e.href} className="inline-flex items-center gap-1 underline-offset-4 hover:underline">
{e.title}
<ExternalLink className="h-3 w-3" />
</Link>
) : (
e.title
),
description: e.detail ?? undefined,
}))}
/>
)}
{loading && events.length ? (
<p className="text-meta text-muted-foreground">正在加载关联的整理记录与引擎运行…</p>
) : null}
</div>
);
}