/* Royal Yachts — yacht drawer + enquire modal + sales/legacy/footer */
const { useState: useStateD, useEffect: useEffectD, useMemo } = React;
/* ---------- Yacht drawer ---------- */
function YachtDrawer({ yacht, open, onClose, onEnquire, faved, onFave }) {
useEffectD(() => {
const onKey = (e) => { if (e.key === "Escape") onClose(); };
if (open) window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
}, [open, onClose]);
if (!yacht) return null;
return (
CHARTER YACHT
· DUBAI MARINA
onFave(yacht.id)}
aria-label="Shortlist"
>
{Icon.heart(faved)}
{yacht.builder} · {yacht.year}
{yacht.name}
{yacht.home}
Indicative spec · client to confirm
{yacht.summary.split(" — ")[0]} —
{yacht.summary}
Gallery
{yacht.gallery.map((src, i) => (
))}
Best fit
{yacht.fit.map((f) => (
{f}
))}
Onboard
{yacht.inclusions.map((inc, i) => (
{inc}
))}
Route ideas
Marina → Palm fountains → Burj Al Arab
Marina → World Islands → sunset return
Marina → Dubai Water Canal night-cruise
Charter rate · On request
WhatsApp
onEnquire({ yachtId: yacht.id, intent: "charter" })}>
Check availability
onEnquire({ yachtId: yacht.id, intent: "charter" })}>
Request a quote
);
}
/* ---------- Enquire modal ---------- */
function EnquireModal({ open, payload, onClose, onSubmit }) {
const [form, setForm] = useStateD({
name: "", phone: "", date: "", guests: "", message: "",
});
const [stage, setStage] = useStateD("form"); // form | success
const yacht = payload?.yachtId ? FLEET.find((y) => y.id === payload.yachtId) : null;
const intent = payload?.intent || "general";
useEffectD(() => {
if (open) {
setStage("form");
setForm({ name: "", phone: "", date: "", guests: "", message: yacht ? `I'd like to charter the ${yacht.name}.` : "" });
}
}, [open, payload]);
useEffectD(() => {
const onKey = (e) => { if (e.key === "Escape") onClose(); };
if (open) window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
}, [open, onClose]);
const submit = (e) => {
e.preventDefault();
setStage("success");
onSubmit && onSubmit(form, payload);
};
const waLink = useMemo(() => {
const text =
"Hi Royal Yachts — I'd like to enquire" +
(yacht ? ` about the ${yacht.name}` : "") +
(form.date ? `, on ${form.date}` : "") +
(form.guests ? `, ${form.guests} guests` : "") +
".";
return `https://wa.me/971502266906?text=${encodeURIComponent(text)}`;
}, [form, yacht]);
const titleByIntent = {
charter: "Reserve your day on the water",
experience: "Plan your experience",
destination: "Build the route",
sales: "Speak with the sales desk",
general: "Tell us what you'd like",
};
return (
e.stopPropagation()}>
{intent === "sales" ? "Sales · Ownership" : "Charter Enquiry"}
{stage === "form" ? titleByIntent[intent] : "We have you."}
{stage === "form" && (
{yacht ? `Quoting the ${yacht.name}. We'll route the date and crew within 24 hours.` : "We answer every enquiry within 24 hours. Office hours 09:00–17:00 GST."}
)}
{stage === "success" && (
One of the team will reply within 24 hours. For an instant route, open WhatsApp below.
)}
{stage === "form" && (
)}
{stage === "success" && (
Enquiry routed to the charter desk.
Ref RY-{Math.floor(Math.random() * 9000 + 1000)}
· {yacht ? yacht.name + " · " : ""}{form.date || "date TBC"}{form.guests ? " · " + form.guests + " guests" : ""}
)}
);
}
/* ---------- Sales band ---------- */
function SalesBand({ onEnquire }) {
return (
Half the firm
Beyond the charter — the lifecycle.
Half of Royal Yachts is a brokerage. We sell, build, manage, and co-own — whichever stage of the asset you're at, the same people who know the boat from the inside know the paperwork from the outside.
Brokerage Pre-owned & new yachts, Dubai and a curated Europe selection. No invented listings — by enquiry.
Build-a-yacht New-build commissioning with shipyards in Europe and the Gulf — to your specification.
Co-ownership Fractional programmes for owners who use the boat enough to want it, not enough to need all of it.
Management Operations, maintenance, crewing and charter-management for owners who'd rather not.
);
}
/* ---------- Legacy band ---------- */
function Legacy({ onEnquire, t }) {
return (
{t.legacyEyebrow}
{t.legacyTitle} {t.legacyTitleItalic}
{t.legacyBody}
Our team
onEnquire({ intent: "general" })}>Speak with us
);
}
/* ---------- Contact + Footer ---------- */
function Footer({ onEnquire }) {
return (
);
}
Object.assign(window, {
YachtDrawer, EnquireModal, SalesBand, Legacy, Footer
});