Skip to content

Commit

Permalink
Merge pull request #419 from GenSpectrum/make_more_generic
Browse files Browse the repository at this point in the history
feat(website): Allow each organism to not include all pages
  • Loading branch information
anna-parker authored Dec 12, 2024
2 parents 167b2fd + 0d280ec commit e492f2e
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 31 deletions.
32 changes: 16 additions & 16 deletions website/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"printWidth": 120,
"tabWidth": 4,
"trailingComma": "all",
"semi": true,
"jsxSingleQuote": true,
"singleQuote": true,
"quoteProps": "consistent",
"plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss"],
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
}
]
"printWidth": 120,
"tabWidth": 4,
"trailingComma": "all",
"semi": true,
"jsxSingleQuote": true,
"singleQuote": true,
"quoteProps": "consistent",
"plugins": ["prettier-plugin-astro", "prettier-plugin-tailwindcss"],
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@
import SelectVariant from './SelectVariant.astro';
import { getDashboardsConfig } from '../../../config';
import SingleVariantOrganismPageLayout from '../../../layouts/OrganismPage/SingleVariantOrganismPageLayout.astro';
import type { Organism } from '../../../types/Organism';
import { chooseGranularityBasedOnDateRange } from '../../../util/chooseGranularityBasedOnDateRange';
import { hasOnlyUndefinedValues } from '../../../util/hasOnlyUndefinedValues';
import { getLineageFilterConfigs, getLineageFilterFields } from '../../../views/View';
import { getLocationSubdivision } from '../../../views/helpers';
import { type OrganismViewKey } from '../../../views/routing';
import { type OrganismViewKey, type OrganismWithViewKey } from '../../../views/routing';
import { ServerSide } from '../../../views/serverSideRouting';
import { singleVariantViewKey } from '../../../views/viewKeys';
import ComponentHeadline from '../../ComponentHeadline.astro';
Expand All @@ -19,8 +18,9 @@ import GsPrevalenceOverTime from '../../genspectrum/GsPrevalenceOverTime.astro';
import { AnalyzeSingleVariantSelectorFallback } from '../../pageStateSelectors/FallbackElement';
import { SingleVariantPageStateSelector } from '../../pageStateSelectors/SingleVariantPageStateSelector';
type OrganismViewCompareVariant = OrganismWithViewKey<typeof singleVariantViewKey>;
interface Props {
organism: Organism;
organism: OrganismViewCompareVariant;
}
const { organism } = Astro.props;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
import { getDashboardsConfig, getLapisUrl } from '../../../config';
import OrganismPageLayout from '../../../layouts/OrganismPage/OrganismPageLayout.astro';
import { type Organism } from '../../../types/Organism';
import { chooseGranularityBasedOnDateRange } from '../../../util/chooseGranularityBasedOnDateRange';
import { getLineageFilterConfigs, getLineageFilterFields } from '../../../views/View';
import { type OrganismViewKey } from '../../../views/routing';
import { type OrganismViewKey, type OrganismWithViewKey } from '../../../views/routing';
import { ServerSide } from '../../../views/serverSideRouting';
import { compareSideBySideViewKey } from '../../../views/viewKeys';
import GsAggregate from '../../genspectrum/GsAggregate.astro';
Expand All @@ -13,8 +12,9 @@ import GsPrevalenceOverTime from '../../genspectrum/GsPrevalenceOverTime.astro';
import { CompareSideBySidePageStateSelector } from '../../pageStateSelectors/CompareSideBySidePageStateSelector';
import { CompareSideBySideSelectorFallback } from '../../pageStateSelectors/FallbackElement';
type OrganismViewCompareVariant = OrganismWithViewKey<typeof compareSideBySideViewKey>;
interface Props {
organism: Organism;
organism: OrganismViewCompareVariant;
}
const { organism } = Astro.props;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
---
import { getDashboardsConfig } from '../../../config';
import SingleVariantOrganismPageLayout from '../../../layouts/OrganismPage/SingleVariantOrganismPageLayout.astro';
import type { Organism } from '../../../types/Organism';
import { chooseGranularityBasedOnDateRange } from '../../../util/chooseGranularityBasedOnDateRange';
import { type OrganismViewKey } from '../../../views/routing';
import { type OrganismViewKey, type OrganismWithViewKey } from '../../../views/routing';
import { ServerSide } from '../../../views/serverSideRouting';
import { compareToBaselineViewKey } from '../../../views/viewKeys';
import ComponentsGrid from '../../ComponentsGrid.astro';
import GsPrevalenceOverTime from '../../genspectrum/GsPrevalenceOverTime.astro';
import { CompareVariantsToBaselineStateSelector } from '../../pageStateSelectors/CompareVariantsToBaselineStateSelector';
import { CompareToBaselineSelectorFallback } from '../../pageStateSelectors/FallbackElement';
type OrganismViewCompareVariant = OrganismWithViewKey<typeof compareToBaselineViewKey>;
interface Props {
organism: Organism;
organism: OrganismViewCompareVariant;
}
const { organism } = Astro.props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
import SelectVariants from './SelectVariants.astro';
import { getDashboardsConfig } from '../../../config';
import SingleVariantOrganismPageLayout from '../../../layouts/OrganismPage/SingleVariantOrganismPageLayout.astro';
import type { Organism } from '../../../types/Organism';
import { chooseGranularityBasedOnDateRange } from '../../../util/chooseGranularityBasedOnDateRange';
import { type OrganismViewKey } from '../../../views/routing';
import { type OrganismViewKey, type OrganismWithViewKey } from '../../../views/routing';
import { ServerSide } from '../../../views/serverSideRouting';
import { compareVariantsViewKey } from '../../../views/viewKeys';
import ComponentsGrid from '../../ComponentsGrid.astro';
Expand All @@ -13,8 +12,9 @@ import GsPrevalenceOverTime from '../../genspectrum/GsPrevalenceOverTime.astro';
import { CompareVariantsPageStateSelector } from '../../pageStateSelectors/CompareVariantsPageStateSelector';
import { CompareVariantsSelectorFallback } from '../../pageStateSelectors/FallbackElement';
type OrganismViewCompareVariant = OrganismWithViewKey<typeof compareVariantsViewKey>;
interface Props {
organism: Organism;
organism: OrganismViewCompareVariant;
}
const { organism } = Astro.props;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
---
import { getDashboardsConfig } from '../../../config';
import SingleVariantOrganismPageLayout from '../../../layouts/OrganismPage/SingleVariantOrganismPageLayout.astro';
import { type Organism } from '../../../types/Organism';
import { chooseGranularityBasedOnDateRange } from '../../../util/chooseGranularityBasedOnDateRange';
import { ComponentHeight } from '../../../views/OrganismConstants';
import { getLocationSubdivision } from '../../../views/helpers';
import { type OrganismViewKey } from '../../../views/routing';
import { type OrganismViewKey, type OrganismWithViewKey } from '../../../views/routing';
import { ServerSide } from '../../../views/serverSideRouting';
import { sequencingEffortsViewKey } from '../../../views/viewKeys';
import ComponentsGrid from '../../ComponentsGrid.astro';
Expand All @@ -14,8 +13,9 @@ import GsNumberSequencesOverTime from '../../genspectrum/GsNumberSequencesOverTi
import { SequencingEffortsSelectorFallback } from '../../pageStateSelectors/FallbackElement';
import { SequencingEffortsPageStateSelector } from '../../pageStateSelectors/SequencingEffortsPageStateSelector';
type OrganismViewCompareVariant = OrganismWithViewKey<typeof sequencingEffortsViewKey>;
interface Props {
organism: Organism;
organism: OrganismViewCompareVariant;
}
const { organism } = Astro.props;
Expand Down
3 changes: 3 additions & 0 deletions website/src/views/routing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ export type OrganismViewKey = {
}[ViewKey<Organism>];
}[keyof ViewsMap];

type OrganismExtractor<T, ViewKey extends string> = T extends `${infer O}.${ViewKey}` ? O : never;
export type OrganismWithViewKey<ViewKey extends string> = OrganismExtractor<OrganismViewKey, ViewKey>;

export class Routing {
public readonly views;
public readonly externalPages;
Expand Down

0 comments on commit e492f2e

Please sign in to comment.