/* contact.jsx — Simple single-step contact form (dark, bilingual) */ const { useState: cUseState, useEffect: cUseEffect } = React; function ContactPage({ onNavigate }) { const { t, lang } = useLang(); const [submitted, setSubmitted] = cUseState(false); const [form, setForm] = cUseState({ firstName: '', lastName: '', company: '', email: '', phone: '', interest: '', message: '', }); const update = (k, v) => setForm(f => ({ ...f, [k]: v })); const [sending, setSending] = cUseState(false); const [error, setError] = cUseState(''); const canSubmit = form.firstName.trim() && form.lastName.trim() && form.company.trim() && /\S+@\S+\.\S+/.test(form.email); const submit = async (e) => { e.preventDefault(); if (!canSubmit || sending) return; setSending(true); setError(''); const subject = `New project inquiry — ${form.firstName} ${form.lastName}` + (form.company ? ` (${form.company})` : ''); const payload = { access_key: '6d875049-e9c3-4d7d-be07-bc1064a75c8d', subject, from_name: `${form.firstName} ${form.lastName}`, // Web3Forms uses `email` as the reply-to address email: form.email, cc: 'seanclark@jmcrealities.com', 'Full name': `${form.firstName} ${form.lastName}`, Company: form.company, Email: form.email, Phone: form.phone || '—', 'Interested in': form.interest || '—', Project: form.message.trim() || '(not specified)', }; try { const res = await fetch('https://api.web3forms.com/submit', { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json' }, body: JSON.stringify(payload), }); const data = await res.json(); if (data.success) { setSubmitted(true); window.scrollTo({ top: 0, behavior: 'smooth' }); } else { setError(lang === 'es' ? 'No pudimos enviar el mensaje. Escribinos a contact@jmcrealities.com.' : 'We couldn\'t send your message. Please email contact@jmcrealities.com.'); } } catch (err) { setError(lang === 'es' ? 'No pudimos enviar el mensaje. Escribinos a contact@jmcrealities.com.' : 'We couldn\'t send your message. Please email contact@jmcrealities.com.'); } finally { setSending(false); } }; if (submitted) { return { setSubmitted(false); setForm({ firstName: '', lastName: '', company: '', email: '', phone: '', interest: '', message: '' }); }} />; } const F = t.contact.form; return (
{/* Hero */}
{t.contact.hero.eyebrow}

{t.contact.hero.title}

{t.contact.hero.sub}

{/* Form */}
{/* Left rail */}
{F.title}

{lang === 'es' ? 'Algunos datos y empezamos a conversar.' : 'A few details and we\'ll be in touch.'}

{lang === 'es' ? 'No spam, sin newsletter, sin formularios infinitos. Solo una respuesta personal en un día hábil.' : 'No spam, no newsletter, no infinite forms. Just a personal reply within one business day.'}

{/* Form */}
update('firstName', e.target.value)} />
update('lastName', e.target.value)} />
update('email', e.target.value)} />
update('phone', e.target.value)} />
update('company', e.target.value)} />
{F.interestOptions.map(opt => { const active = form.interest === opt; return ( ); })}