// ============================================
// Hero — refined, centered, exclusive
// Flight search bar embedded directly under stats
// ============================================
const { useState, useEffect } = React;
const I = window.MS_I;
function Hero() {
const { useT, useMS } = window.MS_CTX;
const t = useT();
const ctx = useMS();
const heroImg = "assets/hero-sahara.jpg";
return (
{t('hero_eyebrow')}
{t('hero_hello')}
Marrakech
Story.
{t('hero_sub')}
14 {t('stat_years')}
2,400+ {t('stat_travellers')}
4.94★ {t('stat_review')}
24/7 {t('stat_concierge')}
{/* FlightHelpBox removed — ticket booking system disabled */}
);
}
const NORWAY_CITIES = ['Oslo', 'Bergen', 'Trondheim', 'Stavanger', 'Tromsø', 'Kristiansand', 'Fredrikstad', 'Drammen', 'Ålesund', 'Bodø'];
function FlightHelpBox() {
const { useMS, COMPANY } = window.MS_CTX;
const ctx = useMS();
const [open, setOpen] = useState(false);
const [sent, setSent] = useState(false);
const [fromCity, setFromCity] = useState('Oslo');
const [toCity, setToCity] = useState('Oslo');
const [dep, setDep] = useState(ctx.dates?.dep || '');
const [ret, setRet] = useState(ctx.dates?.ret || '');
const [people, setPeople] = useState(ctx.travellers?.adults || 2);
const label = ctx.lang === 'no' ? 'Trenger du hjelp med fly?'
: ctx.lang === 'fr' ? "Besoin d'aide pour le vol ?"
: 'Need help with flights?';
const syncContext = (d, r, p) => {
ctx.setDates({ dep: d, ret: r });
ctx.setTravellers({ adults: p, children: 0, infants: 0 });
window.MS_Flight_Data = { dep: d, ret: r, people: p, fromCity, toCity };
};
const send = () => {
syncContext(dep, ret, people);
const subj = encodeURIComponent(`Flyforslag – ${fromCity} → Marrakech`);
const body = encodeURIComponent(
`Hei Marrakech Story,\n\nJeg trenger hjelp med fly:\n\n` +
`✈ Utreise: ${fromCity} → Marrakech (RAK) ${dep}\n` +
`✈ Hjemreise: Marrakech (RAK) → ${toCity} ${ret}\n` +
`👥 Antall reisende: ${people} person${people > 1 ? 'er' : ''}\n\n` +
`Send meg gjerne de beste alternativene!\n`
);
window.location.href = `mailto:${COMPANY.email}?subject=${subj}&body=${body}`;
setSent(true);
};
if (!open) {
return (
);
}
return (
{label}
{ctx.lang === 'no'
? 'Fyll inn reisedetaljer – vi finner de beste avgangene og kobler dem til planen din.'
: ctx.lang === 'fr'
? 'Remplissez vos infos – nous trouvons les meilleures options de vol.'
: 'Fill in your details – we\'ll find the best flights and link them to your itinerary.'}
setOpen(false)} aria-label="Lukk">✕
{!sent ? (<>
>) : (
{ctx.lang === 'no'
? 'Takk! Vi sender deg flygingsforslag snart. Datoene er koblet til planen din.'
: 'Thanks! We\'ll send flight options shortly. Dates saved to your itinerary.'}
)}
);
}
window.MS_Hero = Hero;