"use client"; import { Button } from "@openstatus/ui/components/ui/button"; import { useState } from "react"; import { FormCard, FormCardGroup } from "@/components/forms/form-card"; import { FormSheetContent, FormSheetDescription, FormSheetFooter, FormSheetHeader, FormSheetTitle, FormSheetTrigger, FormSheetWithDirtyProtection, } from "@/components/forms/form-sheet"; import { FormStatusReportUpdate, type FormValues, } from "@/components/forms/status-report-update/form"; export function FormSheetStatusReportUpdate({ children, defaultValues, onSubmit, components, allowUnsetImpacts, open: controlledOpen, onOpenChange, }: Omit, "onSubmit"> & { defaultValues?: Partial; onSubmit: (values: FormValues) => Promise; components?: { id: number; name: string }[]; allowUnsetImpacts?: boolean; open?: boolean; onOpenChange?: (open: boolean) => void; }) { const [internalOpen, setInternalOpen] = useState(false); const isControlled = controlledOpen !== undefined; const open = isControlled ? controlledOpen : internalOpen; const setOpen = (next: boolean) => { if (isControlled) { onOpenChange?.(next); } else { setInternalOpen(next); } }; return ( {children ? ( {children} ) : null} Status Report Update Configure and update the status of your report. { await onSubmit(values); setOpen(false); }} defaultValues={defaultValues} components={components} allowUnsetImpacts={allowUnsetImpacts} /> ); }