import React, { useEffect, useState } from 'react'; import { X, AlertTriangle, CheckCircle2, Info, Loader2 } from 'lucide-react'; import { cn } from '../lib/utils'; interface ConfirmModalProps { isOpen: boolean; onConfirm: () => void; onCancel: () => void; title: string; message: string; confirmText?: string; cancelText?: string; type?: 'info' | 'warning' | 'danger'; isLoading?: boolean; } export function ConfirmModal({ isOpen, onConfirm, onCancel, title, message, confirmText = 'Confirm', cancelText = 'Cancel', type = 'info', isLoading = false }: ConfirmModalProps) { const [shouldRender, setShouldRender] = useState(isOpen); useEffect(() => { if (isOpen) setShouldRender(true); }, [isOpen]); const onAnimationEnd = () => { if (!isOpen) setShouldRender(false); }; if (!shouldRender) return null; const Icon = type === 'danger' || type === 'warning' ? AlertTriangle : Info; const iconColor = type === 'danger' ? 'text-red-500 bg-red-500/10' : type === 'warning' ? 'text-amber-500 bg-amber-500/10' : 'text-blue-500 bg-blue-500/10'; const confirmBtnClass = type === 'danger' ? 'bg-red-600 hover:bg-red-700' : type === 'warning' ? 'bg-amber-600 hover:bg-amber-700' : 'bg-blue-600 hover:bg-blue-700'; return (

{title}

{message}

); }