gitdataai/src/components/room/DeleteRoomAlert.tsx
2026-04-15 09:08:09 +08:00

61 lines
1.7 KiB
TypeScript

import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from '@/components/ui/alert-dialog';
import { AlertTriangle, Loader2 } from 'lucide-react';
interface DeleteRoomAlertProps {
open: boolean;
onOpenChange: (open: boolean) => void;
roomName: string;
onConfirm: () => void;
isPending: boolean;
}
export function DeleteRoomAlert({
open,
onOpenChange,
roomName,
onConfirm,
isPending,
}: DeleteRoomAlertProps) {
return (
<AlertDialog open={open} onOpenChange={onOpenChange}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle className="flex items-center gap-2">
<AlertTriangle className="h-5 w-5 text-destructive" />
Delete room
</AlertDialogTitle>
<AlertDialogDescription>
Are you sure you want to delete &quot;{roomName}&quot;? All messages will be permanently removed.
This cannot be undone.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel disabled={isPending}>Cancel</AlertDialogCancel>
<AlertDialogAction
onClick={onConfirm}
disabled={isPending}
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
>
{isPending ? (
<>
<Loader2 className="mr-2 h-4 w-4 animate-spin" /> Deleting...
</>
) : (
'Delete'
)}
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
);
}