返回 JoyAI-Echo
StepConfirmDialog.tsx
根目录 / echo_longvideo / Director_Agent / webui / src / components / longvideo / StepConfirmDialog.tsx
1 import { ArrowRight } from "lucide-react";
2
3 import {
4 AlertDialog,
5 AlertDialogAction,
6 AlertDialogCancel,
7 AlertDialogContent,
8 AlertDialogDescription,
9 AlertDialogFooter,
10 AlertDialogHeader,
11 AlertDialogTitle,
12 } from "@/components/ui/alert-dialog";
13
14 import type { StepId } from "./StepHeader";
15
16 const STEP_CONFIRM: Partial<Record<StepId, { title: string; desc: string }>> = {
17 2: { title: "Build the shot plan?", desc: "The story will be split into editable shot segments." },
18 3: { title: "Start shot generation?", desc: "Confirm the shot plan before generation begins." },
19 4: { title: "Assemble the final cut?", desc: "All approved shots will be merged into one film." },
20 };
21
22 interface StepConfirmDialogProps {
23 open: boolean;
24 to?: StepId;
25 /** 仅提示、不可继续时使用(单按钮) */
26 alert?: { title: string; desc: string; actionLabel?: string };
27 onConfirm: () => void;
28 onCancel: () => void;
29 }
30
31 export function StepConfirmDialog({
32 open,
33 to,
34 alert,
35 onConfirm,
36 onCancel,
37 }: StepConfirmDialogProps) {
38 const copy = alert ?? STEP_CONFIRM[to ?? 2] ?? { title: "", desc: "" };
39 const isAlert = Boolean(alert);
40 const actionLabel = alert?.actionLabel ?? "Got It";
41
42 return (
43 <AlertDialog open={open} onOpenChange={(v) => !v && onCancel()}>
44 <AlertDialogContent className="max-w-sm">
45 <AlertDialogHeader>
46 <AlertDialogTitle className="text-[15px]">
47 {copy.title}
48 </AlertDialogTitle>
49 <AlertDialogDescription className="mt-1 text-[13px]">
50 {copy.desc}
51 </AlertDialogDescription>
52 </AlertDialogHeader>
53 <AlertDialogFooter className="mt-2">
54 {isAlert ? (
55 <AlertDialogAction
56 onClick={onConfirm}
57 className="h-8 rounded-lg px-3 text-[13px]"
58 >
59 {actionLabel}
60 </AlertDialogAction>
61 ) : (
62 <>
63 <AlertDialogCancel
64 onClick={onCancel}
65 className="h-8 rounded-lg px-3 text-[13px]"
66 >
67 Cancel
68 </AlertDialogCancel>
69 <AlertDialogAction
70 onClick={onConfirm}
71 className="h-8 rounded-lg px-3 text-[13px]"
72 >
73 Confirm
74 <ArrowRight className="ml-1 h-3.5 w-3.5" />
75 </AlertDialogAction>
76 </>
77 )}
78 </AlertDialogFooter>
79 </AlertDialogContent>
80 </AlertDialog>
81 );
82 }
83
83 lines Plain Text