// R-P7 Interim-UI (AD-28) — "Neuer Lead" as a modal on the lead inbox, mirroring // the automation list pattern ("Neue Automation starten"). Presentational only: the // form posts to the create route (`createHref`) with the same field contract as the // standalone LeadNewPage, so the route action stays untouched. No useLoaderData / // useFetcher (DoD A.5). Final Subframe optics = tracked design-nachzug. import { useState } from "react"; import { useTranslation } from "react-i18next"; import { FeatherPlus, FeatherX } from "@subframe/core"; import type { LeadQuelle } from "~/utils/integrations/leads/leadListQuery"; import { Button } from "~/ui/components/Button"; import { Dialog } from "~/ui/components/Dialog"; import { IconButton } from "~/ui/components/IconButton"; 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 LeadNewDialogProps = { open: boolean; onOpenChange: (open: boolean) => void; /** Route that owns the create action (the standalone /leads/new route). */ createHref: string; }; export function LeadNewDialog({ open, onOpenChange, createHref }: LeadNewDialogProps) { const { t } = useTranslation(); const [quelle, setQuelle] = useState("manual"); // A lead needs at least one identifying detail — same rule as the standalone page. const [hasIdentity, setHasIdentity] = useState(false); function checkIdentity(event: React.FormEvent) { const form = event.currentTarget; const filled = ["vorname", "nachname", "email", "telefon", "message"].some((name) => { const field = form.elements.namedItem(name); return field instanceof HTMLInputElement || field instanceof HTMLTextAreaElement ? field.value.trim().length > 0 : false; }); setHasIdentity(filled); } return (
{t("leads.new.title")} {t("leads.new.subtitle")}
} aria-label={t("shared.cancel")} onClick={() => onOpenChange(false)} />
); }