Skip to content

Commit

Permalink
Add tree selection menu next to info icon (#629)
Browse files Browse the repository at this point in the history
  • Loading branch information
theosanderson authored Nov 7, 2024
1 parent bcd0cef commit 72d9a7a
Show file tree
Hide file tree
Showing 2 changed files with 192 additions and 1 deletion.
25 changes: 24 additions & 1 deletion taxonium_website/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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 (
<>
<AboutOverlay
Expand Down Expand Up @@ -202,7 +211,21 @@ function App() {
</a>
)}
</h1>
<div className="flex">
<div className="flex items-center">
{window.screen.width >= 600 && ( // Hide the menu on mobile
<Select
value={new URL(window.location.href).pathname.substring(1)}
onChange={(e) => setSelectedTree(e.target.value)}
className={"mr-4 bg-gray-50 ml-4"}
>
<option value="">Select a tree</option>
{Object.entries(treeConfig).map(([path, config]) => (
<option key={path} value={path}>
{path}
</option>
))}
</Select>
)}
<button
onClick={() => setAboutEnabled(true)}
className="text-white font-bold hover:underline flex items-center"
Expand Down
168 changes: 168 additions & 0 deletions taxonium_website/src/trees.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,173 @@
"title": "Wikidata visual tree of life",
"description": "The tree of life, showing species from Wikidata with images. Links to Wikipedia.",
"legacyHostnames": ["visualtreeoflife.taxonium.org"]
},
"flu/A/goose/Guangdong/1/1996(H5N1)/PB2": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/864/105/GCF_000864105.1/UShER_NC_007357.1/fluA.GCF_000864105.1.NC_007357.1.latest.taxonium.jsonl.gz"
},
"flu/A/goose/Guangdong/1/1996(H5N1)/PB1": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/864/105/GCF_000864105.1/UShER_NC_007358.1/fluA.GCF_000864105.1.NC_007358.1.latest.taxonium.jsonl.gz"
},
"flu/A/goose/Guangdong/1/1996(H5N1)/PA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/864/105/GCF_000864105.1/UShER_NC_007359.1/fluA.GCF_000864105.1.NC_007359.1.latest.taxonium.jsonl.gz"
},
"flu/A/goose/Guangdong/1/1996(H5N1)/HA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/864/105/GCF_000864105.1/UShER_NC_007362.1/fluA.GCF_000864105.1.NC_007362.1.latest.taxonium.jsonl.gz"
},
"flu/A/goose/Guangdong/1/1996(H5N1)/NP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/864/105/GCF_000864105.1/UShER_NC_007360.1/fluA.GCF_000864105.1.NC_007360.1.latest.taxonium.jsonl.gz"
},
"flu/A/goose/Guangdong/1/1996(H5N1)/nan": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/864/105/GCF_000864105.1/UShER_NC_007361.1/fluA.GCF_000864105.1.NC_007361.1.latest.taxonium.jsonl.gz"
},
"flu/A/goose/Guangdong/1/1996(H5N1)/MP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/864/105/GCF_000864105.1/UShER_NC_007363.1/fluA.GCF_000864105.1.NC_007363.1.latest.taxonium.jsonl.gz"
},
"flu/A/goose/Guangdong/1/1996(H5N1)/NS": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/864/105/GCF_000864105.1/UShER_NC_007364.1/fluA.GCF_000864105.1.NC_007364.1.latest.taxonium.jsonl.gz"
},
"flu/A/New York/392/2004(H3N2)/PB2": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/085/GCF_000865085.1/UShER_NC_007373.1/fluA.GCF_000865085.1.NC_007373.1.latest.taxonium.jsonl.gz"
},
"flu/A/New York/392/2004(H3N2)/PB1": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/085/GCF_000865085.1/UShER_NC_007372.1/fluA.GCF_000865085.1.NC_007372.1.latest.taxonium.jsonl.gz"
},
"flu/A/New York/392/2004(H3N2)/PA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/085/GCF_000865085.1/UShER_NC_007371.1/fluA.GCF_000865085.1.NC_007371.1.latest.taxonium.jsonl.gz"
},
"flu/A/New York/392/2004(H3N2)/HA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/085/GCF_000865085.1/UShER_NC_007366.1/fluA.GCF_000865085.1.NC_007366.1.latest.taxonium.jsonl.gz"
},
"flu/A/New York/392/2004(H3N2)/NP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/085/GCF_000865085.1/UShER_NC_007369.1/fluA.GCF_000865085.1.NC_007369.1.latest.taxonium.jsonl.gz"
},
"flu/A/New York/392/2004(H3N2)/nan": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/085/GCF_000865085.1/UShER_NC_007368.1/fluA.GCF_000865085.1.NC_007368.1.latest.taxonium.jsonl.gz"
},
"flu/A/New York/392/2004(H3N2)/MP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/085/GCF_000865085.1/UShER_NC_007367.1/fluA.GCF_000865085.1.NC_007367.1.latest.taxonium.jsonl.gz"
},
"flu/A/New York/392/2004(H3N2)/NS": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/085/GCF_000865085.1/UShER_NC_007370.1/fluA.GCF_000865085.1.NC_007370.1.latest.taxonium.jsonl.gz"
},
"flu/A/California/07/2009(H1N1)/PB2": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/001/343/785/GCF_001343785.1/UShER_NC_026438.1/fluA.GCF_001343785.1.NC_026438.1.latest.taxonium.jsonl.gz"
},
"flu/A/California/07/2009(H1N1)/PB1": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/001/343/785/GCF_001343785.1/UShER_NC_026435.1/fluA.GCF_001343785.1.NC_026435.1.latest.taxonium.jsonl.gz"
},
"flu/A/California/07/2009(H1N1)/PA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/001/343/785/GCF_001343785.1/UShER_NC_026437.1/fluA.GCF_001343785.1.NC_026437.1.latest.taxonium.jsonl.gz"
},
"flu/A/California/07/2009(H1N1)/HA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/001/343/785/GCF_001343785.1/UShER_NC_026433.1/fluA.GCF_001343785.1.NC_026433.1.latest.taxonium.jsonl.gz"
},
"flu/A/California/07/2009(H1N1)/NP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/001/343/785/GCF_001343785.1/UShER_NC_026436.1/fluA.GCF_001343785.1.NC_026436.1.latest.taxonium.jsonl.gz"
},
"flu/A/California/07/2009(H1N1)/nan": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/001/343/785/GCF_001343785.1/UShER_NC_026434.1/fluA.GCF_001343785.1.NC_026434.1.latest.taxonium.jsonl.gz"
},
"flu/A/California/07/2009(H1N1)/MP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/001/343/785/GCF_001343785.1/UShER_NC_026431.1/fluA.GCF_001343785.1.NC_026431.1.latest.taxonium.jsonl.gz"
},
"flu/A/California/07/2009(H1N1)/NS": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/001/343/785/GCF_001343785.1/UShER_NC_026432.1/fluA.GCF_001343785.1.NC_026432.1.latest.taxonium.jsonl.gz"
},
"flu/A/Puerto Rico/8/1934(H1N1)/PB2": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/725/GCF_000865725.1/UShER_NC_002023.1/fluA.GCF_000865725.1.NC_002023.1.latest.taxonium.jsonl.gz"
},
"flu/A/Puerto Rico/8/1934(H1N1)/PB1": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/725/GCF_000865725.1/UShER_NC_002021.1/fluA.GCF_000865725.1.NC_002021.1.latest.taxonium.jsonl.gz"
},
"flu/A/Puerto Rico/8/1934(H1N1)/PA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/725/GCF_000865725.1/UShER_NC_002022.1/fluA.GCF_000865725.1.NC_002022.1.latest.taxonium.jsonl.gz"
},
"flu/A/Puerto Rico/8/1934(H1N1)/HA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/725/GCF_000865725.1/UShER_NC_002017.1/fluA.GCF_000865725.1.NC_002017.1.latest.taxonium.jsonl.gz"
},
"flu/A/Puerto Rico/8/1934(H1N1)/NP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/725/GCF_000865725.1/UShER_NC_002019.1/fluA.GCF_000865725.1.NC_002019.1.latest.taxonium.jsonl.gz"
},
"flu/A/Puerto Rico/8/1934(H1N1)/nan": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/725/GCF_000865725.1/UShER_NC_002018.1/fluA.GCF_000865725.1.NC_002018.1.latest.taxonium.jsonl.gz"
},
"flu/A/Puerto Rico/8/1934(H1N1)/MP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/725/GCF_000865725.1/UShER_NC_002016.1/fluA.GCF_000865725.1.NC_002016.1.latest.taxonium.jsonl.gz"
},
"flu/A/Puerto Rico/8/1934(H1N1)/NS": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/865/725/GCF_000865725.1/UShER_NC_002020.1/fluA.GCF_000865725.1.NC_002020.1.latest.taxonium.jsonl.gz"
},
"flu/A/Shanghai/02/2013(H7N9)/PB2": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/928/555/GCF_000928555.1/UShER_NC_026422.1/fluA.GCF_000928555.1.NC_026422.1.latest.taxonium.jsonl.gz"
},
"flu/A/Shanghai/02/2013(H7N9)/PB1": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/928/555/GCF_000928555.1/UShER_NC_026423.1/fluA.GCF_000928555.1.NC_026423.1.latest.taxonium.jsonl.gz"
},
"flu/A/Shanghai/02/2013(H7N9)/PA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/928/555/GCF_000928555.1/UShER_NC_026424.1/fluA.GCF_000928555.1.NC_026424.1.latest.taxonium.jsonl.gz"
},
"flu/A/Shanghai/02/2013(H7N9)/HA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/928/555/GCF_000928555.1/UShER_NC_026425.1/fluA.GCF_000928555.1.NC_026425.1.latest.taxonium.jsonl.gz"
},
"flu/A/Shanghai/02/2013(H7N9)/NP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/928/555/GCF_000928555.1/UShER_NC_026426.1/fluA.GCF_000928555.1.NC_026426.1.latest.taxonium.jsonl.gz"
},
"flu/A/Shanghai/02/2013(H7N9)/nan": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/928/555/GCF_000928555.1/UShER_NC_026429.1/fluA.GCF_000928555.1.NC_026429.1.latest.taxonium.jsonl.gz"
},
"flu/A/Shanghai/02/2013(H7N9)/MP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/928/555/GCF_000928555.1/UShER_NC_026427.1/fluA.GCF_000928555.1.NC_026427.1.latest.taxonium.jsonl.gz"
},
"flu/A/Shanghai/02/2013(H7N9)/NS": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/928/555/GCF_000928555.1/UShER_NC_026428.1/fluA.GCF_000928555.1.NC_026428.1.latest.taxonium.jsonl.gz"
},
"flu/A/Korea/426/1968(H2N2)/PB2": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/866/645/GCF_000866645.1/UShER_NC_007378.1/fluA.GCF_000866645.1.NC_007378.1.latest.taxonium.jsonl.gz"
},
"flu/A/Korea/426/1968(H2N2)/PB1": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/866/645/GCF_000866645.1/UShER_NC_007375.1/fluA.GCF_000866645.1.NC_007375.1.latest.taxonium.jsonl.gz"
},
"flu/A/Korea/426/1968(H2N2)/PA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/866/645/GCF_000866645.1/UShER_NC_007376.1/fluA.GCF_000866645.1.NC_007376.1.latest.taxonium.jsonl.gz"
},
"flu/A/Korea/426/1968(H2N2)/HA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/866/645/GCF_000866645.1/UShER_NC_007374.1/fluA.GCF_000866645.1.NC_007374.1.latest.taxonium.jsonl.gz"
},
"flu/A/Korea/426/1968(H2N2)/NP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/866/645/GCF_000866645.1/UShER_NC_007381.1/fluA.GCF_000866645.1.NC_007381.1.latest.taxonium.jsonl.gz"
},
"flu/A/Korea/426/1968(H2N2)/nan": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/866/645/GCF_000866645.1/UShER_NC_007382.1/fluA.GCF_000866645.1.NC_007382.1.latest.taxonium.jsonl.gz"
},
"flu/A/Korea/426/1968(H2N2)/MP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/866/645/GCF_000866645.1/UShER_NC_007377.1/fluA.GCF_000866645.1.NC_007377.1.latest.taxonium.jsonl.gz"
},
"flu/A/Korea/426/1968(H2N2)/NS": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/866/645/GCF_000866645.1/UShER_NC_007380.1/fluA.GCF_000866645.1.NC_007380.1.latest.taxonium.jsonl.gz"
},
"flu/A/Hong Kong/1073/99(H9N2)/PB2": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/851/145/GCF_000851145.1/UShER_NC_004910.1/fluA.GCF_000851145.1.NC_004910.1.latest.taxonium.jsonl.gz"
},
"flu/A/Hong Kong/1073/99(H9N2)/PB1": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/851/145/GCF_000851145.1/UShER_NC_004911.1/fluA.GCF_000851145.1.NC_004911.1.latest.taxonium.jsonl.gz"
},
"flu/A/Hong Kong/1073/99(H9N2)/PA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/851/145/GCF_000851145.1/UShER_NC_004912.1/fluA.GCF_000851145.1.NC_004912.1.latest.taxonium.jsonl.gz"
},
"flu/A/Hong Kong/1073/99(H9N2)/HA": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/851/145/GCF_000851145.1/UShER_NC_004908.1/fluA.GCF_000851145.1.NC_004908.1.latest.taxonium.jsonl.gz"
},
"flu/A/Hong Kong/1073/99(H9N2)/NP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/851/145/GCF_000851145.1/UShER_NC_004905.2/fluA.GCF_000851145.1.NC_004905.2.latest.taxonium.jsonl.gz"
},
"flu/A/Hong Kong/1073/99(H9N2)/nan": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/851/145/GCF_000851145.1/UShER_NC_004909.1/fluA.GCF_000851145.1.NC_004909.1.latest.taxonium.jsonl.gz"
},
"flu/A/Hong Kong/1073/99(H9N2)/MP": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/851/145/GCF_000851145.1/UShER_NC_004907.1/fluA.GCF_000851145.1.NC_004907.1.latest.taxonium.jsonl.gz"
},
"flu/A/Hong Kong/1073/99(H9N2)/NS": {
"protoUrl": "https://hgdownload.gi.ucsc.edu/hubs/GCF/000/851/145/GCF_000851145.1/UShER_NC_004906.1/fluA.GCF_000851145.1.NC_004906.1.latest.taxonium.jsonl.gz"
}
}

0 comments on commit 72d9a7a

Please sign in to comment.