/* 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 (
{ if (e.target === e.currentTarget) onClose(); }}>
{/* Header */}
{step === 0 ? "Step 01 of 02" : "Step 02 of 02 · Confirmation"}

{meta.title}

{vehicle && (
Re: {vehicle.year} {vehicle.brand} {vehicle.model}
)}
{step === 0 && (
{ e.preventDefault(); setStep(1); }} style={{ padding: "24px 36px 36px" }}>

{meta.sub}

{intent === "viewing" && (
Pick a time
{slots.map((s) => ( ))}
Slots illustrative · real calendar in production
)} {intent === "tradein" && (
)}