"use client"; import { useEffect, type ReactNode } from "react"; import { cn } from "@/lib/utils"; export interface ConfirmDialogProps { open: boolean; title: string; description?: ReactNode; confirmLabel?: string; cancelLabel?: string; /** Red styling for irreversible actions (delete, permanent trash, …). */ destructive?: boolean; busy?: boolean; onConfirm: () => void; onClose: () => void; } /** * Minimal fixed-overlay confirm dialog (no @factory/ui coupling — kept * local so the web app's dialog behavior stays independently testable). */ export function ConfirmDialog({ open, title, description, confirmLabel = "Confirm", cancelLabel = "Cancel", destructive = false, busy = false, onConfirm, onClose }: ConfirmDialogProps) { useEffect(() => { if (!open) return; const onKey = (e: KeyboardEvent) => { if (e.key === "Escape") onClose(); }; window.addEventListener("keydown", onKey); return () => window.removeEventListener("keydown", onKey); }, [open, onClose]); if (!open) return null; return (

{title}

{description ? (
{description}
) : null}
); }