lead-to-policy/src/screens/NewLeadScreen.tsx
2026-06-23 11:20:31 +05:30

28 lines
821 B
TypeScript

import { useNavigate } from 'react-router-dom';
import { Card } from '../components';
import { ActivityForm } from '../components/form';
import { useLeads } from '../api/leads';
import { ACTIVITY_META } from '../api/forms';
/** Capture Lead — the INIT activity. Creates a new instance via /start. */
export function NewLeadScreen() {
const navigate = useNavigate();
const { refetch } = useLeads();
return (
<div className="max-w-[820px] mx-auto">
<Card title="New lead">
<ActivityForm
meta={ACTIVITY_META.capture}
successMessage="Lead created — opening the lead…"
onSuccess={(res) => {
refetch();
const id = res.instance_id;
if (id != null) navigate(`/leads/${id}`);
}}
/>
</Card>
</div>
);
}