"use client"; import { useState } from "react"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; export function ConfirmDeleteDialog({ open, onOpenChange, title, description, confirmLabel = "Delete", onConfirm, }: { open: boolean; onOpenChange: (open: boolean) => void; title: string; description: string; confirmLabel?: string; onConfirm: () => void | Promise; }) { const [pending, setPending] = useState(false); async function handleConfirm() { setPending(true); await onConfirm(); setPending(false); onOpenChange(false); } return ( !pending && onOpenChange(next)}> {title} {description} ); }