/* ============================================================ AACSH — App router + tweaks ============================================================ */ const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{ "primaryHue": "aubergine", "typeScale": "serif-editorial", "showRiskBadges": true, "compactNav": false, "accentMark": "gold" }/*EDITMODE-END*/; function App() { const [path, setPath] = useState(() => window.location.hash.replace(/^#/, "") || "/"); const [bookOpen, setBookOpen] = useState(false); const [bookPrefill, setBookPrefill] = useState({ dept: "", proc: "" }); const tweaksRef = useRef(null); const [tweaks, setTweak] = useTweaks ? useTweaks(TWEAK_DEFAULTS) : [TWEAK_DEFAULTS, () => {}]; const navigate = useCallback((to) => { window.location.hash = to; setPath(to); window.scrollTo({ top: 0, behavior: "instant" }); }, []); useEffect(() => { const fn = () => { const p = window.location.hash.replace(/^#/, "") || "/"; setPath(p); }; window.addEventListener("hashchange", fn); return () => window.removeEventListener("hashchange", fn); }, []); const openBook = useCallback((dept, proc) => { setBookPrefill({ dept: dept || "", proc: proc || "" }); setBookOpen(true); }, []); /* Apply tweaks via CSS vars */ useEffect(() => { const root = document.documentElement; const hue = tweaks.primaryHue; if (hue === "aubergine") { root.style.setProperty("--plum", "#3D1B4D"); root.style.setProperty("--plum-deep", "#2A1136"); root.style.setProperty("--plum-soft", "#6E4382"); root.style.setProperty("--mist", "#F4EFF6"); } else if (hue === "clinical-blue") { root.style.setProperty("--plum", "#1E5A8A"); root.style.setProperty("--plum-deep", "#13405F"); root.style.setProperty("--plum-soft", "#5481AD"); root.style.setProperty("--mist", "#EEF3F8"); } else if (hue === "deep-teal") { root.style.setProperty("--plum", "#1F5E63"); root.style.setProperty("--plum-deep", "#0E3C40"); root.style.setProperty("--plum-soft", "#4A8487"); root.style.setProperty("--mist", "#ECF3F2"); } else if (hue === "midnight") { root.style.setProperty("--plum", "#1A2238"); root.style.setProperty("--plum-deep", "#10162A"); root.style.setProperty("--plum-soft", "#4A536B"); root.style.setProperty("--mist", "#EEF0F4"); } if (tweaks.accentMark === "gold") { root.style.setProperty("--gold", "#B08D57"); root.style.setProperty("--gold-soft", "#D9C39A"); } else if (tweaks.accentMark === "copper") { root.style.setProperty("--gold", "#A8634C"); root.style.setProperty("--gold-soft", "#D9A993"); } else if (tweaks.accentMark === "silver") { root.style.setProperty("--gold", "#8A8C90"); root.style.setProperty("--gold-soft", "#C8CACE"); } if (tweaks.typeScale === "serif-editorial") { root.style.setProperty("--font-serif", "'Fraunces', 'Iowan Old Style', Georgia, serif"); } else if (tweaks.typeScale === "modern-sans") { root.style.setProperty("--font-serif", "'Inter', system-ui, sans-serif"); } else if (tweaks.typeScale === "warm-serif") { root.style.setProperty("--font-serif", "'Cormorant Garamond', Georgia, serif"); } }, [tweaks]); /* Route */ let page; if (path === "/" || path === "") { page = openBook()} />; } else if (path === "/departments") { page = ; } else if (path.startsWith("/departments/")) { const slug = path.split("/")[2]; page = openBook(d || slug, p)} />; } else if (path.startsWith("/procedures/")) { const parts = path.split("/"); page = ; } else if (path === "/doctors") { page = ; } else if (path.startsWith("/doctors/")) { const slug = path.split("/")[2]; page = ; } else if (path === "/accreditation") { page = openBook()} />; } else if (path === "/before-after") { page = openBook()} />; } else if (path === "/medical-tourism") { page = openBook()} />; } else if (path === "/about") { page = openBook()} />; } else if (path === "/contact") { page = openBook()} />; } else { page = ; } return ( <> openBook()} />
{page}