diff --git a/taxonium_backend/server.js b/taxonium_backend/server.js index 04cb14a0..c16895b1 100644 --- a/taxonium_backend/server.js +++ b/taxonium_backend/server.js @@ -399,7 +399,10 @@ app.get("/nextstrain_json/:root_id", async (req, res) => { processedData.nodes, config ); - res.setHeader("Content-Disposition", "attachment; " + "filename="+root_id+".nextstrain.json"); + res.setHeader( + "Content-Disposition", + "attachment; " + "filename=" + root_id + ".nextstrain.json" + ); res.send(json); }); diff --git a/taxonium_web_client/src/components/Basic.jsx b/taxonium_web_client/src/components/Basic.jsx index 1c477574..9ab66c01 100644 --- a/taxonium_web_client/src/components/Basic.jsx +++ b/taxonium_web_client/src/components/Basic.jsx @@ -1,10 +1,10 @@ import classNames from "classnames"; export const Button = ({ onClick, className, children, title, href }) => { - if(href && onClick){ + if (href && onClick) { throw new Error("Button cannot have both href and onClick"); } - if(href){ + if (href) { return ( { )} href={href} title={title} - > {children} ); + } else { + return ( + + ); } - else{ - return ( - - ); - } }; export const Select = ({ onChange, className, children, value, title }) => { diff --git a/taxonium_web_client/src/components/SearchPanel.jsx b/taxonium_web_client/src/components/SearchPanel.jsx index af561d49..41eee7f9 100644 --- a/taxonium_web_client/src/components/SearchPanel.jsx +++ b/taxonium_web_client/src/components/SearchPanel.jsx @@ -3,16 +3,14 @@ import { RiAddCircleLine, RiArrowLeftUpLine } from "react-icons/ri"; import { BiPalette } from "react-icons/bi"; import { Button } from "../components/Basic"; import ReactTooltip from "react-tooltip"; -import {BsBoxArrowInUpRight} from "react-icons/bs"; +import { BsBoxArrowInUpRight } from "react-icons/bs"; import { FaSearch, FaShare } from "react-icons/fa"; - - import { Select } from "./Basic"; import ListOutputModal from "./ListOutputModal"; -import { useState, useMemo } from "react"; +import { useState, useMemo } from "react"; import classNames from "classnames"; @@ -60,7 +58,7 @@ function SearchPanel({ } else { return null; } - }, [selectedDetails.nodeDetails, perNodeFunctions]); + }, [selectedDetails.nodeDetails]); const [listOutputModalOpen, setListOutputModalOpen] = useState(false); @@ -134,73 +132,91 @@ function SearchPanel({ )} {key === "num_tips" && ( - - -
-

For this clade:

-
+ + {" "} + + + ( +
+

For this clade:

+
+ +
-{config.enable_ns_download && ( - <> - - -
- - - {backend.type === "server" && selectedDetails.nodeDetails[key]<20000 && ( - <> -
- - )} - - )} + {config.enable_ns_download && ( + <> +
+ +
-{config.covspectrum_links && ( -
-
- )} + {backend.type === "server" && + selectedDetails.nodeDetails[key] < 20000 && ( + <> +
+ +
+ + )} + + )} -
} - effect='solid' - delayHide={500} - delayShow={0} - delayUpdate={500} - - place={'right'} - border={true} - type={'light'} -/> - + {config.covspectrum_links && ( +
+ +
+ )} +
+ )} + effect="solid" + delayHide={500} + delayShow={0} + delayUpdate={500} + place={"right"} + border={true} + type={"light"} + />
)} @@ -428,7 +444,7 @@ function SearchPanel({ )} - +
{selectedDetails.nodeDetails.acknowledgements && (
@@ -449,7 +465,6 @@ function SearchPanel({
)}
- )} diff --git a/taxonium_web_client/src/hooks/useServerBackend.js b/taxonium_web_client/src/hooks/useServerBackend.js index 2b66598e..50fc5ad0 100644 --- a/taxonium_web_client/src/hooks/useServerBackend.js +++ b/taxonium_web_client/src/hooks/useServerBackend.js @@ -149,21 +149,21 @@ function useServerBackend(backend_url, sid, url_on_fail) { [backend_url, sid] ); - const getNextstrainJsonUrl = useCallback((nodeId, config) => { - return backend_url + "/nextstrain_json/" + nodeId ; - - - }, [backend_url]); - - - const getNextstrainJson = useCallback((nodeId, config) => { - const url = getNextstrainJsonUrl(nodeId, config); - // load this - window.location.href = url; - - - }, [getNextstrainJsonUrl]); + const getNextstrainJsonUrl = useCallback( + (nodeId, config) => { + return backend_url + "/nextstrain_json/" + nodeId; + }, + [backend_url] + ); + const getNextstrainJson = useCallback( + (nodeId, config) => { + const url = getNextstrainJsonUrl(nodeId, config); + // load this + window.location.href = url; + }, + [getNextstrainJsonUrl] + ); return useMemo(() => { return { @@ -177,7 +177,7 @@ function useServerBackend(backend_url, sid, url_on_fail) { type: "server", backend_url: backend_url, getNextstrainJson, - getNextstrainJsonUrl + getNextstrainJsonUrl, }; }, [ queryNodes, @@ -189,7 +189,7 @@ function useServerBackend(backend_url, sid, url_on_fail) { getTipAtts, backend_url, getNextstrainJson, - getNextstrainJsonUrl + getNextstrainJsonUrl, ]); }