// ============================================================================= // ConfirmModal Component - Simple confirmation dialog // ============================================================================= import { type ReactNode, useEffect } from "react"; export interface ConfirmModalProps { title: string; message: string | ReactNode; confirmLabel: string; cancelLabel: string; onConfirm: () => void; onCancel: () => void; isLoading?: boolean; confirmVariant?: "primary" | "danger" | "success"; overlayClassName?: string; } export function ConfirmModal({ title, message, confirmLabel, cancelLabel, onConfirm, onCancel, isLoading = false, confirmVariant = "primary", overlayClassName, }: ConfirmModalProps) { // Close on Escape key useEffect(() => { function handleKeyDown(e: KeyboardEvent) { if (e.key === "Escape") { onCancel(); } } document.addEventListener("keydown", handleKeyDown); return () => document.removeEventListener("keydown", handleKeyDown); }, [onCancel]); return (
{ if (e.key === "Escape") onCancel(); }} >
e.stopPropagation()} onKeyDown={(e) => e.stopPropagation()} style={{ maxWidth: "450px" }} >

{title}

{typeof message === "string" ?

{message}

: message}
); }