"use client"; import { useRef } from "react"; import { Button, type buttonVariants } from "@/components/ui/button"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, } from "@/components/ui/alert-dialog"; import type { VariantProps } from "class-variance-authority"; /** Submits the form this button lives in — used inside the (portaled) AlertDialogAction, which isn't a DOM descendant of that form, so `type="submit"` alone wouldn't reach it. */ export function ConfirmButton({ confirmText, label, triggerLabel, variant = "destructive", }: { confirmText: string; label: string; triggerLabel?: string; variant?: VariantProps["variant"]; }) { const triggerRef = useRef(null); return ( Emin misin? {confirmText} Vazgeç triggerRef.current?.closest("form")?.requestSubmit()} > {label} ); }