/* modals.jsx — enquire / request-price / book-viewing flow */ const { useState: useStateM, useEffect: useEffectM } = React; const INTENT_LABELS = { enquire: { title: "Enquire", sub: "Tell us what you're looking for. We'll respond within 4 working hours." }, price: { title: "Request price", sub: "Prices are shared privately. We'll be in touch shortly with figures and current availability." }, viewing: { title: "Book a private viewing", sub: "Schedule a one-to-one at our Sheikh Zayed Road showroom." }, tradein: { title: "Sell or trade-in your car", sub: "Send us the details and photos. We'll come back with an indicative offer." }, export: { title: "Export enquiry", sub: "International buyer? We'll outline logistics — pending confirmation of our export service." }, }; function Modal({ open, onClose, intent = "enquire", vehicle = null }) { const [step, setStep] = useStateM(0); const [form, setForm] = useStateM({ name: "", email: "", phone: "", country: "United Arab Emirates", when: "", message: "", sellMake: "", sellModel: "", sellYear: "", }); const meta = INTENT_LABELS[intent] || INTENT_LABELS.enquire; useEffectM(() => { if (open) setStep(0); }, [open, intent]); useEffectM(() => { if (!open) return; document.body.style.overflow = "hidden"; const onKey = (e) => { if (e.key === "Escape") onClose(); }; window.addEventListener("keydown", onKey); return () => { document.body.style.overflow = ""; window.removeEventListener("keydown", onKey); }; }, [open, onClose]); if (!open) return null; const setF = (k) => (e) => setForm({ ...form, [k]: e.target.value }); const slots = [ "Tomorrow · 14:00", "Tomorrow · 16:30", "Sat · 11:00", "Sat · 15:00", "Sun · 12:30", "Mon · 18:00", ]; return (
Your {meta.title.toLowerCase()} is logged. A specialist will be in touch via {form.email || "email"} and {form.phone || "phone"}. {intent === "viewing" && form.when && <> Your slot is held for {form.when}.>}