"use client"; import { useState } from "react"; import { Trash2 } from "lucide-react"; import { Button } from "@/components/ui/button"; interface Props { label: string; confirmMessage: string; disabled?: boolean; onConfirm: () => Promise; } export function DeleteAllButton({ label, confirmMessage, disabled, onConfirm, }: Props) { const [busy, setBusy] = useState(false); const click = async () => { if (busy) return; if (!confirm(confirmMessage)) return; setBusy(true); try { await onConfirm(); } finally { setBusy(false); } }; return ( ); }