"use client"; import { AlertCircle, AlertTriangle, CheckCircle2, Info } from "lucide-react"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog"; import { useGlobalAlertStore } from "@/features/layout/stores/use-global-alert-store"; import { cn } from "@/lib/utils"; export function GlobalAlertModal() { const { isOpen, type, title, message, confirmLabel, cancelLabel, onConfirm, onCancel, isSingleButton, closeAlert, } = useGlobalAlertStore(); const handleOpenChange = (open: boolean) => { if (!open) { closeAlert(); } }; const handleConfirm = () => { onConfirm?.(); closeAlert(); }; const handleCancel = () => { onCancel?.(); closeAlert(); }; const Icon = { success: CheckCircle2, error: AlertCircle, warning: AlertTriangle, info: Info, }[type]; const iconColor = { success: "text-emerald-500", error: "text-red-500", warning: "text-amber-500", info: "text-blue-500", }[type]; const bgColor = { success: "bg-emerald-50 dark:bg-emerald-950/20", error: "bg-red-50 dark:bg-red-950/20", warning: "bg-amber-50 dark:bg-amber-950/20", info: "bg-blue-50 dark:bg-blue-950/20", }[type]; return (
{title} {message}
{!isSingleButton && ( {cancelLabel || "취소"} )} {confirmLabel || "확인"}
); }