import { motion } from "motion/react"; import { CheckCircle2, CloudUpload, Eye, LoaderCircle, RotateCcw, TriangleAlert, X } from "lucide-react"; import type { GenerationTask } from "@/services/api/task-center"; import type { MergeVideoProgress } from "@/lib/canvas/canvas-video-merge"; import { canvasThemes } from "@/lib/canvas-theme"; import type { CanvasAgentChange } from "./use-canvas-agent-operations"; import { aceternityMotion } from "@/lib/aceternity-motion"; export type CanvasUploadStatus = { id: number; title: string; detail: string; step: number; total: number; done?: boolean; error?: boolean; }; type CanvasTheme = (typeof canvasThemes)[keyof typeof canvasThemes]; export function CanvasUploadStatusToast({ status, theme }: { status: CanvasUploadStatus; theme: CanvasTheme }) { const progress = Math.round((Math.min(status.step, status.total) / Math.max(status.total, 1)) * 100); const accent = status.error ? theme.accent.danger : status.done ? "#22c55e" : theme.node.activeStroke; return (
{status.error ? : status.done ? : } {status.title} {status.detail} {status.step}/{status.total}
{Array.from({ length: status.total }, (_, index) => ( ))}
{progress}% ); } export function TaskDetailItem({ label, value }: { label: string; value: string }) { return (
{label}
{value}
); } export function CanvasMergeStatusToast({ progress, theme }: { progress: MergeVideoProgress; theme: CanvasTheme }) { const detail = progress.phase === "loading" ? "加载视频工具" : progress.phase === "reading" ? "读取选中视频" : "正在编码合并成片"; const percent = Math.max(0, Math.min(100, Math.round(progress.progress))); return (
合并成片 {detail} {percent}%
); } export function CanvasAgentChangeToast({ change, theme, onView, onUndo, onClose }: { change: CanvasAgentChange; theme: CanvasTheme; onView: () => void; onUndo: () => void; onClose: () => void }) { return (
Agent 已写回画布 {change.summary} · 可撤销最近 {change.undoCount} 批
{change.nodeIds.length ? ( ) : null}
); } export function taskStatusText(status: GenerationTask["status"]) { if (status === "queued") return "排队中"; if (status === "running") return "生成中"; if (status === "succeeded") return "任务完成"; if (status === "failed") return "任务失败"; return "任务已取消"; }