From 3cb7cdeb01b30476d7fd07927786a2e76e1270a2 Mon Sep 17 00:00:00 2001 From: Theo Sanderson Date: Sun, 25 Feb 2024 21:09:29 +0000 Subject: [PATCH] Add organism selector for browse and submit pages (#1113) * add organism selector * update --- .../organism-selector/[redirectTo].astro | 45 +++++++++++++++++++ website/src/routes.ts | 11 ++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 website/src/pages/organism-selector/[redirectTo].astro diff --git a/website/src/pages/organism-selector/[redirectTo].astro b/website/src/pages/organism-selector/[redirectTo].astro new file mode 100644 index 000000000..c2e3a17b7 --- /dev/null +++ b/website/src/pages/organism-selector/[redirectTo].astro @@ -0,0 +1,45 @@ +--- +import { getConfiguredOrganisms } from '../../config'; +import BaseLayout from '../../layouts/BaseLayout.astro'; +import { routes } from '../../routes'; +const redirectTo = Astro.params.redirectTo; + +const purposes: { [key: string]: string } = { + submit: 'for which you want to submit data', + search: 'for which you want to browse data', +}; + +interface Routes { + [key: string]: (organism: string) => string; +} + +const myRoutes: Routes = { + submit: routes.submitPage, + search: routes.searchPage, +}; + +const purpose = purposes[redirectTo!]; +--- + + +
+

+ Please select an organism {purpose}. +

+ +
+ { + getConfiguredOrganisms().map(({ key, displayName, image, description }) => ( + + {image !== undefined && {displayName}} +

{displayName}

+

{description}

+
+ )) + } +
+
+
diff --git a/website/src/routes.ts b/website/src/routes.ts index 3996b037c..fbbc18f93 100644 --- a/website/src/routes.ts +++ b/website/src/routes.ts @@ -72,6 +72,7 @@ export const routes = { }, notFoundPage: () => `/404`, logout: () => '/logout', + organismSelectorPage: (redirectTo: string) => `/organism-selector/${redirectTo}`, }; export type ClassOfSearchPageType = 'SEARCH' | 'MY_SEQUENCES'; @@ -177,6 +178,14 @@ export const navigationItems = { function topNavigationItems(organism: string | undefined) { if (organism === undefined) { return [ + { + text: 'Browse', + path: routes.organismSelectorPage('search'), + }, + { + text: 'Submit', + path: routes.organismSelectorPage('submit'), + }, { text: 'User', path: routes.userOverviewPage(), @@ -190,7 +199,7 @@ function topNavigationItems(organism: string | undefined) { return [ { - text: 'Search', + text: 'Browse', path: routes.searchPage(organism), }, {