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 ( +
+

Will Jeynes - LLMs for Disinformation Analysis - Graph Visualisations

+

Default

+

Time-Filter

+
+ ); +} + +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 ; + if (route === "#time") return ; + return ; +} \ No newline at end of file diff --git a/graphviz/frontend/src/App.tsx b/graphviz/frontend/src/VizSmallConnected.tsx similarity index 98% rename from graphviz/frontend/src/App.tsx rename to graphviz/frontend/src/VizSmallConnected.tsx index b545d5b..a2ce1c1 100644 --- a/graphviz/frontend/src/App.tsx +++ b/graphviz/frontend/src/VizSmallConnected.tsx @@ -93,7 +93,7 @@ function getConnectedComponents(nodes, links) { return components; } -export function App() { +export function VizSmallConnected() { const fgRef = useRef(); const [selectedNode, setSelectedNode] = useState(null); const [minGraphSize, setMinGraphSize] = useState(10); @@ -223,6 +223,7 @@ export function App() { maxWidth: "500px" }} > +

Go Home

Config