/* NEKTAR v2 — App, Nav, FloatingResa, mount */ const { useState, useEffect, useRef } = React; const _D = window.NEKTAR_DATA; const _LC = window.LangContext; // Composants définis dans nektar-sections.jsx (autre scope Babel) const { HeroSection, HistoireSection, SelectionSection, LivraisonSection, LieuSection, SuivreSection, FooterSection, } = window; /* ============================================================ GLOBAL NAV — apparaît après le hero ============================================================ */ function GlobalNav({ pastHero, lang, setLang }) { const c = _D.COPY[lang] || _D.COPY.fr; const [drawerOpen, setDrawerOpen] = useState(false); const toggle = () => setDrawerOpen(o => !o); const close = () => setDrawerOpen(false); const scrollTo = (id, e) => { if (e) e.preventDefault(); close(); const el = document.getElementById(id); if (!el) return; // Mise à jour du hash sans saut brutal history.pushState(null, '', '#' + id); el.scrollIntoView({ behavior: 'smooth' }); }; return ( <> {/* Drawer mobile */}
> ); } /* ============================================================ FLOATING RÉSERVER — apparaît après le hero ============================================================ */ function FloatingResa({ pastHero, lang }) { const c = _D.COPY[lang] || _D.COPY.fr; return ( {c.nav.reserverCaps} ); } /* ============================================================ LangProvider — persistance localStorage ============================================================ */ function LangProvider({ children }) { const [lang, setLangState] = useState(() => { try { return localStorage.getItem('nektar-lang') || 'fr'; } catch (e) { return 'fr'; } }); const setLang = (newLang) => { setLangState(newLang); try { localStorage.setItem('nektar-lang', newLang); } catch (e) {} document.documentElement.lang = newLang; }; useEffect(() => { document.documentElement.lang = lang; }, [lang]); return ( <_LC.Provider value={{ lang, setLang }}> {children} ); } /* ============================================================ App ============================================================ */ function App() { const [pastHero, setPastHero] = useState(false); const heroRef = useRef(null); const livraisonRefScroll = useRef(null); // Détection du dépassement du hero (pour le bouton flottant uniquement) useEffect(() => { const onScroll = () => { const hero = document.getElementById('accueil'); if (!hero) return; const heroH = hero.offsetHeight || window.innerHeight; setPastHero(window.scrollY > heroH * 0.8); }; onScroll(); window.addEventListener('scroll', onScroll, { passive: true }); return () => window.removeEventListener('scroll', onScroll); }, []); // Hash routing initial — scroll vers la section au chargement useEffect(() => { if (window.location.hash) { const id = window.location.hash.slice(1); // Laisse le temps aux sections de monter setTimeout(() => { const el = document.getElementById(id); if (el) el.scrollIntoView({ behavior: 'smooth' }); }, 300); } }, []); const scrollToLivraison = () => { const el = document.getElementById('livraison'); if (el) { history.pushState(null, '', '#livraison'); el.scrollIntoView({ behavior: 'smooth' }); } }; return (