// aerOS Guest v3 — Home: hero + outlet selection + services grid + announcement (v2 themed).
const { useState: _h3S, useEffect: _h3E } = React;
const OUTLET_ICON3 = { restaurant: 'utensils', lobby: 'wine', pool: 'spa', cafe: 'coffee' };
function G3Home({ C, t, lang, tw, onOutlet, onService, onLang, onSettings }) {
const D = window.G2DATA;
const [announce, setAnnounce] = _h3S(true);
const head = G2THEME.headFont(tw);
// Real announcement: the active popup event drives both the home banner and a
// one-time modal. No popup event -> no demo banner (nothing hard-coded shows).
const [popup, setPopup] = _h3S(null); // active popup event (modal + banner source)
const [showPopup, setShowPopup] = _h3S(false);
_h3E(() => {
let on = true;
(async () => {
try {
const ev = window.guestApi && window.guestApi.popupEvent ? await window.guestApi.popupEvent() : null;
if (!on || !ev) return;
setPopup(ev);
// Show the modal once per event per session.
let seen = ''; try { seen = sessionStorage.getItem('aeros-popup-seen') || ''; } catch (e) {}
if (String(ev.id) !== seen) setShowPopup(true);
} catch (e) {}
})();
return () => { on = false; };
}, []);
const dismissPopup = () => { setShowPopup(false); try { sessionStorage.setItem('aeros-popup-seen', String(popup && popup.id)); } catch (e) {} };
const evTitle = popup ? (lang === 'en' ? popup.en : popup.title) : '';
const evInfo = popup ? (lang === 'en' ? popup.info_en : popup.info) : '';
return (
{/* header */}
{D.BRAND.logo ?

: (D.BRAND.name || 'R').charAt(0)}
{D.BRAND.name}
{D.BRAND.sub}
{onSettings && }
{t.welcome}
{t.selectOutlet}
{/* outlets */}
{D.OUTLETS.map(o => (
))}
{/* services grid */}
{t.services}
{D.SERVICE_TILES.map(s => { const m = D.SERVICE_META[s]; return (
); })}
{/* announcement — driven by the active popup event (hidden when none) */}
{announce && popup && (
{popup.image
?

:
}
{Icon.ticket({ size: 14 })}{t.events}
{evTitle}
{evInfo &&
{evInfo}
}
onService('events')} iconRight={Icon.chevRight}>{t.announceCta || (lang === 'en' ? 'See details' : 'Detayları gör')}
)}
{/* popup modal — opens automatically when an event is flagged "show popup" */}
{showPopup && popup && (
e.stopPropagation()} style={{ width: '100%', maxWidth: 360, background: C.bg2, borderRadius: 22, overflow: 'hidden', boxShadow: '0 20px 60px rgba(0,0,0,0.4)', animation: tw.animate ? 'g2up .3s cubic-bezier(.22,1,.36,1)' : 'none' }}>
{popup.image
?

:
{Icon.ticket({ size: 40 })}}
{t.events}
{evTitle}
{popup.date &&
{Icon.calendar({ size: 14 })}{popup.date}
}
{evInfo &&
{evInfo}
}
{ dismissPopup(); onService('events'); }} iconRight={Icon.chevRight}>{lang === 'en' ? 'See details' : 'Detayları gör'}
)}
);
}
window.G3Home = G3Home;