// Horton Interiors — main app, hash router + Tweaks const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{ "accent": "#B07A3C", "heroLight": false, "density": "editorial", "displayFont": "Instrument Serif" }/*EDITMODE-END*/; function parseRoute() { const hash = window.location.hash.replace(/^#/, "") || "/"; // /projects/ → case study // /projects → projects index // / → home if (hash.startsWith("/projects/")) { return { name: "case-study", slug: hash.split("/")[2].split("?")[0] }; } if (hash.startsWith("/projects")) return { name: "projects" }; if (hash === "/" || hash === "") return { name: "home" }; // any other route → home, but anchor a banner return { name: "home", placeholder: hash }; } function App() { const [route, setRoute] = useState(parseRoute()); const [tweaks, setTweak] = useTweaks(TWEAK_DEFAULTS); useEffect(() => { const onHash = () => { setRoute(parseRoute()); window.scrollTo({ top: 0, behavior: "instant" }); }; window.addEventListener("hashchange", onHash); return () => window.removeEventListener("hashchange", onHash); }, []); // Apply tweaks to the root element useEffect(() => { const root = document.documentElement; root.style.setProperty("--accent", tweaks.accent); root.setAttribute("data-density", tweaks.density); const fontMap = { "Instrument Serif": '"Instrument Serif", "GT Sectra", Georgia, serif', "Fraunces": '"Fraunces", "GT Sectra", Georgia, serif', "Newsreader": '"Newsreader", "GT Sectra", Georgia, serif', "Space Grotesk": '"Space Grotesk", "Switzer", sans-serif' }; root.style.setProperty("--serif", fontMap[tweaks.displayFont] || fontMap["Instrument Serif"]); }, [tweaks]); const navDark = route.name === "case-study" || (route.name === "home" && !tweaks.heroLight); const currentRoutePath = window.location.hash.replace(/^#/, "") || "/"; return ( <>