"use client"; import { useRef } from "react"; import type { PictureKind } from "@/lib/picture"; import type { CheckinGroup } from "@/lib/validations/checkin-details"; import { CHECK_IN_GROUP_HEADINGS, CheckinDetailsForm, } from "@/components/checkin/checkin-details-form"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "@/components/ui/dialog"; import { UserFieldsSubmitButton } from "@/components/user/user-fields-form"; export interface CheckinDetailsDialogProps { open: boolean; onOpenChange: (open: boolean) => void; group: CheckinGroup; /** The sheet's About You, which edits the name beside the object's members. */ withName?: boolean; /** The portrait, edited beside the fields and saved with them. */ picture?: PictureKind; } /** * One check-in group in a dialog: what `/checkin` opens over the summary so a group can * be filled in beside the sheet that prints it, and what the bell opens for a policy. * * No state of its own - `DialogPortal` unmounts the content when the dialog closes, * so each open builds a fresh form and seeds it from the shared copy. */ export function CheckinDetailsDialog({ open, onOpenChange, group, withName, picture, }: CheckinDetailsDialogProps) { const panel = useRef(null); const { title, description } = CHECK_IN_GROUP_HEADINGS[group]; return ( {title} {description} onOpenChange(false)} > ); }