mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-06-12 01:37:51 +02:00
77 lines
2.0 KiB
TypeScript
77 lines
2.0 KiB
TypeScript
"use client";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
import {
|
|
Dialog,
|
|
DialogContent,
|
|
DialogDescription,
|
|
DialogFooter,
|
|
DialogHeader,
|
|
DialogTitle,
|
|
} from "@/components/ui/dialog";
|
|
|
|
interface DeleteConfirmationDialogProps {
|
|
isOpen: boolean;
|
|
onClose: () => void;
|
|
onConfirm: () => void | Promise<void>;
|
|
title: string;
|
|
description: string;
|
|
confirmButtonText?: string;
|
|
isLoading?: boolean;
|
|
profileNames?: string[];
|
|
}
|
|
|
|
export function DeleteConfirmationDialog({
|
|
isOpen,
|
|
onClose,
|
|
onConfirm,
|
|
title,
|
|
description,
|
|
confirmButtonText = "Delete",
|
|
isLoading = false,
|
|
profileNames,
|
|
}: DeleteConfirmationDialogProps) {
|
|
const handleConfirm = async () => {
|
|
await onConfirm();
|
|
};
|
|
|
|
return (
|
|
<Dialog open={isOpen} onOpenChange={onClose}>
|
|
<DialogContent>
|
|
<DialogHeader>
|
|
<DialogTitle>{title}</DialogTitle>
|
|
<DialogDescription>{description}</DialogDescription>
|
|
{profileNames && profileNames.length > 0 && (
|
|
<div className="mt-4">
|
|
<p className="text-sm font-medium mb-2">
|
|
Profiles to be deleted:
|
|
</p>
|
|
<div className="bg-muted rounded-md p-3 max-h-32 overflow-y-auto">
|
|
<ul className="space-y-1">
|
|
{profileNames.map((name) => (
|
|
<li key={name} className="text-sm text-muted-foreground">
|
|
• {name}
|
|
</li>
|
|
))}
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
)}
|
|
</DialogHeader>
|
|
<DialogFooter>
|
|
<Button variant="outline" onClick={onClose} disabled={isLoading}>
|
|
Cancel
|
|
</Button>
|
|
<Button
|
|
variant="destructive"
|
|
onClick={() => void handleConfirm()}
|
|
disabled={isLoading}
|
|
>
|
|
{isLoading ? "Deleting..." : confirmButtonText}
|
|
</Button>
|
|
</DialogFooter>
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
}
|