import type { ReactNode } from "react"; import { Modal, Group, Stack, Text, Box, Button, Textarea, FileInput, } from "@mantine/core"; import type { BookingActionDef } from "@/features/bookings/booking-actions.config"; interface BookingConfirmDialogProps { open: boolean; onOpenChange: (open: boolean) => void; action: BookingActionDef | null; reference?: string; inputValue: string; onInputChange: (value: string) => void; selectedFile?: File | null; onFileChange?: (file: File | null) => void; onConfirm: () => void; isPending: boolean; confirmDisabled?: boolean; extra?: ReactNode; } export function BookingConfirmDialog({ open, onOpenChange, action, reference, inputValue, onInputChange, selectedFile = null, onFileChange, onConfirm, isPending, confirmDisabled = false, extra, }: BookingConfirmDialogProps) { if (!action || !action.confirmTitle) return null; const Icon = action.icon; const needsTextInput = action.input === "note" || action.input === "reason"; const needsFileInput = action.input === "file"; const inputMissing = (needsTextInput && !inputValue.trim()) || (needsFileInput && !selectedFile); const isDestructive = action.variant === "destructive"; const accent = isDestructive ? "red" : "edr-green"; return ( onOpenChange(false)} withCloseButton={false} centered radius="md" size="md" padding={0} title={null} > {/* Header */} {action.confirmTitle} {reference && ( {reference} )} {action.confirmDescription && ( {action.confirmDescription} )} {/* Body */} {needsTextInput && (