From b47e13f9850e02dc410fbead698bdb375cba0089 Mon Sep 17 00:00:00 2001 From: Chaoran Chen Date: Mon, 6 May 2024 23:21:42 +0200 Subject: [PATCH] feat(website): move FASTA download button and improve sequence viewer (#1771) --- .../DownloadDialog/DownloadDialog.tsx | 10 +-- .../src/components/SearchPage/SearchForm.tsx | 14 +--- .../SequencesDataTableTitle.astro | 81 ++++++++++++------- .../SequencesDetailsPage.astro | 8 -- website/src/components/common/BoxWithTabs.tsx | 6 +- .../pages/seq/[accessionVersion]/index.astro | 6 +- website/src/styles/base.scss | 7 ++ 7 files changed, 68 insertions(+), 64 deletions(-) diff --git a/website/src/components/SearchPage/DownloadDialog/DownloadDialog.tsx b/website/src/components/SearchPage/DownloadDialog/DownloadDialog.tsx index 5ccc9654b..010eae04a 100644 --- a/website/src/components/SearchPage/DownloadDialog/DownloadDialog.tsx +++ b/website/src/components/SearchPage/DownloadDialog/DownloadDialog.tsx @@ -45,15 +45,7 @@ export const DownloadDialog: FC = ({ return ( <> - diff --git a/website/src/components/SearchPage/SearchForm.tsx b/website/src/components/SearchPage/SearchForm.tsx index a05a59a72..ac5f84ac2 100644 --- a/website/src/components/SearchPage/SearchForm.tsx +++ b/website/src/components/SearchPage/SearchForm.tsx @@ -275,19 +275,7 @@ const SearchField: FC = (props) => { }; const SearchButton: FC<{ isLoading: boolean }> = ({ isLoading }) => ( - ); diff --git a/website/src/components/SequenceDetailsPage/SequencesDataTableTitle.astro b/website/src/components/SequenceDetailsPage/SequencesDataTableTitle.astro index 4e3e2630f..43d60ffed 100644 --- a/website/src/components/SequenceDetailsPage/SequencesDataTableTitle.astro +++ b/website/src/components/SequenceDetailsPage/SequencesDataTableTitle.astro @@ -3,17 +3,19 @@ import { sentenceCase } from 'change-case'; import { routes } from '../../routes/routes'; import { type SequenceEntryHistory } from '../../types/lapis'; -import { getAccessionVersionString } from '../../utils/extractAccessionVersion'; import { getVersionStatusColor } from '../../utils/getVersionStatusColor'; +import IcBaselineDownload from '~icons/ic/baseline-download'; +import IcBaselineHistory from '~icons/ic/baseline-history'; import Arrow from '~icons/ic/sharp-keyboard-arrow-down'; interface Props { sequenceEntryHistory?: SequenceEntryHistory; organism: string; accessionVersion: string; + showFastaDownload: boolean; } -const { sequenceEntryHistory, accessionVersion } = Astro.props; +const { sequenceEntryHistory, accessionVersion, showFastaDownload } = Astro.props; ---
@@ -21,32 +23,53 @@ const { sequenceEntryHistory, accessionVersion } = Astro.props;

{accessionVersion}

- { - sequenceEntryHistory !== undefined && sequenceEntryHistory.length > 1 && ( - - ) - } + + + + +
+ + + +
+ + ) + } + { + showFastaDownload && ( + + + + + + + ) + } + diff --git a/website/src/components/SequenceDetailsPage/SequencesDetailsPage.astro b/website/src/components/SequenceDetailsPage/SequencesDetailsPage.astro index 82909cb28..5ec1c7998 100644 --- a/website/src/components/SequenceDetailsPage/SequencesDetailsPage.astro +++ b/website/src/components/SequenceDetailsPage/SequencesDetailsPage.astro @@ -62,14 +62,6 @@ const loadSequencesAutomatically = getSchema(organism).loadSequencesAutomaticall ) } -
= ({ isActive, label, onClick }) => ( - ); @@ -24,6 +24,4 @@ type BoxWithTabsBoxProps = { children: ReactNode; }; -export const BoxWithTabsBox: FC = ({ children }) => ( -
{children}
-); +export const BoxWithTabsBox: FC = ({ children }) =>
{children}
; diff --git a/website/src/pages/seq/[accessionVersion]/index.astro b/website/src/pages/seq/[accessionVersion]/index.astro index 381ad8113..93e10e556 100644 --- a/website/src/pages/seq/[accessionVersion]/index.astro +++ b/website/src/pages/seq/[accessionVersion]/index.astro @@ -44,10 +44,14 @@ if ( accessionVersion={accessionVersion} organism={organism} sequenceEntryHistory={ - sequenceDetailsTableData.isOk() && result.type === SequenceDetailsTableResultType.TABLE_DATA + result.type === SequenceDetailsTableResultType.TABLE_DATA ? result.sequenceEntryHistory : undefined } + showFastaDownload={ + result.type === SequenceDetailsTableResultType.TABLE_DATA && + !isRevocationEntry(result.tableData) + } /> {result.type === SequenceDetailsTableResultType.TABLE_DATA && (isRevocationEntry(result.tableData) ? ( diff --git a/website/src/styles/base.scss b/website/src/styles/base.scss index 70dd06e8b..9b5081cc5 100644 --- a/website/src/styles/base.scss +++ b/website/src/styles/base.scss @@ -41,6 +41,13 @@ a { font-weight: 400; } +@layer utilities { + .outlineButton { + @apply normal-case py-2 rounded-md font-semibold px-4 text-sm border-primary-600 border text-primary-600 bg-white + hover:bg-primary-600 hover:text-white; + } +} + .loculusColor{ background: theme('colors.main'); &:hover {