// Contact page with working form + validation const ContactPage = ({ showToast }) => { useLucide(); const [form, setForm] = React.useState({ name: '', email: '', phone: '', intent: 'buying', message: '', contactBy: 'email', }); const [err, setErr] = React.useState({}); const [sent, setSent] = React.useState(false); const [sending, setSending] = React.useState(false); const submit = async (e) => { e.preventDefault(); const next = {}; if (!form.name.trim()) next.name = 'Please tell me your name'; if (!form.email.includes('@') || form.email.length < 5) next.email = 'A real email please'; if (!form.message.trim() || form.message.length < 10) next.message = 'A bit more context helps — even one line'; setErr(next); if (Object.keys(next).length !== 0) return; setSending(true); const ok = await window.sendLead({ subject: `New contact enquiry (${form.intent}) — ${form.name}`, replyTo: form.email, fields: { Name: form.name, Email: form.email, Phone: form.phone || '—', Interested_in: form.intent, Preferred_contact: form.contactBy, Message: form.message, }, }); setSending(false); if (ok) { setSent(true); showToast("Sent — I'll reply within 24 hours. Thank you."); setForm({ name: '', email: '', phone: '', intent: 'buying', message: '', contactBy: 'email' }); setTimeout(() => setSent(false), 6000); } else { showToast(`Couldn't send just now — please email me at ${SITE_DATA.agent.email} or call ${SITE_DATA.agent.phone}.`); } }; return (
Contact

Let's start a conversation.

The form goes straight to my inbox. For anything urgent, the phone is faster — I usually answer between 8am and 8pm.

{/* Form */}
{sent ? (

Message sent.

I'll get back to you within 24 hours.

) : (
setForm({ ...form, name: e.target.value })} placeholder="Full name" /> {err.name &&
{err.name}
}
setForm({ ...form, phone: e.target.value })} placeholder="(604) 000-0000" />
setForm({ ...form, email: e.target.value })} placeholder="you@example.com" /> {err.email &&
{err.email}
}
{[ { id: 'buying', label: 'Buying' }, { id: 'selling', label: 'Selling' }, { id: 'investing', label: 'Investing' }, { id: 'rental', label: 'Renting / managing' }, { id: 'valuation', label: 'Home valuation' }, { id: 'other', label: 'Just curious' }, ].map(o => ( ))}