diff --git a/website/src/components/DatasetCitations/DatasetList.tsx b/website/src/components/DatasetCitations/DatasetList.tsx index 113f4c6a6..5d62fb650 100644 --- a/website/src/components/DatasetCitations/DatasetList.tsx +++ b/website/src/components/DatasetCitations/DatasetList.tsx @@ -11,7 +11,7 @@ import TableSortLabel from '@mui/material/TableSortLabel'; import { visuallyHidden } from '@mui/utils'; import { type FC, type MouseEvent, type ChangeEvent, useState, useMemo } from 'react'; -import { routes } from '../../routes'; +import { routes } from '../../routes/routes'; import type { Dataset } from '../../types/datasetCitation'; type Order = 'asc' | 'desc'; diff --git a/website/src/components/Edit/EditPage.tsx b/website/src/components/Edit/EditPage.tsx index 7ee4c0957..42b28f464 100644 --- a/website/src/components/Edit/EditPage.tsx +++ b/website/src/components/Edit/EditPage.tsx @@ -4,7 +4,7 @@ import { type Dispatch, type FC, Fragment, type SetStateAction, useMemo, useRef, import { EditableDataRow, ProcessedDataRow } from './DataRow.tsx'; import type { Row } from './InputField.tsx'; import { getClientLogger } from '../../clientLogger.ts'; -import { routes } from '../../routes.ts'; +import { routes } from '../../routes/routes.ts'; import { backendClientHooks } from '../../services/serviceHooks.ts'; import { ACCESSION_FIELD } from '../../settings.ts'; import type { MetadataRecord, ProcessingAnnotationSourceType, SequenceEntryToEdit } from '../../types/backend.ts'; diff --git a/website/src/components/MySequencesPage/MySequencesGroupSelector.tsx b/website/src/components/MySequencesPage/MySequencesGroupSelector.tsx index 4dfc4fae0..2b7135ff3 100644 --- a/website/src/components/MySequencesPage/MySequencesGroupSelector.tsx +++ b/website/src/components/MySequencesPage/MySequencesGroupSelector.tsx @@ -1,6 +1,6 @@ import { type FC } from 'react'; -import { routes } from '../../routes'; +import { routes } from '../../routes/routes'; type GroupSelectorProps = { groupNames: string[]; diff --git a/website/src/components/Navigation/Navigation.astro b/website/src/components/Navigation/Navigation.astro index 87274342f..0181de5cc 100644 --- a/website/src/components/Navigation/Navigation.astro +++ b/website/src/components/Navigation/Navigation.astro @@ -1,7 +1,7 @@ --- import { SandwichMenu } from './SandwichMenu.tsx'; import { cleanOrganism } from './cleanOrganism'; -import { navigationItems } from '../../routes'; +import { navigationItems } from '../../routes/navigationItems'; import { getAuthUrl } from '../../utils/getAuthUrl'; const { organism } = cleanOrganism(Astro.params.organism); diff --git a/website/src/components/Navigation/OrganismSelector.astro b/website/src/components/Navigation/OrganismSelector.astro index 4c8a4b58d..f9c5000e9 100644 --- a/website/src/components/Navigation/OrganismSelector.astro +++ b/website/src/components/Navigation/OrganismSelector.astro @@ -1,7 +1,7 @@ --- import { cleanOrganism } from './cleanOrganism'; import { type Organism } from '../../config'; -import { routes } from '../../routes'; +import { routes } from '../../routes/routes'; import IwwaArrowDown from '~icons/iwwa/arrow-down'; const { knownOrganisms, organism: originalOrganism } = cleanOrganism(Astro.params.organism); diff --git a/website/src/components/Navigation/SandwichMenu.tsx b/website/src/components/Navigation/SandwichMenu.tsx index da80799e3..c6ec6da74 100644 --- a/website/src/components/Navigation/SandwichMenu.tsx +++ b/website/src/components/Navigation/SandwichMenu.tsx @@ -2,7 +2,7 @@ import type { FC } from 'react'; import type { Organism } from '../../config.ts'; import { useOffCanvas } from '../../hooks/useOffCanvas'; -import { navigationItems } from '../../routes.ts'; +import { navigationItems } from '../../routes/navigationItems'; import { OffCanvasOverlay } from '../OffCanvasOverlay'; import { SandwichIcon } from '../SandwichIcon'; diff --git a/website/src/components/ReviewPage/ReviewPage.tsx b/website/src/components/ReviewPage/ReviewPage.tsx index b6d73923c..51403076d 100644 --- a/website/src/components/ReviewPage/ReviewPage.tsx +++ b/website/src/components/ReviewPage/ReviewPage.tsx @@ -4,7 +4,7 @@ import { type ChangeEvent, type FC, useState } from 'react'; import { ReviewCard } from './ReviewCard.tsx'; import { useSubmissionOperations } from '../../hooks/useSubmissionOperations.ts'; -import { routes } from '../../routes.ts'; +import { routes } from '../../routes/routes.ts'; import { approveAllDataScope, awaitingApprovalStatus, diff --git a/website/src/components/SearchPage/SearchForm.spec.tsx b/website/src/components/SearchPage/SearchForm.spec.tsx index 15e9d7e4c..798e6280a 100644 --- a/website/src/components/SearchPage/SearchForm.spec.tsx +++ b/website/src/components/SearchPage/SearchForm.spec.tsx @@ -5,7 +5,7 @@ import { beforeEach, describe, expect, test, vi } from 'vitest'; import { SearchForm } from './SearchForm'; import { testConfig, testOrganism } from '../../../vitest.setup.ts'; -import { routes, SEARCH } from '../../routes.ts'; +import { routes, SEARCH } from '../../routes/routes.ts'; import type { MetadataFilter } from '../../types/config.ts'; import type { ReferenceGenomesSequenceNames } from '../../types/referencesGenomes.ts'; import type { ClientConfig } from '../../types/runtimeConfig.ts'; diff --git a/website/src/components/SearchPage/SearchForm.tsx b/website/src/components/SearchPage/SearchForm.tsx index fd0fb0eb4..b9c26a535 100644 --- a/website/src/components/SearchPage/SearchForm.tsx +++ b/website/src/components/SearchPage/SearchForm.tsx @@ -14,7 +14,7 @@ import { PangoLineageField } from './fields/PangoLineageField'; import { getClientLogger } from '../../clientLogger.ts'; import { getLapisUrl } from '../../config.ts'; import { useOffCanvas } from '../../hooks/useOffCanvas'; -import { routes, navigateToSearchLikePage, type ClassOfSearchPageType } from '../../routes.ts'; +import { routes, navigateToSearchLikePage, type ClassOfSearchPageType } from '../../routes/routes.ts'; import type { AccessionFilter, MetadataFilter, MutationFilter } from '../../types/config.ts'; import type { ReferenceGenomesSequenceNames } from '../../types/referencesGenomes.ts'; import type { ClientConfig } from '../../types/runtimeConfig.ts'; diff --git a/website/src/components/SearchPage/SearchPagination.tsx b/website/src/components/SearchPage/SearchPagination.tsx index e5ede6530..307b6430a 100644 --- a/website/src/components/SearchPage/SearchPagination.tsx +++ b/website/src/components/SearchPage/SearchPagination.tsx @@ -1,7 +1,7 @@ import { Pagination as MUIPagination } from '@mui/material'; import type { FC } from 'react'; -import { navigateToSearchLikePage, type ClassOfSearchPageType } from '../../routes'; +import { navigateToSearchLikePage, type ClassOfSearchPageType } from '../../routes/routes'; import type { AccessionFilter, MetadataFilter, MutationFilter } from '../../types/config.ts'; import type { OrderBy } from '../../types/lapis.ts'; diff --git a/website/src/components/SearchPage/Table.tsx b/website/src/components/SearchPage/Table.tsx index 3fffa524e..986af4a0b 100644 --- a/website/src/components/SearchPage/Table.tsx +++ b/website/src/components/SearchPage/Table.tsx @@ -1,7 +1,7 @@ import { capitalCase } from 'change-case'; import type { FC, ReactElement } from 'react'; -import { routes, navigateToSearchLikePage, type ClassOfSearchPageType } from '../../routes.ts'; +import { routes, navigateToSearchLikePage, type ClassOfSearchPageType } from '../../routes/routes.ts'; import type { AccessionFilter, MetadataFilter, MutationFilter, Schema } from '../../types/config.ts'; import type { OrderBy } from '../../types/lapis.ts'; import MdiTriangle from '~icons/mdi/triangle'; diff --git a/website/src/components/SequenceDetailsPage/RevokeButton.tsx b/website/src/components/SequenceDetailsPage/RevokeButton.tsx index 27da7649f..92d143cfe 100644 --- a/website/src/components/SequenceDetailsPage/RevokeButton.tsx +++ b/website/src/components/SequenceDetailsPage/RevokeButton.tsx @@ -1,7 +1,7 @@ import { type FC } from 'react'; import { toast } from 'react-toastify'; -import { routes } from '../../routes'; +import { routes } from '../../routes/routes'; import { backendClientHooks } from '../../services/serviceHooks'; import type { ClientConfig } from '../../types/runtimeConfig'; import { createAuthorizationHeader } from '../../utils/createAuthorizationHeader'; diff --git a/website/src/components/SequenceDetailsPage/SequencesBanner.astro b/website/src/components/SequenceDetailsPage/SequencesBanner.astro index be2b31467..2be2e807f 100644 --- a/website/src/components/SequenceDetailsPage/SequencesBanner.astro +++ b/website/src/components/SequenceDetailsPage/SequencesBanner.astro @@ -1,6 +1,6 @@ --- import { getLatestAccessionVersion } from './getTableData'; -import { routes } from '../../routes.ts'; +import { routes } from '../../routes/routes.ts'; import { type SequenceEntryHistory, siloVersionStatuses } from '../../types/lapis'; import { getAccessionVersionString } from '../../utils/extractAccessionVersion'; diff --git a/website/src/components/SequenceDetailsPage/SequencesDataTableTitle.astro b/website/src/components/SequenceDetailsPage/SequencesDataTableTitle.astro index eaf990e15..cd6e1e828 100644 --- a/website/src/components/SequenceDetailsPage/SequencesDataTableTitle.astro +++ b/website/src/components/SequenceDetailsPage/SequencesDataTableTitle.astro @@ -1,7 +1,7 @@ --- import { sentenceCase } from 'change-case'; -import { routes } from '../../routes'; +import { routes } from '../../routes/routes'; import { type SequenceEntryHistory } from '../../types/lapis'; import { getAccessionVersionString } from '../../utils/extractAccessionVersion'; import { getVersionStatusColor } from '../../utils/getVersionStatusColor'; diff --git a/website/src/components/SequenceDetailsPage/SequencesDetailsPage.astro b/website/src/components/SequenceDetailsPage/SequencesDetailsPage.astro index b777e52a2..eb830c945 100644 --- a/website/src/components/SequenceDetailsPage/SequencesDetailsPage.astro +++ b/website/src/components/SequenceDetailsPage/SequencesDetailsPage.astro @@ -4,7 +4,7 @@ import { RevokeButton } from './RevokeButton'; import { SequencesContainer } from './SequencesContainer'; import { type TableDataEntry } from './getTableData'; import { getReferenceGenomes, getRuntimeConfig } from '../../config'; -import { routes } from '../../routes.ts'; +import { routes } from '../../routes/routes.ts'; import { GroupManagementClient } from '../../services/groupManagementClient'; import { type DataUseTermsHistoryEntry } from '../../types/backend'; import { type Group } from '../../types/backend.ts'; diff --git a/website/src/components/Submission/DataUploadForm.tsx b/website/src/components/Submission/DataUploadForm.tsx index 6e670a09a..7c4b5f64a 100644 --- a/website/src/components/Submission/DataUploadForm.tsx +++ b/website/src/components/Submission/DataUploadForm.tsx @@ -6,7 +6,7 @@ import { type FormEvent, useState, useRef, useEffect, useCallback, type ElementT import { DateChangeModal } from './DateChangeModal'; import { getClientLogger } from '../../clientLogger.ts'; -import { routes } from '../../routes.ts'; +import { routes } from '../../routes/routes.ts'; import { backendApi } from '../../services/backendApi.ts'; import { backendClientHooks } from '../../services/serviceHooks.ts'; import { diff --git a/website/src/components/Submission/RevisionForm.tsx b/website/src/components/Submission/RevisionForm.tsx index 9821e92d4..67bf23db1 100644 --- a/website/src/components/Submission/RevisionForm.tsx +++ b/website/src/components/Submission/RevisionForm.tsx @@ -1,7 +1,7 @@ import { type FC } from 'react'; import { DataUploadForm } from './DataUploadForm.tsx'; -import { routes } from '../../routes.ts'; +import { routes } from '../../routes/routes.ts'; import { type Group } from '../../types/backend.ts'; import type { ClientConfig } from '../../types/runtimeConfig.ts'; import { ManagedErrorFeedback, useErrorFeedbackState } from '../common/ManagedErrorFeedback'; diff --git a/website/src/components/Submission/SubmissionForm.tsx b/website/src/components/Submission/SubmissionForm.tsx index edc512ba3..358c83fa6 100644 --- a/website/src/components/Submission/SubmissionForm.tsx +++ b/website/src/components/Submission/SubmissionForm.tsx @@ -1,7 +1,7 @@ import { type FC } from 'react'; import { DataUploadForm } from './DataUploadForm.tsx'; -import { routes } from '../../routes.ts'; +import { routes } from '../../routes/routes.ts'; import { type Group } from '../../types/backend.ts'; import type { ClientConfig } from '../../types/runtimeConfig.ts'; import { ManagedErrorFeedback, useErrorFeedbackState } from '../common/ManagedErrorFeedback'; diff --git a/website/src/components/User/GroupCreationForm.tsx b/website/src/components/User/GroupCreationForm.tsx index 0dfa3e43b..8feb3479e 100644 --- a/website/src/components/User/GroupCreationForm.tsx +++ b/website/src/components/User/GroupCreationForm.tsx @@ -2,7 +2,7 @@ import { type ComponentProps, type FC, type FormEvent, type PropsWithChildren, u import { listOfCountries } from './listOfCountries.ts'; import { useGroupCreation } from '../../hooks/useGroupOperations.ts'; -import { routes } from '../../routes.ts'; +import { routes } from '../../routes/routes.ts'; import { type ClientConfig } from '../../types/runtimeConfig.ts'; import { ErrorFeedback } from '../ErrorFeedback.tsx'; import { withQueryProvider } from '../common/withQueryProvider.tsx'; diff --git a/website/src/components/User/GroupPage.tsx b/website/src/components/User/GroupPage.tsx index 601a95730..35aa6e1cc 100644 --- a/website/src/components/User/GroupPage.tsx +++ b/website/src/components/User/GroupPage.tsx @@ -1,7 +1,7 @@ import { type FC, type FormEvent, useRef, useState } from 'react'; import { useGroupPageHooks } from '../../hooks/useGroupOperations.ts'; -import { routes } from '../../routes.ts'; +import { routes } from '../../routes/routes.ts'; import type { Address, GroupDetails } from '../../types/backend.ts'; import { type ClientConfig } from '../../types/runtimeConfig.ts'; import { ConfirmationDialog } from '../DeprecatedConfirmationDialog.tsx'; diff --git a/website/src/components/User/ListOfGroupsOfUser.tsx b/website/src/components/User/ListOfGroupsOfUser.tsx index 097fcdf6d..f48436a14 100644 --- a/website/src/components/User/ListOfGroupsOfUser.tsx +++ b/website/src/components/User/ListOfGroupsOfUser.tsx @@ -1,7 +1,7 @@ import { type FC, useState } from 'react'; import { useRemoveFromGroup } from '../../hooks/useGroupOperations.ts'; -import { routes } from '../../routes.ts'; +import { routes } from '../../routes/routes.ts'; import type { Group } from '../../types/backend.ts'; import type { ClientConfig } from '../../types/runtimeConfig.ts'; import { displayConfirmationDialog } from '../ConfirmationDialog.tsx'; diff --git a/website/src/components/User/UserPage.astro b/website/src/components/User/UserPage.astro index 002289ff6..fcc19fd54 100644 --- a/website/src/components/User/UserPage.astro +++ b/website/src/components/User/UserPage.astro @@ -2,7 +2,7 @@ import { ListOfGroupsOfUser } from './ListOfGroupsOfUser.tsx'; import { getRuntimeConfig } from '../../config'; import BaseLayout from '../../layouts/BaseLayout.astro'; -import { routes } from '../../routes'; +import { routes } from '../../routes/routes'; import { GroupManagementClient } from '../../services/groupManagementClient'; import { KeycloakClientManager } from '../../utils/KeycloakClientManager'; import { getAccessToken } from '../../utils/getAccessToken'; diff --git a/website/src/layouts/BaseLayout.astro b/website/src/layouts/BaseLayout.astro index 1a5f79ced..977c56a63 100644 --- a/website/src/layouts/BaseLayout.astro +++ b/website/src/layouts/BaseLayout.astro @@ -6,7 +6,7 @@ import Navigation from '../components/Navigation/Navigation.astro'; import OrganismSelector from '../components/Navigation/OrganismSelector.astro'; import { getWebsiteConfig } from '../config'; import 'react-toastify/dist/ReactToastify.css'; -import { navigationItems } from '../routes'; +import { navigationItems } from '../routes/navigationItems'; const websiteConfig = getWebsiteConfig(); const { name: websiteName, logo } = websiteConfig; diff --git a/website/src/pages/[organism]/my_sequences.astro b/website/src/pages/[organism]/my_sequences.astro index 605c718a4..528075eb8 100644 --- a/website/src/pages/[organism]/my_sequences.astro +++ b/website/src/pages/[organism]/my_sequences.astro @@ -1,6 +1,6 @@ --- import BaseLayout from '../../layouts/BaseLayout.astro'; -import { routes } from '../../routes'; +import { routes } from '../../routes/routes'; import { GroupManagementClient } from '../../services/groupManagementClient'; import { getAccessToken } from '../../utils/getAccessToken'; diff --git a/website/src/pages/[organism]/my_sequences/[group].astro b/website/src/pages/[organism]/my_sequences/[group].astro index a333dbabd..9957dc33d 100644 --- a/website/src/pages/[organism]/my_sequences/[group].astro +++ b/website/src/pages/[organism]/my_sequences/[group].astro @@ -5,7 +5,7 @@ import { SearchPagination } from '../../../components/SearchPage/SearchPaginatio import { Table } from '../../../components/SearchPage/Table'; import ErrorBox from '../../../components/common/ErrorBox.astro'; import BaseLayout from '../../../layouts/BaseLayout.astro'; -import { MY_SEQUENCES } from '../../../routes'; +import { MY_SEQUENCES } from '../../../routes/routes'; import { GroupManagementClient } from '../../../services/groupManagementClient'; import { pageSize } from '../../../settings'; import { getAccessToken } from '../../../utils/getAccessToken'; diff --git a/website/src/pages/[organism]/search/index.astro b/website/src/pages/[organism]/search/index.astro index 89674a17c..756bf3d74 100644 --- a/website/src/pages/[organism]/search/index.astro +++ b/website/src/pages/[organism]/search/index.astro @@ -5,7 +5,7 @@ import { SearchPagination } from '../../../components/SearchPage/SearchPaginatio import { Table } from '../../../components/SearchPage/Table'; import ErrorBox from '../../../components/common/ErrorBox.astro'; import BaseLayout from '../../../layouts/BaseLayout.astro'; -import { SEARCH } from '../../../routes'; +import { SEARCH } from '../../../routes/routes'; import { pageSize } from '../../../settings'; import { processParametersAndFetchSearch } from '../../../utils/processParametersAndFetchSearch'; const { diff --git a/website/src/pages/[organism]/submission/index.astro b/website/src/pages/[organism]/submission/index.astro index 69455cf4a..8046ad541 100644 --- a/website/src/pages/[organism]/submission/index.astro +++ b/website/src/pages/[organism]/submission/index.astro @@ -1,7 +1,7 @@ --- import { cleanOrganism } from '../../../components/Navigation/cleanOrganism'; import BaseLayout from '../../../layouts/BaseLayout.astro'; -import { routes } from '../../../routes'; +import { routes } from '../../../routes/routes'; const { organism } = cleanOrganism(Astro.params.organism); --- diff --git a/website/src/pages/index.astro b/website/src/pages/index.astro index d0461d97a..5f31e3cc6 100644 --- a/website/src/pages/index.astro +++ b/website/src/pages/index.astro @@ -1,7 +1,7 @@ --- import { getConfiguredOrganisms, getWebsiteConfig } from '../config'; import BaseLayout from '../layouts/BaseLayout.astro'; -import { routes } from '../routes'; +import { routes } from '../routes/routes'; const websiteConfig = getWebsiteConfig(); const { name: websiteName } = websiteConfig; --- diff --git a/website/src/pages/organism-selector/[redirectTo].astro b/website/src/pages/organism-selector/[redirectTo].astro index c2e3a17b7..1fbfc23a8 100644 --- a/website/src/pages/organism-selector/[redirectTo].astro +++ b/website/src/pages/organism-selector/[redirectTo].astro @@ -1,7 +1,7 @@ --- import { getConfiguredOrganisms } from '../../config'; import BaseLayout from '../../layouts/BaseLayout.astro'; -import { routes } from '../../routes'; +import { routes } from '../../routes/routes'; const redirectTo = Astro.params.redirectTo; const purposes: { [key: string]: string } = { diff --git a/website/src/pages/seq/[accessionVersion].fa/index.ts b/website/src/pages/seq/[accessionVersion].fa/index.ts index a3f16a770..0d4008b24 100644 --- a/website/src/pages/seq/[accessionVersion].fa/index.ts +++ b/website/src/pages/seq/[accessionVersion].fa/index.ts @@ -3,7 +3,7 @@ import { err, type Result } from 'neverthrow'; import { getConfiguredOrganisms } from '../../../config'; import { getReferenceGenomes } from '../../../config.ts'; -import { routes } from '../../../routes.ts'; +import { routes } from '../../../routes/routes.ts'; import { LapisClient } from '../../../services/lapisClient.ts'; import { type ProblemDetail } from '../../../types/backend.ts'; import { parseAccessionVersionFromString } from '../../../utils/extractAccessionVersion.ts'; diff --git a/website/src/pages/seq/[accessionVersion]/getSequenceDetailsTableData.ts b/website/src/pages/seq/[accessionVersion]/getSequenceDetailsTableData.ts index 79a6d901e..370cc8f31 100644 --- a/website/src/pages/seq/[accessionVersion]/getSequenceDetailsTableData.ts +++ b/website/src/pages/seq/[accessionVersion]/getSequenceDetailsTableData.ts @@ -2,7 +2,7 @@ import { Result } from 'neverthrow'; import { getTableData, type TableDataEntry } from '../../../components/SequenceDetailsPage/getTableData.ts'; import { getSchema } from '../../../config.ts'; -import { routes } from '../../../routes.ts'; +import { routes } from '../../../routes/routes.ts'; import { BackendClient } from '../../../services/backendClient.ts'; import { LapisClient } from '../../../services/lapisClient.ts'; import type { DataUseTermsHistoryEntry, ProblemDetail } from '../../../types/backend.ts'; diff --git a/website/src/pages/seq/[accessionVersion]/versions.astro b/website/src/pages/seq/[accessionVersion]/versions.astro index 44acc1058..6eb671aa2 100644 --- a/website/src/pages/seq/[accessionVersion]/versions.astro +++ b/website/src/pages/seq/[accessionVersion]/versions.astro @@ -4,7 +4,7 @@ import { sentenceCase } from 'change-case'; import ErrorBox from '../../../components/common/ErrorBox.astro'; import { getConfiguredOrganisms } from '../../../config'; import BaseLayout from '../../../layouts/BaseLayout.astro'; -import { routes } from '../../../routes'; +import { routes } from '../../../routes/routes'; import { LapisClient } from '../../../services/lapisClient'; import { extractAccessionVersion, diff --git a/website/src/routes/bottomNavigationItems.ts b/website/src/routes/bottomNavigationItems.ts new file mode 100644 index 000000000..a3f2e7255 --- /dev/null +++ b/website/src/routes/bottomNavigationItems.ts @@ -0,0 +1,23 @@ +import { routes } from './routes.ts'; +export const bottomNavigationItems = [ + { + text: 'About', + path: routes.aboutPage(), + }, + { + text: 'Docs', + path: 'https://loculus-project.github.io/loculus/', + }, + { + text: 'API docs', + path: routes.apiDocumentationPage(), + }, + { + text: 'Governance', + path: routes.governancePage(), + }, + { + text: 'Status', + path: routes.statusPage(), + }, +]; diff --git a/website/src/routes/navigationItems.ts b/website/src/routes/navigationItems.ts new file mode 100644 index 000000000..bb13a7997 --- /dev/null +++ b/website/src/routes/navigationItems.ts @@ -0,0 +1,46 @@ +import { bottomNavigationItems } from './bottomNavigationItems.ts'; +import { routes } from './routes.ts'; +export const navigationItems = { + top: topNavigationItems, + bottom: bottomNavigationItems, +}; + +function topNavigationItems(organism: string | undefined, isLoggedIn: boolean, loginUrl: string | undefined) { + if (organism === undefined) { + return [ + { + text: 'Browse', + path: routes.organismSelectorPage('search'), + }, + { + text: 'Submit', + path: routes.organismSelectorPage('submit'), + }, + ...(isLoggedIn + ? [{ text: 'My account', path: routes.userOverviewPage() }] + : [{ text: 'Login', path: loginUrl! }]), + { + text: 'Datasets', + path: routes.datasetsPage(), + }, + ]; + } + + return [ + { + text: 'Browse', + path: routes.searchPage(organism), + }, + { + text: 'Submit', + path: routes.submissionPage(organism), + }, + ...(isLoggedIn + ? [{ text: 'My account', path: routes.userOverviewPage(organism) }] + : [{ text: 'Login', path: loginUrl! }]), + { + text: 'Datasets', + path: routes.datasetsPage(), + }, + ]; +} diff --git a/website/src/routes.ts b/website/src/routes/routes.ts similarity index 77% rename from website/src/routes.ts rename to website/src/routes/routes.ts index 06c5ff8db..8aa80467d 100644 --- a/website/src/routes.ts +++ b/website/src/routes/routes.ts @@ -1,7 +1,7 @@ -import type { AccessionVersion } from './types/backend.ts'; -import type { AccessionFilter, FilterValue, MutationFilter } from './types/config.ts'; -import type { OrderBy } from './types/lapis.ts'; -import { getAccessionVersionString } from './utils/extractAccessionVersion.ts'; +import type { AccessionVersion } from '../types/backend.ts'; +import type { AccessionFilter, FilterValue, MutationFilter } from '../types/config.ts'; +import type { OrderBy } from '../types/lapis.ts'; +import { getAccessionVersionString } from '../utils/extractAccessionVersion.ts'; const approxMaxUrlLengthForSearch = 1900; export const SEARCH = 'SEARCH'; @@ -161,72 +161,6 @@ const buildSearchParams = ( return params; }; -export const navigationItems = { - top: topNavigationItems, - bottom: [ - { - text: 'About', - path: routes.aboutPage(), - }, - { - text: 'Docs', - path: 'https://loculus-project.github.io/loculus/', - }, - { - text: 'API docs', - path: routes.apiDocumentationPage(), - }, - { - text: 'Governance', - path: routes.governancePage(), - }, - { - text: 'Status', - path: routes.statusPage(), - }, - ], -}; - -function topNavigationItems(organism: string | undefined, isLoggedIn: boolean, loginUrl: string | undefined) { - if (organism === undefined) { - return [ - { - text: 'Browse', - path: routes.organismSelectorPage('search'), - }, - { - text: 'Submit', - path: routes.organismSelectorPage('submit'), - }, - ...(isLoggedIn - ? [{ text: 'My account', path: routes.userOverviewPage() }] - : [{ text: 'Login', path: loginUrl! }]), - { - text: 'Datasets', - path: routes.datasetsPage(), - }, - ]; - } - - return [ - { - text: 'Browse', - path: routes.searchPage(organism), - }, - { - text: 'Submit', - path: routes.submissionPage(organism), - }, - ...(isLoggedIn - ? [{ text: 'My account', path: routes.userOverviewPage(organism) }] - : [{ text: 'Login', path: loginUrl! }]), - { - text: 'Datasets', - path: routes.datasetsPage(), - }, - ]; -} - function withOrganism(organism: string, path: `/${string}`) { return `/${organism}${path}`; } diff --git a/website/src/utils/getAuthUrl.ts b/website/src/utils/getAuthUrl.ts index 8277ec050..2ce3c41c2 100644 --- a/website/src/utils/getAuthUrl.ts +++ b/website/src/utils/getAuthUrl.ts @@ -1,5 +1,5 @@ import { KeycloakClientManager } from './KeycloakClientManager'; -import { routes } from '../routes'; +import { routes } from '../routes/routes'; export const getAuthUrl = async (redirectUrl: string) => { const logout = routes.logout(); diff --git a/website/src/utils/shouldMiddlewareEnforceLogin.spec.ts b/website/src/utils/shouldMiddlewareEnforceLogin.spec.ts index 811faa9f0..6e0359e9c 100644 --- a/website/src/utils/shouldMiddlewareEnforceLogin.spec.ts +++ b/website/src/utils/shouldMiddlewareEnforceLogin.spec.ts @@ -2,7 +2,7 @@ import { describe, expect, test } from 'vitest'; import { shouldMiddlewareEnforceLogin } from './shouldMiddlewareEnforceLogin'; import { testOrganism } from '../../vitest.setup.ts'; -import { routes } from '../routes.ts'; +import { routes } from '../routes/routes.ts'; const otherOrganism = 'otherOrganism'; const configuredOrganisms = [testOrganism, otherOrganism]; diff --git a/website/tests/pages/edit/edit.page.ts b/website/tests/pages/edit/edit.page.ts index c3ee0fd3d..dff3742d0 100644 --- a/website/tests/pages/edit/edit.page.ts +++ b/website/tests/pages/edit/edit.page.ts @@ -1,6 +1,6 @@ import type { Page } from '@playwright/test'; -import { routes } from '../../../src/routes.ts'; +import { routes } from '../../../src/routes/routes.ts'; import type { AccessionVersion } from '../../../src/types/backend.ts'; import { getAccessionVersionString } from '../../../src/utils/extractAccessionVersion.ts'; import { baseUrl, dummyOrganism, expect } from '../../e2e.fixture'; diff --git a/website/tests/pages/review/review.page.ts b/website/tests/pages/review/review.page.ts index 22ea53d11..e561d7baa 100644 --- a/website/tests/pages/review/review.page.ts +++ b/website/tests/pages/review/review.page.ts @@ -1,6 +1,6 @@ import type { Locator, Page } from '@playwright/test'; -import { routes } from '../../../src/routes.ts'; +import { routes } from '../../../src/routes/routes.ts'; import { baseUrl, dummyOrganism, expect } from '../../e2e.fixture'; type ReviewPageOverview = { diff --git a/website/tests/pages/revise/index.spec.ts b/website/tests/pages/revise/index.spec.ts index c421bd70e..ccdd7485d 100644 --- a/website/tests/pages/revise/index.spec.ts +++ b/website/tests/pages/revise/index.spec.ts @@ -1,4 +1,4 @@ -import { routes } from '../../../src/routes.ts'; +import { routes } from '../../../src/routes/routes.ts'; import { baseUrl, dummyOrganism, test, testSequenceCount } from '../../e2e.fixture'; import { prepareDataToBe } from '../../util/prepareDataToBe.ts'; diff --git a/website/tests/pages/revise/revise.page.ts b/website/tests/pages/revise/revise.page.ts index 4a4d35c12..d82b8be78 100644 --- a/website/tests/pages/revise/revise.page.ts +++ b/website/tests/pages/revise/revise.page.ts @@ -3,7 +3,7 @@ import { unlinkSync, writeFileSync } from 'fs'; import type { Locator, Page } from '@playwright/test'; import { v4 as uuid } from 'uuid'; -import { routes } from '../../../src/routes.ts'; +import { routes } from '../../../src/routes/routes.ts'; import type { Accession } from '../../../src/types/backend.ts'; import { baseUrl, dummyOrganism, sequencesTestFile } from '../../e2e.fixture'; import { createModifiedFileContent } from '../../util/createFileContent.ts'; diff --git a/website/tests/pages/search/index.spec.ts b/website/tests/pages/search/index.spec.ts index 8d43d2ce0..bf3da3df3 100644 --- a/website/tests/pages/search/index.spec.ts +++ b/website/tests/pages/search/index.spec.ts @@ -1,6 +1,6 @@ import { DateTime } from 'luxon'; -import { routes } from '../../../src/routes.ts'; +import { routes } from '../../../src/routes/routes.ts'; import { getAccessionVersionString } from '../../../src/utils/extractAccessionVersion.ts'; import { baseUrl, dummyOrganism, expect, test } from '../../e2e.fixture'; import { getTestSequences } from '../../util/testSequenceProvider.ts'; diff --git a/website/tests/pages/search/search.page.ts b/website/tests/pages/search/search.page.ts index c517f5233..2fb383eb8 100644 --- a/website/tests/pages/search/search.page.ts +++ b/website/tests/pages/search/search.page.ts @@ -1,7 +1,7 @@ import type { Locator, Page } from '@playwright/test'; import { baseUrl, dummyOrganism } from '../../e2e.fixture'; -import { routes } from '../../../src/routes.ts'; +import { routes } from '../../../src/routes/routes.ts'; import type { FilterValue } from '../../../src/types/config.ts'; export const ACCESSION = 'Accession'; diff --git a/website/tests/pages/sequences/accession.fa.spec.ts b/website/tests/pages/sequences/accession.fa.spec.ts index 602fb0b91..65b6fdf81 100644 --- a/website/tests/pages/sequences/accession.fa.spec.ts +++ b/website/tests/pages/sequences/accession.fa.spec.ts @@ -1,4 +1,4 @@ -import { routes } from '../../../src/routes.ts'; +import { routes } from '../../../src/routes/routes.ts'; import { getAccessionVersionString } from '../../../src/utils/extractAccessionVersion.ts'; import { baseUrl, expect, test, testSequenceEntryData } from '../../e2e.fixture'; import { getTestSequences } from '../../util/testSequenceProvider.ts'; diff --git a/website/tests/pages/sequences/accession.spec.ts b/website/tests/pages/sequences/accession.spec.ts index 86892df00..4a55836d8 100644 --- a/website/tests/pages/sequences/accession.spec.ts +++ b/website/tests/pages/sequences/accession.spec.ts @@ -1,4 +1,4 @@ -import { routes } from '../../../src/routes.ts'; +import { routes } from '../../../src/routes/routes.ts'; import { getAccessionVersionString } from '../../../src/utils/extractAccessionVersion.ts'; import { baseUrl, expect, test, testSequenceEntryData } from '../../e2e.fixture'; import { getTestSequences } from '../../util/testSequenceProvider.ts'; diff --git a/website/tests/pages/sequences/sequences.page.ts b/website/tests/pages/sequences/sequences.page.ts index 7255841ae..3ef7d3de9 100644 --- a/website/tests/pages/sequences/sequences.page.ts +++ b/website/tests/pages/sequences/sequences.page.ts @@ -1,6 +1,6 @@ import { expect, type Locator, type Page } from '@playwright/test'; -import { routes } from '../../../src/routes.ts'; +import { routes } from '../../../src/routes/routes.ts'; import type { AccessionVersion } from '../../../src/types/backend.ts'; import { getAccessionVersionString } from '../../../src/utils/extractAccessionVersion.ts'; import { baseUrl } from '../../e2e.fixture'; diff --git a/website/tests/pages/submission/index.spec.ts b/website/tests/pages/submission/index.spec.ts index 9c6f85511..5d75f9fc5 100644 --- a/website/tests/pages/submission/index.spec.ts +++ b/website/tests/pages/submission/index.spec.ts @@ -1,4 +1,4 @@ -import { routes } from '../../../src/routes.ts'; +import { routes } from '../../../src/routes/routes.ts'; import { restrictedDataUseTermsType } from '../../../src/types/backend.ts'; import { dateTimeInMonths } from '../../../src/utils/DateTimeInMonths.tsx'; import { baseUrl, dummyOrganism, expect, test, testSequenceCount } from '../../e2e.fixture.ts'; diff --git a/website/tests/pages/submission/submit.page.ts b/website/tests/pages/submission/submit.page.ts index cfbca9a85..20b675eda 100644 --- a/website/tests/pages/submission/submit.page.ts +++ b/website/tests/pages/submission/submit.page.ts @@ -1,6 +1,6 @@ import type { Locator, Page } from '@playwright/test'; -import { routes } from '../../../src/routes.ts'; +import { routes } from '../../../src/routes/routes.ts'; import { baseUrl, compressedMetadataTestFile, diff --git a/website/tests/pages/user/group/group.page.ts b/website/tests/pages/user/group/group.page.ts index 7a8cbedb0..1fc76dfdc 100644 --- a/website/tests/pages/user/group/group.page.ts +++ b/website/tests/pages/user/group/group.page.ts @@ -1,6 +1,6 @@ import type { Page } from '@playwright/test'; -import { routes } from '../../../../src/routes.ts'; +import { routes } from '../../../../src/routes/routes.ts'; import { baseUrl, DEFAULT_GROUP, expect } from '../../../e2e.fixture'; export class GroupPage { diff --git a/website/tests/pages/user/userPage/userPage.ts b/website/tests/pages/user/userPage/userPage.ts index bf25741be..b05a098e3 100644 --- a/website/tests/pages/user/userPage/userPage.ts +++ b/website/tests/pages/user/userPage/userPage.ts @@ -1,6 +1,6 @@ import type { Page } from '@playwright/test'; -import { routes } from '../../../../src/routes.ts'; +import { routes } from '../../../../src/routes/routes.ts'; import { baseUrl, expect } from '../../../e2e.fixture.ts'; export class UserPage {