33 lines
1.4 KiB
TypeScript
33 lines
1.4 KiB
TypeScript
import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter } from "../components/ui/dialog";
|
|
import { Button } from "../components/ui/button";
|
|
|
|
interface Props {
|
|
open: boolean;
|
|
labels?: string[];
|
|
/** Backward-compatible single-session label. */
|
|
label?: string;
|
|
onOpenChange: (open: boolean) => void;
|
|
onConfirm: () => void;
|
|
}
|
|
|
|
export function DeleteConfirmDialog({ open, labels, label, onOpenChange, onConfirm }: Props) {
|
|
const targets = labels ?? (label ? [label] : []);
|
|
const description = targets.length > 1
|
|
? `${targets.length} sessions will be permanently deleted, including all of their documents. This action cannot be undone.`
|
|
: `"${targets[0]}" will be permanently deleted, including all of its documents. This action cannot be undone.`;
|
|
return (
|
|
<Dialog open={open} onOpenChange={onOpenChange}>
|
|
<DialogContent>
|
|
<DialogHeader><DialogTitle>Delete permanently</DialogTitle></DialogHeader>
|
|
<DialogDescription>
|
|
{description}
|
|
</DialogDescription>
|
|
<DialogFooter>
|
|
<Button type="button" variant="outline" size="sm" onClick={() => onOpenChange(false)}>Cancel</Button>
|
|
<Button type="button" variant="destructive" size="sm" onClick={() => { onConfirm(); onOpenChange(false); }}>Delete</Button>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
}
|