"use client"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@app/components/ui/dialog"; import { Button } from "@app/components/ui/button"; import { AlertTriangle } from "lucide-react"; interface ConfirmationDialogProps { open: boolean; onOpenChange: (open: boolean) => void; title: string; description: string; confirmText?: string; cancelText?: string; variant?: "destructive" | "default"; onConfirm: () => Promise | void; loading?: boolean; } export function ConfirmationDialog({ open, onOpenChange, title, description, confirmText = "Confirm", cancelText = "Cancel", variant = "destructive", onConfirm, loading = false }: ConfirmationDialogProps) { const handleConfirm = async () => { try { await onConfirm(); onOpenChange(false); } catch (error) { // Error handling is done by the calling component console.error("Confirmation action failed:", error); } }; return ( {title} {description} ); }