import * as React from "react"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog"; import { Spinner } from "@/components/ui/spinner"; // --------------------------------------------------------------------------- // Types // --------------------------------------------------------------------------- export interface DeleteContactComponentProps { open: boolean; onOpenChange: (open: boolean) => void; /** "single" — confirm deleting one contact by name. */ mode: "single" | "bulk"; /** Required when mode="single". */ contactName?: string; /** Required when mode="bulk". Number of contacts to delete. */ count?: number; onConfirm: () => void; isLoading?: boolean; } // --------------------------------------------------------------------------- // Component // --------------------------------------------------------------------------- export function DeleteContactComponent({ open, onOpenChange, mode, contactName, count = 0, onConfirm, isLoading = false, }: DeleteContactComponentProps) { const isSingle = mode === "single"; const title = isSingle ? `Delete ${contactName ?? "this client"}?` : `Delete ${count} client${count !== 1 ? "s" : ""}?`; const description = isSingle ? `This will permanently remove ${contactName ?? "this client"} and all their associated data. This action cannot be undone.` : `This will permanently remove ${count} selected client${count !== 1 ? "s" : ""} and all their associated data. This action cannot be undone.`; return ( {title} {description} Cancel {isLoading ? ( <> Deleting… ) : ( "Delete" )} ); }