import { useCallback } from "react"; import { AlertDialog, AlertDialogAction, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog.js"; import { cn } from "@/components/lib/utils.js"; import { useZCodeIntl } from "@/i18n/IntlProvider.js"; import { useAlertDialogStore } from "@/store/alertDialogStore.js"; export function AlertDialogHost() { const { intl } = useZCodeIntl(); const pendingRequest = useAlertDialogStore((state) => state.pendingRequest); const settleAlert = useAlertDialogStore((state) => state.settleAlert); const handleOpenChange = useCallback( (nextOpen: boolean) => { if (!nextOpen) { settleAlert(false); } }, [settleAlert], ); return ( {pendingRequest?.title} {pendingRequest?.description ? ( {pendingRequest.description} ) : null} settleAlert(true)} size="lg" className={cn("h-9 justify-between gap-3 sm:min-w-32")} > {pendingRequest?.actionLabel ?? intl.formatMessage({ id: "common.confirm" })} ⏎ ); }