"use client"; import Script from "next/script"; import { useActionState, useEffect, useRef } from "react"; import { sendContact, type ContactState } from "@/app/contact/actions"; import { CONTACT_EMAIL, serviceNav } from "@/lib/routes"; const interests = [...serviceNav.map((s) => s.name), "Not sure yet"]; const initial: ContactState = { status: "idle" }; // Cloudflare Turnstile renders only once a site key is configured. const TURNSTILE_SITE_KEY = process.env.NEXT_PUBLIC_TURNSTILE_SITE_KEY; declare global { interface Window { turnstile?: { reset: (el?: Element | string) => void }; } } export default function ContactForm() { const [state, action, pending] = useActionState(sendContact, initial); const startedRef = useRef(null); // When the visitor started filling the form; the server rejects instant (bot) submissions. useEffect(() => { if (startedRef.current && !startedRef.current.value) startedRef.current.value = String(Date.now()); }, []); // A Turnstile token is single-use, so get a fresh one after a failed attempt. useEffect(() => { if (state.status === "error") window.turnstile?.reset(); }, [state]); if (state.status === "sent") { return (

Your message was sent successfully.

Thank you for reaching out. Our team will review what you shared and get back to you shortly.

); } return (
{/* Honeypot for bots — hidden from people and assistive tech. */}
What are you looking at?
{interests.map((i) => ( ))}