import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog" import { useToast } from "@/components/ui/use-toast" import { deleteLearner } from "@/lib/api" import { LearnerOut } from "@/types/learner" interface DeleteLearnerDialogProps { learner: LearnerOut open: boolean onOpenChange: (open: boolean) => void onSuccess?: () => void } export function DeleteLearnerDialog({ learner, open, onOpenChange, onSuccess, }: DeleteLearnerDialogProps) { const { toast } = useToast() async function handleDelete() { try { await deleteLearner(learner.id) toast({ title: "Success", description: "Learner deleted successfully", }) onOpenChange(false) onSuccess?.() } catch (error) { toast({ title: "Error", description: "Failed to delete learner", variant: "destructive", }) } } return ( Are you sure? This will permanently delete {learner.name}'s record. This action cannot be undone. Cancel Delete ) }