| 1 | import { |
| 2 | AlertDialog, |
| 3 | AlertDialogAction, |
| 4 | AlertDialogCancel, |
| 5 | AlertDialogContent, |
| 6 | AlertDialogDescription, |
| 7 | AlertDialogFooter, |
| 8 | AlertDialogHeader, |
| 9 | AlertDialogTitle, |
| 10 | } from "@/components/ui/alert-dialog"; |
| 11 | import { useTranslation } from "react-i18next"; |
| 12 | |
| 13 | interface DeleteConfirmProps { |
| 14 | open: boolean; |
| 15 | title: string; |
| 16 | onCancel: () => void; |
| 17 | onConfirm: () => void; |
| 18 | } |
| 19 | |
| 20 | export function DeleteConfirm({ |
| 21 | open, |
| 22 | title, |
| 23 | onCancel, |
| 24 | onConfirm, |
| 25 | }: DeleteConfirmProps) { |
| 26 | const { t } = useTranslation(); |
| 27 | return ( |
| 28 | <AlertDialog open={open} onOpenChange={(o) => (!o ? onCancel() : undefined)}> |
| 29 | <AlertDialogContent> |
| 30 | <AlertDialogHeader> |
| 31 | <AlertDialogTitle> |
| 32 | {t("deleteConfirm.title", { title })} |
| 33 | </AlertDialogTitle> |
| 34 | <AlertDialogDescription> |
| 35 | {t("deleteConfirm.description")} |
| 36 | </AlertDialogDescription> |
| 37 | </AlertDialogHeader> |
| 38 | <AlertDialogFooter> |
| 39 | <AlertDialogCancel onClick={onCancel}> |
| 40 | {t("deleteConfirm.cancel")} |
| 41 | </AlertDialogCancel> |
| 42 | <AlertDialogAction |
| 43 | onClick={onConfirm} |
| 44 | className="bg-destructive text-destructive-foreground hover:bg-destructive/90" |
| 45 | > |
| 46 | {t("deleteConfirm.confirm")} |
| 47 | </AlertDialogAction> |
| 48 | </AlertDialogFooter> |
| 49 | </AlertDialogContent> |
| 50 | </AlertDialog> |
| 51 | ); |
| 52 | } |
| 53 |