/* App.jsx — router + state for the DLG public site. Routes: home | antrag | news | kontakt | impressum | datenschutz URL hash is kept in sync so refresh + shareable links work. */ const ROUTES = ["home", "antrag", "news", "kontakt", "impressum", "datenschutz"]; const routeFromHash = () => { const h = (window.location.hash || "").replace(/^#\/?/, ""); return ROUTES.includes(h) ? h : "home"; }; const App = () => { const [route, setRoute] = React.useState(routeFromHash); React.useEffect(() => { const onHash = () => setRoute(routeFromHash()); window.addEventListener("hashchange", onHash); return () => window.removeEventListener("hashchange", onHash); }, []); React.useEffect(() => { const desired = `#/${route}`; if (window.location.hash !== desired) { window.history.replaceState(null, "", desired); } window.scrollTo({ top: 0, behavior: "instant" }); }, [route]); const handleNav = (r) => setRoute(ROUTES.includes(r) ? r : "home"); let body = null; if (route === "antrag") body = handleNav("home")} onSubmit={() => {}}/>; else if (route === "news") body = ; else if (route === "kontakt") body = ; else if (route === "impressum") body = ; else if (route === "datenschutz") body = ; else body = ; // Antrag screen has its own self-contained layout (no global header/footer) if (route === "antrag") { return ( <> {body} ); } return ( <>
{body}