// R-P7 (P7 Lead-Inbox) Interim-UI (AD-28) — manual lead entry (D-P7 "Manueller // Lead-Eintrag", archetype A4), composed from ~/ui. Pure: holds the form draft and // calls actions.onCreate; the route POSTs it. No useLoaderData. Final Subframe // optics = tracked design-nachzug. import { useState } from "react"; import { useTranslation } from "react-i18next"; import type { LeadQuelle } from "~/utils/integrations/leads/leadListQuery"; import { BadgeFeedback } from "~/ui/components/BadgeFeedback"; import { Button } from "~/ui/components/Button"; import { Card } from "~/ui/components/Card"; import { Select } from "~/ui/components/Select"; import { TextArea } from "~/ui/components/TextArea"; import { TextInput } from "~/ui/components/TextInput"; const QUELLEN: readonly LeadQuelle[] = ["form", "email", "aircall", "manual", "custom"]; export type LeadNewFields = { quelle: string; vorname: string; nachname: string; email: string; telefon: string; message: string }; export type LeadNewPageActions = { onCreate: (fields: LeadNewFields) => void }; export type LeadNewPageProps = { backHref: string; submitting: boolean; errorKey?: string | null; actions: LeadNewPageActions; }; export function LeadNewPage(props: LeadNewPageProps) { const { t } = useTranslation(); const [fields, setFields] = useState({ quelle: "manual", vorname: "", nachname: "", email: "", telefon: "", message: "" }); const set = (patch: Partial) => setFields((s) => ({ ...s, ...patch })); const hasIdentity = Boolean(fields.vorname.trim() || fields.nachname.trim() || fields.email.trim() || fields.telefon.trim() || fields.message.trim()); return (
{t("leads.new.title")} {props.errorKey ? (
{t(props.errorKey)}
) : null}
set({ vorname: e.target.value })} data-ui-id="ui.leads.new.vorname" /> set({ nachname: e.target.value })} /> set({ email: e.target.value })} data-ui-id="ui.leads.new.email" /> set({ telefon: e.target.value })} />
); } export default LeadNewPage;