From 5ecd0dcbb942a9d1bce1706a7375075a47836338 Mon Sep 17 00:00:00 2001 From: ivan-aksamentov Date: Fri, 20 Oct 2023 14:12:09 +0200 Subject: [PATCH] fix(web): prevent access to export page before files are ready --- .../src/components/Layout/NavigationBar.tsx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages_rs/nextclade-web/src/components/Layout/NavigationBar.tsx b/packages_rs/nextclade-web/src/components/Layout/NavigationBar.tsx index 6cebb639d..ec09f0e25 100644 --- a/packages_rs/nextclade-web/src/components/Layout/NavigationBar.tsx +++ b/packages_rs/nextclade-web/src/components/Layout/NavigationBar.tsx @@ -11,7 +11,7 @@ import { BsCaretRightFill as ArrowRight } from 'react-icons/bs' import { Link } from 'src/components/Link/Link' import { FaDocker, FaGithub, FaXTwitter, FaDiscourse } from 'react-icons/fa6' import { LinkSmart } from 'src/components/Link/LinkSmart' -import { hasRanAtom, hasTreeAtom } from 'src/state/results.state' +import { canDownloadAtom, hasRanAtom, hasTreeAtom } from 'src/state/results.state' import styled, { useTheme } from 'styled-components' import { useTranslationSafe } from 'src/helpers/useTranslationSafe' import BrandLogoBase from 'src/assets/img/nextclade_logo.svg' @@ -132,6 +132,7 @@ export function NavigationBar() { const hasTree = useRecoilValue(hasTreeAtom) const hasRan = useRecoilValue(hasRanAtom) + const canDownload = useRecoilValue(canDownloadAtom) const linksLeft = useMemo(() => { return [ @@ -147,9 +148,9 @@ export function NavigationBar() { title: hasTree ? t('Show phylogenetic tree') : t('Please run the analysis on a dataset with reference tree'), }, { - url: hasRan ? '/export' : undefined, + url: canDownload ? '/export' : undefined, content: t('Export'), - title: hasRan ? t('Export results') : t('Please run the analysis first.'), + title: canDownload ? t('Export results') : t('Please run the analysis first.'), }, ].map((desc, i) => { const link = @@ -159,7 +160,7 @@ export function NavigationBar() { const arrow = return [arrow, link] }) - }, [hasRan, hasTree, pathname, t]) + }, [canDownload, hasRan, hasTree, pathname, t]) const linksRight = useMemo(() => { return [