From 72d9a7a5190f349d565628ee1d07641d88a218dd Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Thu, 7 Nov 2024 13:00:00 +0000 Subject: [PATCH] Add tree selection menu next to info icon (#629) --- taxonium_website/src/App.jsx | 25 ++++- taxonium_website/src/trees.json | 168 ++++++++++++++++++++++++++++++++ 2 files changed, 192 insertions(+), 1 deletion(-) diff --git a/taxonium_website/src/App.jsx b/taxonium_website/src/App.jsx index 1c1fdc3f..d1c86850 100644 --- a/taxonium_website/src/App.jsx +++ b/taxonium_website/src/App.jsx @@ -10,6 +10,7 @@ import classNames from "classnames"; import { useInputHelper } from "./hooks/useInputHelper"; import InputSupplier from "./components/InputSupplier"; import treeConfig from "./trees.json"; +import { Select } from "./components/Basic"; // Hardcoded list of paths to show in the showcase const SHOWCASE_PATHS = [ @@ -70,6 +71,7 @@ function App() { const [beingDragged, setBeingDragged] = useState(false); const [aboutEnabled, setAboutEnabled] = useState(false); const [overlayContent, setOverlayContent] = useState(null); + const [selectedTree, setSelectedTree] = useState(""); const dragTimeout = useRef(null); @@ -135,6 +137,13 @@ function App() { }; }).filter(Boolean); // Remove any null entries from missing configs + useEffect(() => { + if (selectedTree) { + const newPath = `/${selectedTree}${window.location.search}`; + window.location.href = newPath; // Trigger a page refresh on selection change + } + }, [selectedTree]); + return ( <> )} -
+
+ {window.screen.width >= 600 && ( // Hide the menu on mobile + + )}