// 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 (
{lang === "pl" ? "ul. Długa 43/6, 31-047 Kraków. Parking publiczny przy sąsiednich ulicach — 120 zł / dzień." : "Długa 43/6, 31-047 Kraków. Public parking on neighbouring streets — 120 PLN per day."}
{lang === "pl" ? "Otwórz w mapach" : "Open in maps"}