import { FolderKanban, RotateCcw } from "lucide-react"; import { CONTENT_MODERATION_ERROR_CODE, isContentModerationError } from "@/lib/generation-error"; import type { GenerationTask } from "@/services/api/task-center"; import { isTaskFailed } from "./task-shared"; export type TaskGroup = { key: string; title: string; projectName: string; tasks: GenerationTask[] }; export function TaskGroupHeader({ group, retrying = false, onRetryFailed }: { group: TaskGroup; retrying?: boolean; onRetryFailed: () => void }) { const succeeded = group.tasks.filter((task) => task.status === "succeeded").length; const active = group.tasks.filter((task) => task.status === "queued" || task.status === "running").length; const failed = group.tasks.filter((task) => isTaskFailed(task) && task.errorCode !== CONTENT_MODERATION_ERROR_CODE && !isContentModerationError(task.error)).length; const title = group.projectName ? `${group.title} · ${group.projectName}` : group.title; return (
{title} 共 {group.tasks.length} 项 · 完成 {succeeded}
{active ? {active} 运行中 : null} {active && failed ? : null} {failed ? {failed} 失败 : null} {(active || failed) && succeeded ? : null} {succeeded ? {succeeded} 已完成 : null} {!active && !failed && !succeeded ? "暂无进行中的任务" : null}
{failed ? ( ) : null}
); }