From 39b4ec64545a50e578646bd3607ddcd0f5e4164f Mon Sep 17 00:00:00 2001 From: james hadfield Date: Tue, 9 Apr 2024 14:50:20 +1200 Subject: [PATCH] Add MicrobeTrace linkout --- src/components/modal/LinkOutModalContents.jsx | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/components/modal/LinkOutModalContents.jsx b/src/components/modal/LinkOutModalContents.jsx index 5121229b4..1746bfa80 100644 --- a/src/components/modal/LinkOutModalContents.jsx +++ b/src/components/modal/LinkOutModalContents.jsx @@ -129,6 +129,39 @@ const data = ({distanceMeasure, colorBy, mainTreeNumTips, tangle}) => { return `${baseUrl}?${Object.entries(queries).map(([k,v]) => `${k}=${encodeURIComponent(v)}`).join("&")}`; } }, + { + name: 'microbetrace.cdc.gov', + valid() { + // MicrobeTrace should work similarly to Taxonium (see above) + // but trees >500 tips are very slow to load + return !tangle; + }, + description() { + return this.valid() ? ( + <> + View this data in MicrobeTrace (learn more). + {mainTreeNumTips>500 && ( + + {` Note that trees with over 500 tips may have trouble loading (this one has ${mainTreeNumTips}).`} + + )} + + ) : ( + <> + {`The current dataset isn't viewable in MicrobeTrace ${tangle ? `as tanglegrams aren't supported` : ''}`} + + ) + }, + url() { + /** + * As of 2024-04-09, the 'origin' must be nextstrain.org or next.nextstrain.org + * for these links to work. This means (nextstrain.org) the links coming from heroku + * review apps will not work. + */ + const baseUrl = 'https://microbetrace.cdc.gov/MicrobeTrace'; + return `${baseUrl}?url=${encodeURIComponent(`${origin}${pathname}`)}` + }, + }, ] }