/* Maison Silya — Contact / Enquiry. Formspree endpoint: mbdeezyg The calm close of the house: a confident invitation on the left, the correspondence on the right, presented like writing to a private studio. */ const MS_FORMSPREE = 'https://formspree.io/f/mbdeezyg'; function ContactScreen() { const [status, setStatus] = React.useState('idle'); // idle | sending | sent | error const formRef = React.useRef(null); // Order pre-fill: captured when arriving from a piece enquiry / Tufted order const [order] = React.useState(() => window.__MS_ORDER || null); React.useEffect(() => { window.__MS_ORDER = null; }, []); const lang = window.__MS_LANG || 'en'; const L = (fr, en) => (lang === 'fr' ? fr : en); const isEnquiry = order && order.kind === 'enquiry'; let orderMessage = ''; if (order) { if (lang === 'fr') { orderMessage = isEnquiry ? `Bonjour, je souhaite en savoir plus sur la pi\u00e8ce « ${order.piece} »${order.size ? ` (${order.size})` : ''}.\n\nMerci de me recontacter pour \u00e9changer sur cette pi\u00e8ce et ses possibilit\u00e9s.` : `Bonjour, je souhaite commander la pi\u00e8ce « ${order.piece} ».\n\nTaille : ${order.size}\nMati\u00e8re : ${order.mat}\n\nMerci de me recontacter pour finaliser la commande.`; } else { orderMessage = isEnquiry ? `Hello, I would like to know more about the piece “${order.piece}”${order.size ? ` (${order.size})` : ''}.\n\nPlease contact me to discuss this piece and its possibilities.` : `Hello, I would like to order the piece “${order.piece}”.\n\nSize: ${order.size}\nMaterial: ${order.mat}\n\nPlease contact me to finalise the order.`; } } async function handleSubmit(e) { e.preventDefault(); setStatus('sending'); const data = new FormData(formRef.current); data.append('_language', window.__MS_LANG || 'en'); data.append('_next', 'false'); try { const res = await fetch(MS_FORMSPREE, { method: 'POST', body: data, headers: { Accept: 'application/json' } }); setStatus(res.ok ? 'sent' : 'error'); } catch (_) { setStatus('error'); } } const sending = status === 'sending'; return (
{t('ct.lede')}
{t('ct.thanks_d')}