web: separate search route

This commit is contained in:
2026-02-14 00:22:19 -08:00
parent 6f5787f923
commit acca7be7f0
9 changed files with 529 additions and 282 deletions

18
web/src/root-router.tsx Normal file
View File

@@ -0,0 +1,18 @@
import { useEffect, useState } from "preact/hooks";
import App from "@/App";
import SearchRoutePage from "@/pages/search-route-page";
export function RootRouter() {
const [path, setPath] = useState(window.location.pathname);
useEffect(() => {
const onPopState = () => setPath(window.location.pathname);
window.addEventListener("popstate", onPopState);
return () => window.removeEventListener("popstate", onPopState);
}, []);
if (path === "/search") {
return <SearchRoutePage />;
}
return <App />;
}