/* global React, ReactDOM, HomePage, ServicesPage, RdvPage, InfoBar, Nav, Footer */ const { useState: useState_a, useEffect: useEffect_a } = React; const { TweaksPanel: TP, TweakSection: TS, TweakRadio: TR, TweakToggle: TT } = window; // ---------- Hash router ---------- function parseRoute(hash) { const h = (hash || "").replace(/^#\/?/, ""); if (!h || h === "" || h === "/") return { name: "home" }; if (h.startsWith("services")) return { name: "services" }; if (h.startsWith("rdv")) return { name: "rdv" }; if (h.startsWith("specialites/checkup")) return { name: "checkup" }; if (h.startsWith("specialites")) return { name: "services" }; if (h.startsWith("connaitre/mission")) return { name: "mission" }; if (h.startsWith("connaitre/centre")) return { name: "centre" }; if (h.startsWith("connaitre/equipes")) return { name: "equipes" }; if (h.startsWith("connaitre")) return { name: "mission" }; if (h.startsWith("venir/parcours")) return { name: "parcours" }; if (h.startsWith("venir/horaires")) return { name: "horaires" }; if (h.startsWith("venir/admission")) return { name: "admission" }; if (h.startsWith("venir")) return { name: "rdv" }; if (h.startsWith("opportunites/appels")) return { name: "tenders" }; if (h.startsWith("opportunites/recrutement")) return { name: "recrutement" }; if (h.startsWith("opportunites")) return { name: "recrutement" }; return { name: "home", placeholder: h }; } const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{ "hero": "split", "density": "spacious", "theme": "light", "lang": "fr" }/*EDITMODE-END*/; function App() { const [t, setTweak] = window.useTweaks(TWEAK_DEFAULTS); const [route, setRoute] = useState_a(parseRoute(window.location.hash)); useEffect_a(() => { const onHash = () => { setRoute(parseRoute(window.location.hash)); window.scrollTo({ top: 0, behavior: "instant" in HTMLElement.prototype ? "instant" : "auto" }); }; window.addEventListener("hashchange", onHash); return () => window.removeEventListener("hashchange", onHash); }, []); // Theme on body useEffect_a(() => { document.body.classList.toggle("theme-dark", t.theme === "dark"); }, [t.theme]); const onLang = (lang) => setTweak("lang", lang); return ( <>