import { useState } from "react"; import { Text } from "@/components/ui/text"; import { SignaturePad } from "@/app/v/_components/signature-pad"; import { vendorPortalApi } from "@/domain/vendor-portal/api/vendor-portal-api"; import { formatVendorPortalDateTime } from "@/domain/vendor-portal/lib/status-helpers"; import type { VendorPortalSignoff } from "@/domain/vendor-portal/types/vendor-portal"; type SignoffSectionProps = { token: string; dispatchId: number; existing: VendorPortalSignoff[]; signoffType: string; nameLabel: string; onAdded: () => void; }; export function SignoffSection({ token, dispatchId, existing, signoffType, nameLabel, onAdded, }: SignoffSectionProps) { const [name, setName] = useState(""); const [method, setMethod] = useState<"drawn" | "typed">("drawn"); const [typedSig, setTypedSig] = useState(""); const [drawnSig, setDrawnSig] = useState(""); const [submitting, setSubmitting] = useState(false); const [errorMessage, setErrorMessage] = useState(""); const existingSignoff = existing.find((signoff) => signoff.signoffType === signoffType); if (existingSignoff) { return (