返回 JoyAI-Echo
GenerationAlertDialog.tsx
根目录 / echo_longvideo / Director_Agent / webui / src / components / ui / GenerationAlertDialog.tsx
1 import { AlertTriangle } from "lucide-react";
2
3 import {
4 AlertDialog,
5 AlertDialogAction,
6 AlertDialogContent,
7 AlertDialogDescription,
8 AlertDialogFooter,
9 AlertDialogHeader,
10 AlertDialogTitle,
11 } from "@/components/ui/alert-dialog";
12
13 export type GenerationAlertVariant = "congested" | "error";
14
15 const COPY: Record<
16 GenerationAlertVariant,
17 { title: string; description: string }
18 > = {
19 congested: {
20 title: "Generation service is busy",
21 description: "The generation service is at capacity. Please wait a moment.",
22 },
23 error: {
24 title: "Generation error",
25 description: "Generation failed. Please try again.",
26 },
27 };
28
29 interface GenerationAlertDialogProps {
30 open: boolean;
31 variant: GenerationAlertVariant;
32 onDismiss: () => void;
33 }
34
35 /** Single-action alert for shot generation congested / error states. */
36 export function GenerationAlertDialog({
37 open,
38 variant,
39 onDismiss,
40 }: GenerationAlertDialogProps) {
41 const copy = COPY[variant];
42
43 return (
44 <AlertDialog
45 open={open}
46 onOpenChange={(next) => {
47 if (!next) onDismiss();
48 }}
49 >
50 <AlertDialogContent className="max-w-sm">
51 <AlertDialogHeader>
52 <AlertDialogTitle className="flex items-center gap-2 text-[15px]">
53 <AlertTriangle
54 className="h-5 w-5 shrink-0 text-destructive"
55 aria-hidden
56 />
57 <span>{copy.title}</span>
58 </AlertDialogTitle>
59 <AlertDialogDescription className="sr-only">
60 {copy.description}
61 </AlertDialogDescription>
62 </AlertDialogHeader>
63 <AlertDialogFooter className="mt-2">
64 <AlertDialogAction
65 onClick={onDismiss}
66 className="h-8 rounded-lg px-3 text-[13px]"
67 >
68 Got It
69 </AlertDialogAction>
70 </AlertDialogFooter>
71 </AlertDialogContent>
72 </AlertDialog>
73 );
74 }
75
75 lines Plain Text