// 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."} )} {tr("fName")} setForm({...form, name:e.target.value})}/> {tr("fEmail")} setForm({...form, email:e.target.value})}/> {tr("fCompany")} setForm({...form, company:e.target.value})}/> {tr("fRole")} setForm({...form, role:e.target.value})}/> {tr("fAudience")} setForm({...form, audience:e.target.value})}> {tr("fAudOptCorp")} {tr("fAudOptInd")} {tr("fInterest")} setForm({...form, interest:e.target.value})}> {tr("fInterestOpt")} {tr("fInterestLang")} {tr("fInterestOffice")} {tr("fInterestMgmt")} {tr("fInterestAudit")} {tr("fMessage")} setForm({...form, message:e.target.value})}> {sending ? (lang === "fr" ? "Envoi en cours…" : "Sending…") : tr("fSubmit")} {tr("fNote")} > ); }; window.ContactPage = ContactPage;
{tr("sub")}
{tr("infoSub")}
{tr("formSub")}
{tr("fNote")}