'use client' import { startTransition, useState, type FormEvent } from 'react' import { PhonesFieldEditor } from '@/components/campaign/shared/PhonesFieldEditor' import { FieldError, FieldLabel } from '@/components/ui/field' import { Input } from '@/components/ui/input' import { CitiesByState } from '@/lib/cities' import type { CampaignFormActionState } from '@/utilities/campaignFormActionError' import { errorProps } from '@/utilities/campaignFormFields' import { contactGenderLabels } from '@/utilities/contacts/contactListUrl' export type ContactFormDefaults = { name: string email: string phones: string[] gender: string state: string city: string postalCode: string } const stateOptions = Object.keys(CitiesByState) /** * C139 — the mobile sheet's ficha form (edit and create share it; the create * sheet passes empty defaults). Full-bleed fields with dividers; phones use * `PhonesFieldEditor` in FORM mode (no `saveAction`), so the repeated `phones` * inputs are collected by the enclosing form. Field errors come from the * ladder's `fieldErrors` (name/email/phones/gender/state/city/postalCode); * top-level ladder messages (name conflict, out of scope) render as a banner. * * The fields are CONTROLLED and the submit goes through a manual `onSubmit` * dispatch instead of `