diff --git a/apps/web/src/features/applications/components/application-detail-sheet.tsx b/apps/web/src/features/applications/components/application-detail-sheet.tsx index 5c3b2969e..47d98e3a8 100644 --- a/apps/web/src/features/applications/components/application-detail-sheet.tsx +++ b/apps/web/src/features/applications/components/application-detail-sheet.tsx @@ -14,7 +14,7 @@ import { import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { Link } from "@tanstack/react-router"; import { useState } from "react"; -import { STAGES } from "@reactive-resume/schema/applications/data"; +import { contactSchema, STAGES } from "@reactive-resume/schema/applications/data"; import { Button } from "@reactive-resume/ui/components/button"; import { Dialog, @@ -55,6 +55,8 @@ const currentStageAnchorId = (activity: ApplicationTimelineEntry[], status: Appl const latestStageDate = (activity: ApplicationTimelineEntry[], status: ApplicationStatus) => [...activity].sort(byNewest).find((entry) => entry.type === "stage" && entry.stage === status)?.at; +const INITIAL_CONTACT_DRAFT = { name: "", role: "", type: "", email: "", phone: "" }; + type Props = { application: Application | null; onOpenChange: (open: boolean) => void; @@ -553,22 +555,35 @@ type ContactsEditorProps = { function ContactsEditor({ contacts, pending, onChange }: ContactsEditorProps) { const [adding, setAdding] = useState(false); - const [draft, setDraft] = useState({ name: "", role: "", type: "" }); + const [draft, setDraft] = useState(INITIAL_CONTACT_DRAFT); + const [error, setError] = useState(""); const reset = () => { - setDraft({ name: "", role: "", type: "" }); + setDraft(INITIAL_CONTACT_DRAFT); + setError(""); setAdding(false); }; + // The inputs aren't in a