// pages/contact.jsx — Contact with form, embedded OpenStreetMap, info function ContactPage() { const { t, lang } = useApp(); const [form, setForm] = useState({ name: "", email: "", topic: t.contact.form.topics[0], message: "" }); const [sent, setSent] = useState(false); const [error, setError] = useState(null); const [submitting, setSubmitting] = useState(false); const update = (k, v) => setForm((f) => ({ ...f, [k]: v })); const submit = async (e) => { e.preventDefault(); setError(null); setSubmitting(true); try { const r = await fetch(`${window.API_BASE}/api/contact`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(form), }); if (!r.ok) throw new Error(await r.text()); track("contact_form_submit", { topic: form.topic }); setSent(true); setTimeout(() => setSent(false), 6000); setForm({ name: "", email: "", topic: t.contact.form.topics[0], message: "" }); } catch (err) { setError(lang === "pl" ? "Nie udalo sie wyslac wiadomosci. Sprobuj ponownie." : "Could not send the message. Please try again."); } finally { setSubmitting(false); } }; return (
{t.contact.eyebrow}

{t.contact.title_a}
{t.contact.title_b}

{t.contact.body}

update("name", e.target.value)} required />
update("email", e.target.value)} required />