import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog"; import { Trash2 } from "lucide-react"; import { useTranslation } from "react-i18next"; import type { SessionAutomationJob } from "@/lib/types"; interface DeleteConfirmProps { open: boolean; title: string; automations?: SessionAutomationJob[]; onCancel: () => void; onConfirm: () => void; } export function DeleteConfirm({ open, title, automations = [], onCancel, onConfirm, }: DeleteConfirmProps) { const { t } = useTranslation(); const hasAutomations = automations.length > 0; const visibleAutomations = automations.slice(0, 4); const hiddenCount = Math.max(0, automations.length - visibleAutomations.length); return ( (!o ? onCancel() : undefined)}>
{t("deleteConfirm.title", { title })} {hasAutomations ? t("deleteConfirm.automationsDescription", { count: automations.length, defaultValue: "This chat has scheduled automations. Deleting it will also delete them.", }) : t("deleteConfirm.description")} {hasAutomations ? (
{visibleAutomations.map((job) => (
{job.name || job.id}
))} {hiddenCount > 0 ? (
{t("deleteConfirm.moreAutomations", { count: hiddenCount, defaultValue: "+ {{count}} more", })}
) : null}
) : null}
{t("deleteConfirm.cancel")} {hasAutomations ? t("deleteConfirm.confirmWithAutomations", { defaultValue: "Delete all", }) : t("deleteConfirm.confirm")}
); }