import { Tag } from "antd"; import type { ReactNode } from "react"; import type { ProjectDetail, ProjectUnit } from "@/services/api/projects"; export type ProjectDetailViewProps = { detail: ProjectDetail; refreshProject: () => void; onCreateCanvas: () => void; }; export const categoryLabels: Record = { character: "角色", environment: "场景", wardrobe: "服饰", prop: "道具", weapon: "武器", style: "画风", other: "其他", }; export const mediaLabels: Record = { image: "图片", video: "视频", audio: "音频", text: "文本", model: "3D 模型", entity: "角色卡", }; const statusLabels: Record = { active: "进行中", archived: "已归档", draft: "草稿", ready: "待制作", completed: "已完成", review: "待审核", confirmed: "已确认", pending: "待处理", pending_confirmation: "待确认", running: "进行中", failed: "失败", ignored: "已忽略", skipped: "已跳过", cancelled: "已取消", succeeded: "已完成", disabled: "已停用", idle: "待开始", loading: "处理中", queued: "排队中", success: "已完成", error: "异常", deleted: "已删除", reserved: "已冻结", settled: "已结算", refunded: "已退款", uncertain: "待核对", }; const sourceTypeLabels: Record = { blank: "空白开始", novel: "导入小说", text: "粘贴文本", }; export function categoryLabel(value: string) { return categoryLabels[value] || "其他"; } export function statusLabel(value: string) { return statusLabels[value] || "未知状态"; } export function mediaLabel(value: string) { return mediaLabels[value] || "其他类型"; } export function sourceTypeLabel(value: string) { return sourceTypeLabels[value] || "其他来源"; } export function StatusPill({ status }: { status: string }) { const color = status === "completed" || status === "confirmed" || status === "succeeded" ? "success" : status === "failed" ? "error" : status === "running" || status === "active" ? "processing" : status === "review" || status === "pending_confirmation" ? "warning" : "default"; return {statusLabel(status)}; } export function SectionTitle({ eyebrow, title, description, action }: { eyebrow?: string; title: string; description?: string; action?: ReactNode }) { return (
{eyebrow ?
{eyebrow}
: null}

{title}

{description ?

{description}

: null}
{action ?
{action}
: null}
); } export function MetricTile({ label, value, detail, accent = false }: { label: string; value: string | number; detail?: string; accent?: boolean }) { return (
{label}
{value}{detail ? {detail} : null}
); } export function UnitProgress({ unit }: { unit: ProjectUnit }) { const progress = unit.status === "completed" ? 100 : unit.status === "ready" ? 66 : 24; return
; } export function formatTime(value?: string) { if (!value) return "-"; return new Date(value).toLocaleString("zh-CN", { month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit" }); } export function formatCount(value: number) { return new Intl.NumberFormat("zh-CN").format(value); }