"use client"; import { useState } from "react"; import { useInView } from "@/hooks/use-in-view"; import { Button } from "@/components/ui/button"; import { Mail, Phone, MapPin, Zap, Check, AlertCircle, Loader2 } from "lucide-react"; const CONTACT_API = "https://email-relay.jeffemmett.com/contact"; export function ContactSection() { const { ref, isInView } = useInView(0.1); const [status, setStatus] = useState<"idle" | "sending" | "sent" | "error">("idle"); const [errorMsg, setErrorMsg] = useState(""); async function handleSubmit(e: React.FormEvent) { e.preventDefault(); setStatus("sending"); setErrorMsg(""); const form = e.currentTarget; const data = new FormData(form); try { const res = await fetch(CONTACT_API, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ name: data.get("name"), email: data.get("email"), subject: "PortaPower Event Inquiry", message: data.get("message") || "", fields: { "Festival / Event": data.get("festival") || "Not specified", "Expected Attendance": data.get("attendees") || "Not specified", }, }), }); if (res.ok) { setStatus("sent"); form.reset(); } else { const body = await res.json().catch(() => ({})); setErrorMsg(body.error || "Something went wrong. Please try again."); setStatus("error"); } } catch { setErrorMsg("Network error. Please check your connection and try again."); setStatus("error"); } } return (

Ready to Power Up?

Get in touch to learn how we can power your next event sustainably.

{/* Contact form */}
{status === "sent" ? (

Message Sent!

Thanks for reaching out. We'll get back to you shortly.

) : (