diff --git a/graphviz/frontend/src/AppRouter.tsx b/graphviz/frontend/src/AppRouter.tsx new file mode 100644 index 0000000..f474c2a --- /dev/null +++ b/graphviz/frontend/src/AppRouter.tsx @@ -0,0 +1,30 @@ +import { useEffect, useState } from "react"; +import { VizSmallConnected } from "./VizSmallConnected"; +import { VizTimeFilter } from "./VizTimeFilter"; + +function Home() { + return ( +
+ ); +} + +export function AppRouter() { + const [route, setRoute] = useState(() => window.location.hash); + + useEffect(() => { + const onHashChange = () => { + setRoute(window.location.hash); + }; + + window.addEventListener("hashchange", onHashChange); + return () => window.removeEventListener("hashchange", onHashChange); + }, []); + console.log(route) + if (route === "#small") return