"use client"; import { useState } from "react"; import { ArrowRight } from "lucide-react"; import { BrandLogo } from "@/components/brand/BrandLogo"; import { DataConsentField } from "@/components/forms/DataConsentField"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Label } from "@/components/ui/label"; import { dataConsent } from "@/content/consent"; export function FooterNewsletter() { const [status, setStatus] = useState<"idle" | "loading" | "done" | "error">("idle"); const [consent, setConsent] = useState(false); const [error, setError] = useState(""); async function submit(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: "newsletter", firstName: data.get("firstName"), lastName: data.get("lastName"), email: data.get("email"), message: "Footer newsletter signup", consent: true, }), }); const json = await res.json(); if (!res.ok || !json.ok) { throw new Error(json.error || "Something went wrong"); } setStatus("done"); form.reset(); setConsent(false); } catch (err) { setStatus("error"); setError(err instanceof Error ? err.message : "Something went wrong. Please try again."); } } return (

Stay up to date!

Get announcements about tickets, lineup, and the next Great Rift Valley Innovation Summit edition before anyone else.

{error &&

{error}

} {status === "done" && (

You're on the list — thank you!

)}
); }