Skip to content

Commit

Permalink
feat(website): Show organisms on landing page #543
Browse files Browse the repository at this point in the history
  • Loading branch information
fengelniederhammer committed Nov 27, 2023
1 parent dfcab5e commit 5a573be
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions website/src/components/Navigation/Navigation.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import { SandwichMenu } from './SandwichMenu.tsx';
import { getConfiguredOrganisms } from '../../config';
import { navigationItems } from '../../routes';
import { navigationItems, routes } from '../../routes';
let organism = Astro.params.organism;
Expand All @@ -21,7 +21,7 @@ const label = organism === undefined ? 'Choose Organism' : `Organism ${organism}
{
organisms.map((organism) => (
<li>
<a href={`/${organism}`}>{organism}</a>
<a href={routes.organismStartPage(organism)}>{organism}</a>
</li>
))
}
Expand Down
15 changes: 15 additions & 0 deletions website/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
---
import { getConfiguredOrganisms, getSchema } from '../config';
import BaseLayout from '../layouts/BaseLayout.astro';
import { routes } from '../routes';
const organisms = getConfiguredOrganisms().map((organism) => ({
organism,
name: getSchema(organism).instanceName,
}));
---

<BaseLayout title='Home'>
<h1 class='title'>Pathoplexus</h1>
<h2 class='font-bold'>Explore the data</h2>
{
organisms.map(({ organism, name }) => (
<p>
<a href={routes.organismStartPage(organism)}>{name}</a>
</p>
))
}
</BaseLayout>
1 change: 1 addition & 0 deletions website/src/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function withOrganism(organism: string, path: `/${string}`) {
}

export const routes = {
organismStartPage: (organism: string) => `/${organism}`,
searchPage: (organism: string, searchFilter: Filter[] = [], page: number = 1) =>
withOrganism(organism, `/search?${buildSearchParams(searchFilter, page).toString()}`),
sequencesDetailsPage: (organism: string, accessionVersion: string) => `/${organism}/sequences/${accessionVersion}`,
Expand Down

0 comments on commit 5a573be

Please sign in to comment.