"use client"; import { useState } from "react"; import { Rocket } from "lucide-react"; import { championStartupCopy } from "@/content/partners"; import { Button } from "@/components/ui/button"; import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger, } from "@/components/ui/dialog"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { Textarea } from "@/components/ui/textarea"; import { DataConsentField } from "@/components/forms/DataConsentField"; import { dataConsent } from "@/content/consent"; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@/components/ui/select"; const sectors = ["Agriculture", "Healthcare", "Education", "Other"]; export function ChampionStartupModal() { const [open, setOpen] = useState(false); const [status, setStatus] = useState<"idle" | "loading" | "success" | "error">("idle"); const [error, setError] = useState(""); const [consent, setConsent] = useState(false); const [sector, setSector] = useState(""); async function onSubmit(e: React.FormEvent) { e.preventDefault(); if (!consent) { setError(dataConsent.errorMessage); return; } setStatus("loading"); setError(""); const form = e.currentTarget; const data = new FormData(form); try { const res = await fetch("/api/inquiry", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ intent: "startup_referral", name: data.get("name"), email: data.get("email"), startupName: data.get("startupName"), startupWebsite: data.get("startupWebsite") || undefined, startupSector: sector || undefined, whyRecommend: data.get("whyRecommend"), consent: true, }), }); const json = await res.json(); if (!res.ok || !json.ok) { throw new Error(json.error || "Something went wrong"); } setStatus("success"); form.reset(); setConsent(false); setSector(""); setTimeout(() => { setOpen(false); setStatus("idle"); }, 2500); } catch (err) { setStatus("error"); setError(err instanceof Error ? err.message : "Failed to send"); } } return ( {championStartupCopy.title} {championStartupCopy.intro}

{championStartupCopy.disclaimer}