// ATOM Center — Page: Contact const ContactPage = ({ lang, navigate }) => { const tr = (k) => t(lang, "contact." + k); const [submitted, setSubmitted] = useState(false); const [sending, setSending] = useState(false); const [error, setError] = useState(false); const [form, setForm] = useState({ name:"", email:"", company:"", role:"", audience:"corp", interest:"", message:"" }); const CONTACT_ENDPOINT = "https://formsubmit.co/ajax/contact@atom-center.com"; const onSubmit = async (e) => { e.preventDefault(); if (sending) return; setSending(true); setError(false); try { const res = await fetch(CONTACT_ENDPOINT, { method: "POST", headers: { "Content-Type": "application/json", "Accept": "application/json" }, body: JSON.stringify({ _subject: `[ATOM Center] ${form.audience === "corp" ? "Demande entreprise" : "Demande particulier"} — ${form.name}`, _template: "table", _captcha: "false", _replyto: form.email, Nom: form.name, Email: form.email, Entreprise: form.company || "—", Fonction: form.role || "—", Audience: form.audience === "corp" ? "Entreprise" : "Particulier", "Centre d'intérêt": form.interest || "—", Langue: lang.toUpperCase(), Message: form.message, }), }); const data = await res.json().catch(() => ({})); if (!res.ok || data.success === "false") throw new Error("send-failed"); setSubmitted(true); setForm({ name:"", email:"", company:"", role:"", audience:"corp", interest:"", message:"" }); setTimeout(() => setSubmitted(false), 6000); } catch (err) { setError(true); setTimeout(() => setError(false), 6000); } finally { setSending(false); } }; return ( <>
{t(lang,"nav.home")} / {tr("breadcrumb")}

{tr("titleA")} {tr("titleB")} {tr("titleC")}

{tr("sub")}

{tr("infoTitle")}

{tr("infoSub")}

{tr("addrLabel")}
{tr("addrValue")}
{tr("phoneLabel")}
{tr("phoneValue")}
{tr("waLabel")}
{tr("waValue")}
{tr("emailLabel")}
{tr("emailValue")}

{tr("formTitle")}

{tr("formSub")}

{submitted && (
✓ {lang === "fr" ? "Demande envoyée. Nous revenons vers vous sous 48h." : "Request sent. We will get back to you within 48h."}
)} {error && (
✕ {lang === "fr" ? "Échec de l'envoi. Réessayez ou écrivez à contact@atom-center.com." : "Sending failed. Please retry or email contact@atom-center.com."}
)}
setForm({...form, name:e.target.value})}/>
setForm({...form, email:e.target.value})}/>
setForm({...form, company:e.target.value})}/>
setForm({...form, role:e.target.value})}/>

{tr("fNote")}

); }; window.ContactPage = ContactPage;