diff --git a/website/package-lock.json b/website/package-lock.json index 0e2c2969..163b336d 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -11,7 +11,7 @@ "dependencies": { "@astrojs/node": "^9.0.0", "@auth/core": "^0.37.4", - "@genspectrum/dashboard-components": "^0.10.3", + "@genspectrum/dashboard-components": "^0.11.0", "@tanstack/react-query": "^5.62.7", "astro": "^5.0.5", "auth-astro": "^4.2.0", @@ -1301,9 +1301,9 @@ "license": "MIT" }, "node_modules/@genspectrum/dashboard-components": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/@genspectrum/dashboard-components/-/dashboard-components-0.10.3.tgz", - "integrity": "sha512-mKU1A9EmUoYiubbKSKx40XxPrToeMCkXYlNw2DwMxU6+1qGv5gDTtQxQvDwmysq2D9DY8ETMpP7nchMQX+wl/w==", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@genspectrum/dashboard-components/-/dashboard-components-0.11.0.tgz", + "integrity": "sha512-0DzbLUwYbrLWfRiJorIQtTn7gBhzZf0TQ2DAdhzqw8roR7s0Gje0+Pn7UvBXRUF3YG7eY8n6fXD/MFLgxe0qXA==", "license": "AGPL-3.0-only", "dependencies": { "@floating-ui/dom": "^1.6.5", @@ -1311,14 +1311,16 @@ "@lit/context": "^1.1.1", "@lit/reactive-element": "^2.0.4", "@lit/task": "^1.0.0", - "chart.js": "^4.4.2", + "chart.js": "^4.4.6", "chartjs-chart-error-bars": "^4.4.0", "chartjs-chart-venn": "^4.3.0", "dayjs": "^1.11.10", "flatpickr": "^4.6.13", "gridjs": "^6.2.0", + "leaflet": "^1.9.4", "lit": "^3.1.3", "preact": "^10.20.1", + "topojson-client": "^3.1.0", "zod": "^3.23.0" } }, @@ -7402,6 +7404,12 @@ "integrity": "sha512-Xq9nH7KlWZmXAtodXDDRE7vs6DU1gTU8zYDHDiWLSip45Egwq3plLHzPn27NgvzL2r1LMPC1vdqh98sQxtqj4A==", "license": "MIT" }, + "node_modules/leaflet": { + "version": "1.9.4", + "resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz", + "integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==", + "license": "BSD-2-Clause" + }, "node_modules/levn": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", @@ -11321,6 +11329,26 @@ "node": ">=0.6" } }, + "node_modules/topojson-client": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/topojson-client/-/topojson-client-3.1.0.tgz", + "integrity": "sha512-605uxS6bcYxGXw9qi62XyrV6Q3xwbndjachmNxu8HWTtVPxZfEJN9fd/SZS1Q54Sn2y0TMyMxFj/cJINqGHrKw==", + "license": "ISC", + "dependencies": { + "commander": "2" + }, + "bin": { + "topo2geo": "bin/topo2geo", + "topomerge": "bin/topomerge", + "topoquantize": "bin/topoquantize" + } + }, + "node_modules/topojson-client/node_modules/commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "license": "MIT" + }, "node_modules/tough-cookie": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-4.1.4.tgz", diff --git a/website/package.json b/website/package.json index 716f20b9..585dea46 100644 --- a/website/package.json +++ b/website/package.json @@ -21,7 +21,7 @@ "dependencies": { "@astrojs/node": "^9.0.0", "@auth/core": "^0.37.4", - "@genspectrum/dashboard-components": "^0.10.3", + "@genspectrum/dashboard-components": "^0.11.0", "@tanstack/react-query": "^5.62.7", "astro": "^5.0.5", "auth-astro": "^4.2.0", diff --git a/website/src/components/genspectrum/GsAggregate.astro b/website/src/components/genspectrum/GsAggregate.astro new file mode 100644 index 00000000..693cf588 --- /dev/null +++ b/website/src/components/genspectrum/GsAggregate.astro @@ -0,0 +1,24 @@ +--- +import { type LapisFilter } from '@genspectrum/dashboard-components/util'; + +import { defaultTablePageSize } from '../../views/View'; +import ComponentWrapper from '../ComponentWrapper.astro'; + +interface Props { + title: string; + height?: string; + fields: string[]; + lapisFilter: LapisFilter; +} + +const { title, height, fields, lapisFilter } = Astro.props; +--- + + + + diff --git a/website/src/components/genspectrum/GsDateRangeSelector.tsx b/website/src/components/genspectrum/GsDateRangeSelector.tsx index ef4d57d6..edb80ee7 100644 --- a/website/src/components/genspectrum/GsDateRangeSelector.tsx +++ b/website/src/components/genspectrum/GsDateRangeSelector.tsx @@ -9,10 +9,10 @@ export function GsDateRangeSelector({ initialValue, dateRangeOptions, earliestDate, - dateColumn, + lapisDateField, width, }: { - dateColumn: string; + lapisDateField: string; onDateRangeChange?: (dateRange: DateRangeOption) => void; initialValue?: DateRangeOption; dateRangeOptions?: DateRangeOption[]; @@ -50,7 +50,7 @@ export function GsDateRangeSelector({ ); } }; - }, [dateRangeOptions, dateColumn, onDateRangeChange, dateRangeSelectorRef]); + }, [dateRangeOptions, lapisDateField, onDateRangeChange, dateRangeSelectorRef]); const isCustom = initialValue?.label === CustomDateRangeLabel; @@ -62,7 +62,7 @@ export function GsDateRangeSelector({ initialValue={isCustom ? undefined : initialValue?.label} initialDateFrom={isCustom ? initialValue.dateFrom : undefined} initialDateTo={isCustom ? initialValue.dateTo : undefined} - dateColumn={dateColumn} + lapisDateField={lapisDateField} width={width} > ); diff --git a/website/src/components/genspectrum/GsLineageFilter.tsx b/website/src/components/genspectrum/GsLineageFilter.tsx index 27cb7ee2..881f1edf 100644 --- a/website/src/components/genspectrum/GsLineageFilter.tsx +++ b/website/src/components/genspectrum/GsLineageFilter.tsx @@ -38,7 +38,7 @@ export function GsLineageFilter({ diff --git a/website/src/components/genspectrum/GsMutationComparison.astro b/website/src/components/genspectrum/GsMutationComparison.astro new file mode 100644 index 00000000..dc899be5 --- /dev/null +++ b/website/src/components/genspectrum/GsMutationComparison.astro @@ -0,0 +1,23 @@ +--- +import type { NamedLapisFilter, SequenceType } from '@genspectrum/dashboard-components/util'; + +import { defaultTablePageSize } from '../../views/View'; +import ComponentWrapper from '../ComponentWrapper.astro'; + +interface Props { + lapisFilters: NamedLapisFilter[]; + sequenceType: SequenceType; +} + +const { lapisFilters, sequenceType } = Astro.props; +--- + + + + diff --git a/website/src/components/genspectrum/GsMutations.astro b/website/src/components/genspectrum/GsMutations.astro new file mode 100644 index 00000000..be446c60 --- /dev/null +++ b/website/src/components/genspectrum/GsMutations.astro @@ -0,0 +1,23 @@ +--- +import type { LapisFilter, SequenceType } from '@genspectrum/dashboard-components/util'; + +import { defaultTablePageSize } from '../../views/View'; +import ComponentWrapper from '../ComponentWrapper.astro'; + +interface Props { + lapisFilter: LapisFilter; + sequenceType: SequenceType; +} + +const { lapisFilter, sequenceType } = Astro.props; +--- + + + + diff --git a/website/src/components/genspectrum/GsMutationsOverTime.astro b/website/src/components/genspectrum/GsMutationsOverTime.astro new file mode 100644 index 00000000..a2cca2bb --- /dev/null +++ b/website/src/components/genspectrum/GsMutationsOverTime.astro @@ -0,0 +1,29 @@ +--- +import type { TemporalGranularity, LapisFilter, SequenceType } from '@genspectrum/dashboard-components/util'; + +import { ComponentHeight } from '../../views/OrganismConstants'; +import ComponentWrapper from '../ComponentWrapper.astro'; + +interface Props { + lapisFilter: LapisFilter; + sequenceType: SequenceType; + granularity: TemporalGranularity; + lapisDateField: string; +} + +const { lapisFilter, sequenceType, granularity, lapisDateField } = Astro.props; +--- + + + + diff --git a/website/src/components/genspectrum/GsNumberSequencesOverTime.astro b/website/src/components/genspectrum/GsNumberSequencesOverTime.astro new file mode 100644 index 00000000..da775f6e --- /dev/null +++ b/website/src/components/genspectrum/GsNumberSequencesOverTime.astro @@ -0,0 +1,26 @@ +--- +import type { NamedLapisFilter } from '@genspectrum/dashboard-components/util'; + +import { ComponentHeight } from '../../views/OrganismConstants'; +import { defaultTablePageSize } from '../../views/View'; +import ComponentWrapper from '../ComponentWrapper.astro'; + +interface Props { + lapisFilters: NamedLapisFilter[]; + lapisDateField: string; + granularity: string; +} + +const { lapisFilters, lapisDateField, granularity } = Astro.props; +--- + + + + diff --git a/website/src/components/genspectrum/GsNumberSequencesOverTime.tsx b/website/src/components/genspectrum/GsNumberSequencesOverTime.tsx index 5090b073..9cdd4cf3 100644 --- a/website/src/components/genspectrum/GsNumberSequencesOverTime.tsx +++ b/website/src/components/genspectrum/GsNumberSequencesOverTime.tsx @@ -1,16 +1,5 @@ import '@genspectrum/dashboard-components/components'; - -import type { LapisFilter } from './GsPrevalenceOverTime.tsx'; - -type LapisFilters = - | { - lapisFilter: LapisFilter; - displayName: string; - } - | { - lapisFilter: LapisFilter; - displayName: string; - }[]; +import type { NamedLapisFilter } from '@genspectrum/dashboard-components/util'; type Views = 'bar' | 'line' | 'table'; @@ -27,7 +16,7 @@ export function GsNumberSequencesOverTime({ pageSize, }: { lapisDateField: string; - lapisFilter?: LapisFilters; + lapisFilter: NamedLapisFilter[]; views?: Views[]; width?: string; height?: string; diff --git a/website/src/components/genspectrum/GsPrevalenceOverTime.astro b/website/src/components/genspectrum/GsPrevalenceOverTime.astro new file mode 100644 index 00000000..de4f0be5 --- /dev/null +++ b/website/src/components/genspectrum/GsPrevalenceOverTime.astro @@ -0,0 +1,40 @@ +--- +import type { + LapisFilter, + NamedLapisFilter, + PrevalenceOverTimeView, + TemporalGranularity, +} from '@genspectrum/dashboard-components/util'; + +import { defaultTablePageSize } from '../../views/View'; +import ComponentWrapper from '../ComponentWrapper.astro'; + +interface Props { + numeratorFilters: NamedLapisFilter[]; + denominatorFilter: LapisFilter; + lapisDateField: string; + granularity: TemporalGranularity; + views?: PrevalenceOverTimeView[]; +} + +const { + numeratorFilters, + denominatorFilter, + lapisDateField, + granularity, + views = ['bar', 'line', 'bubble', 'table'], +} = Astro.props; +--- + + + + diff --git a/website/src/components/genspectrum/GsPrevalenceOverTime.tsx b/website/src/components/genspectrum/GsPrevalenceOverTime.tsx index d8832da9..7a786d62 100644 --- a/website/src/components/genspectrum/GsPrevalenceOverTime.tsx +++ b/website/src/components/genspectrum/GsPrevalenceOverTime.tsx @@ -1,18 +1,6 @@ import '@genspectrum/dashboard-components/components'; +import type { LapisFilter, NamedLapisFilter } from '@genspectrum/dashboard-components/util'; -export type LapisFilter = Record; - -type NumeratorFilter = - | { - lapisFilter: LapisFilter; - displayName: string; - } - | { - lapisFilter: LapisFilter; - displayName: string; - }[]; - -type DenominatorFilter = LapisFilter; type Views = 'bar' | 'line' | 'bubble' | 'table'; type ConfidenceIntervalMethod = 'none' | 'wilson'; type AxisMax = 'maxInData' | 'limitTo1' | number; @@ -30,8 +18,8 @@ export function GsPrevalenceOverTime({ pageSize, yAxisMaxLinear, }: { - numeratorFilter: NumeratorFilter; - denominatorFilter: DenominatorFilter; + numeratorFilter: NamedLapisFilter[]; + denominatorFilter: LapisFilter; views?: Views[]; granularity?: 'day' | 'week' | 'month' | 'year'; smoothingWindow?: number; diff --git a/website/src/components/genspectrum/GsRelativeGrowthAdvantage.astro b/website/src/components/genspectrum/GsRelativeGrowthAdvantage.astro new file mode 100644 index 00000000..0ab2c894 --- /dev/null +++ b/website/src/components/genspectrum/GsRelativeGrowthAdvantage.astro @@ -0,0 +1,25 @@ +--- +import type { LapisFilter } from '@genspectrum/dashboard-components/util'; + +import { defaultTablePageSize } from '../../views/View'; +import ComponentWrapper from '../ComponentWrapper.astro'; + +interface Props { + numeratorFilter: LapisFilter; + denominatorFilter: LapisFilter; + lapisDateField: string; +} + +const { numeratorFilter, denominatorFilter, lapisDateField } = Astro.props; +--- + + + + diff --git a/website/src/components/genspectrum/GsTextInput.tsx b/website/src/components/genspectrum/GsTextInput.tsx index 04dd1038..f1d94d35 100644 --- a/website/src/components/genspectrum/GsTextInput.tsx +++ b/website/src/components/genspectrum/GsTextInput.tsx @@ -40,7 +40,7 @@ export function GsTextInput({ lapisField={lapisField} placeholderText={placeholderText} width={width} - initialValue={initialValue} + initialValue={initialValue ?? ''} > ); } diff --git a/website/src/components/pageStateSelectors/BaselineSelector.tsx b/website/src/components/pageStateSelectors/BaselineSelector.tsx index cdb74fc2..a9a7248e 100644 --- a/website/src/components/pageStateSelectors/BaselineSelector.tsx +++ b/website/src/components/pageStateSelectors/BaselineSelector.tsx @@ -40,7 +40,7 @@ export function BaselineSelector({ placeholderText={locationFilterConfig.placeholderText} > void }) { diff --git a/website/src/components/subscriptions/create/CountFilterInput.tsx b/website/src/components/subscriptions/create/CountFilterInput.tsx index 2921f74a..fe452ae3 100644 --- a/website/src/components/subscriptions/create/CountFilterInput.tsx +++ b/website/src/components/subscriptions/create/CountFilterInput.tsx @@ -1,5 +1,6 @@ +import type { LapisFilter } from '@genspectrum/dashboard-components/util'; + import { InputLabel } from '../../../styles/input/InputLabel.tsx'; -import type { LapisFilter } from '../../../types/Subscription.ts'; import { GsLocationFilter } from '../../genspectrum/GsLocationFilter.tsx'; export function CountFilterInput({ onCountFilterChange }: { onCountFilterChange: (filter: LapisFilter) => void }) { diff --git a/website/src/components/subscriptions/create/FilterDisplay.tsx b/website/src/components/subscriptions/create/FilterDisplay.tsx index 2ba51de5..2fe5194a 100644 --- a/website/src/components/subscriptions/create/FilterDisplay.tsx +++ b/website/src/components/subscriptions/create/FilterDisplay.tsx @@ -1,5 +1,7 @@ +import type { LapisFilter } from '@genspectrum/dashboard-components/util'; + import { type DateWindow, getStartDate } from '../../../types/DateWindow.ts'; -import type { LapisFilter, SubscriptionRequest } from '../../../types/Subscription.ts'; +import type { SubscriptionRequest } from '../../../types/Subscription.ts'; import { GsNumberSequencesOverTime } from '../../genspectrum/GsNumberSequencesOverTime.tsx'; import { GsPrevalenceOverTime } from '../../genspectrum/GsPrevalenceOverTime.tsx'; @@ -36,13 +38,15 @@ export function FilterDisplay({

Count over time

Prevalence over time
- - - - - - - - - + }, + ]} + denominatorFilter={datasetLapisFilter} + lapisDateField={view.organismConstants.mainDateField} + granularity={timeGranularity} + /> + + {subdivisionField !== undefined && ( - - - - )} - - - - - - - - - - - - - - + + +
) } diff --git a/website/src/components/views/compareSideBySide/GenericCompareSideBySidePage.astro b/website/src/components/views/compareSideBySide/GenericCompareSideBySidePage.astro index 20daf40b..bdb217aa 100644 --- a/website/src/components/views/compareSideBySide/GenericCompareSideBySidePage.astro +++ b/website/src/components/views/compareSideBySide/GenericCompareSideBySidePage.astro @@ -3,11 +3,13 @@ import { getDashboardsConfig, getLapisUrl } from '../../../config'; import OrganismPageLayout from '../../../layouts/OrganismPage/OrganismPageLayout.astro'; import { type Organism } from '../../../types/Organism'; import { chooseGranularityBasedOnDateRange } from '../../../util/chooseGranularityBasedOnDateRange'; -import { defaultTablePageSize, getLineageFilterConfigs, getLineageFilterFields } from '../../../views/View'; +import { getLineageFilterConfigs, getLineageFilterFields } from '../../../views/View'; import { type OrganismViewKey } from '../../../views/routing'; import { ServerSide } from '../../../views/serverSideRouting'; import { compareSideBySideViewKey } from '../../../views/viewKeys'; -import ComponentWrapper from '../../ComponentWrapper.astro'; +import GsAggregate from '../../genspectrum/GsAggregate.astro'; +import GsMutations from '../../genspectrum/GsMutations.astro'; +import GsPrevalenceOverTime from '../../genspectrum/GsPrevalenceOverTime.astro'; import { CompareSideBySidePageStateSelector } from '../../pageStateSelectors/CompareSideBySidePageStateSelector'; import { CompareSideBySideSelectorFallback } from '../../pageStateSelectors/FallbackElement'; @@ -84,61 +86,29 @@ const pageState = view.pageStateHandler.parsePageStateFromUrl(Astro.url); - - - - - - - - - - - - - - - + }, + ]} + denominatorFilter={datasetLapisFilter} + lapisDateField={view.organismConstants.mainDateField} + granularity={timeGranularity} + /> + + + + ); }) diff --git a/website/src/components/views/compareToBaseline/GenericCompareToBaselinePage.astro b/website/src/components/views/compareToBaseline/GenericCompareToBaselinePage.astro index 80118605..6cf9158e 100644 --- a/website/src/components/views/compareToBaseline/GenericCompareToBaselinePage.astro +++ b/website/src/components/views/compareToBaseline/GenericCompareToBaselinePage.astro @@ -3,12 +3,11 @@ import { getDashboardsConfig } from '../../../config'; import SingleVariantOrganismPageLayout from '../../../layouts/OrganismPage/SingleVariantOrganismPageLayout.astro'; import type { Organism } from '../../../types/Organism'; import { chooseGranularityBasedOnDateRange } from '../../../util/chooseGranularityBasedOnDateRange'; -import { defaultTablePageSize } from '../../../views/View'; import { type OrganismViewKey } from '../../../views/routing'; import { ServerSide } from '../../../views/serverSideRouting'; import { compareToBaselineViewKey } from '../../../views/viewKeys'; -import ComponentWrapper from '../../ComponentWrapper.astro'; import ComponentsGrid from '../../ComponentsGrid.astro'; +import GsPrevalenceOverTime from '../../genspectrum/GsPrevalenceOverTime.astro'; import { CompareVariantsToBaselineStateSelector } from '../../pageStateSelectors/CompareVariantsToBaselineStateSelector'; import { CompareToBaselineSelectorFallback } from '../../pageStateSelectors/FallbackElement'; @@ -57,19 +56,12 @@ const numeratorLapisFilters = view.pageStateHandler.variantFiltersToNamedLapisFi - - - + diff --git a/website/src/components/views/compareVariants/GenericCompareVariantsPage.astro b/website/src/components/views/compareVariants/GenericCompareVariantsPage.astro index 965723b7..9e851053 100644 --- a/website/src/components/views/compareVariants/GenericCompareVariantsPage.astro +++ b/website/src/components/views/compareVariants/GenericCompareVariantsPage.astro @@ -4,12 +4,12 @@ import { getDashboardsConfig } from '../../../config'; import SingleVariantOrganismPageLayout from '../../../layouts/OrganismPage/SingleVariantOrganismPageLayout.astro'; import type { Organism } from '../../../types/Organism'; import { chooseGranularityBasedOnDateRange } from '../../../util/chooseGranularityBasedOnDateRange'; -import { defaultTablePageSize } from '../../../views/View'; import { type OrganismViewKey } from '../../../views/routing'; import { ServerSide } from '../../../views/serverSideRouting'; import { compareVariantsViewKey } from '../../../views/viewKeys'; -import ComponentWrapper from '../../ComponentWrapper.astro'; import ComponentsGrid from '../../ComponentsGrid.astro'; +import GsMutationComparison from '../../genspectrum/GsMutationComparison.astro'; +import GsPrevalenceOverTime from '../../genspectrum/GsPrevalenceOverTime.astro'; import { CompareVariantsPageStateSelector } from '../../pageStateSelectors/CompareVariantsPageStateSelector'; import { CompareVariantsSelectorFallback } from '../../pageStateSelectors/FallbackElement'; @@ -62,39 +62,15 @@ const notEnoughVariantsSelected = pageState.variants.size < 2; ) : ( - - - - - - - - - + + + ) } diff --git a/website/src/components/views/sequencingEfforts/GenericSequencingEffortsPage.astro b/website/src/components/views/sequencingEfforts/GenericSequencingEffortsPage.astro index a0fd6fb4..8048e0ed 100644 --- a/website/src/components/views/sequencingEfforts/GenericSequencingEffortsPage.astro +++ b/website/src/components/views/sequencingEfforts/GenericSequencingEffortsPage.astro @@ -3,13 +3,14 @@ import { getDashboardsConfig } from '../../../config'; import SingleVariantOrganismPageLayout from '../../../layouts/OrganismPage/SingleVariantOrganismPageLayout.astro'; import { type Organism } from '../../../types/Organism'; import { chooseGranularityBasedOnDateRange } from '../../../util/chooseGranularityBasedOnDateRange'; -import { defaultTablePageSize } from '../../../views/View'; +import { ComponentHeight } from '../../../views/OrganismConstants'; import { getLocationSubdivision } from '../../../views/helpers'; import { type OrganismViewKey } from '../../../views/routing'; import { ServerSide } from '../../../views/serverSideRouting'; import { sequencingEffortsViewKey } from '../../../views/viewKeys'; -import ComponentWrapper from '../../ComponentWrapper.astro'; import ComponentsGrid from '../../ComponentsGrid.astro'; +import GsAggregate from '../../genspectrum/GsAggregate.astro'; +import GsNumberSequencesOverTime from '../../genspectrum/GsNumberSequencesOverTime.astro'; import { SequencingEffortsSelectorFallback } from '../../pageStateSelectors/FallbackElement'; import { SequencingEffortsPageStateSelector } from '../../pageStateSelectors/SequencingEffortsPageStateSelector'; @@ -56,51 +57,35 @@ const { label: subdivisionLabel, field: subdivisionField } = getLocationSubdivis - - - + }, + ]} + lapisDateField={view.organismConstants.mainDateField} + granularity={timeGranularity} + /> { subdivisionField !== undefined && ( - - - + ) } - - - + { view.organismConstants.additionalSequencingEffortsFields.map(({ label, fields, height }) => ( - - - + )) } diff --git a/website/src/pages/covid/compare-side-by-side.astro b/website/src/pages/covid/compare-side-by-side.astro index 53cb1fe5..ea8d7fab 100644 --- a/website/src/pages/covid/compare-side-by-side.astro +++ b/website/src/pages/covid/compare-side-by-side.astro @@ -1,11 +1,14 @@ --- -import ComponentWrapper from '../../components/ComponentWrapper.astro'; +import GsAggregate from '../../components/genspectrum/GsAggregate.astro'; +import GsMutations from '../../components/genspectrum/GsMutations.astro'; +import GsPrevalenceOverTime from '../../components/genspectrum/GsPrevalenceOverTime.astro'; +import GsRelativeGrowthAdvantage from '../../components/genspectrum/GsRelativeGrowthAdvantage.astro'; import { CompareSideBySidePageStateSelector } from '../../components/pageStateSelectors/CompareSideBySidePageStateSelector'; import { CompareSideBySideSelectorFallback } from '../../components/pageStateSelectors/FallbackElement'; import { getDashboardsConfig, getLapisUrl } from '../../config'; import OrganismPageLayout from '../../layouts/OrganismPage/OrganismPageLayout.astro'; import { chooseGranularityBasedOnDateRange } from '../../util/chooseGranularityBasedOnDateRange'; -import { defaultTablePageSize, getLineageFilterConfigs, getLineageFilterFields } from '../../views/View'; +import { getLineageFilterConfigs, getLineageFilterFields } from '../../views/View'; import type { OrganismViewKey } from '../../views/routing'; import { ServerSide } from '../../views/serverSideRouting'; @@ -78,72 +81,34 @@ const pageState = view.pageStateHandler.parsePageStateFromUrl(Astro.url); - - - - - - - - - - - - - - - - - - + }, + ]} + denominatorFilter={baselineLapisFilter} + lapisDateField={view.organismConstants.mainDateField} + granularity={timeGranularity} + /> + + + + + ); }) diff --git a/website/src/pages/covid/single-variant.astro b/website/src/pages/covid/single-variant.astro index 35c003be..90dacb18 100644 --- a/website/src/pages/covid/single-variant.astro +++ b/website/src/pages/covid/single-variant.astro @@ -1,7 +1,11 @@ --- import ComponentHeadline from '../../components/ComponentHeadline.astro'; -import ComponentWrapper from '../../components/ComponentWrapper.astro'; import ComponentsGrid from '../../components/ComponentsGrid.astro'; +import GsAggregate from '../../components/genspectrum/GsAggregate.astro'; +import GsMutations from '../../components/genspectrum/GsMutations.astro'; +import GsMutationsOverTime from '../../components/genspectrum/GsMutationsOverTime.astro'; +import GsPrevalenceOverTime from '../../components/genspectrum/GsPrevalenceOverTime.astro'; +import GsRelativeGrowthAdvantage from '../../components/genspectrum/GsRelativeGrowthAdvantage.astro'; import { AnalyzeSingleVariantSelectorFallback } from '../../components/pageStateSelectors/FallbackElement'; import { SingleVariantPageStateSelector } from '../../components/pageStateSelectors/SingleVariantPageStateSelector'; import { CollectionsList } from '../../components/views/analyzeSingleVariant/CollectionsList'; @@ -10,7 +14,7 @@ import { getDashboardsConfig } from '../../config'; import SingleVariantOrganismPageLayout from '../../layouts/OrganismPage/SingleVariantOrganismPageLayout.astro'; import { chooseGranularityBasedOnDateRange } from '../../util/chooseGranularityBasedOnDateRange'; import { hasOnlyUndefinedValues } from '../../util/hasOnlyUndefinedValues'; -import { defaultTablePageSize, getLineageFilterConfigs, getLineageFilterFields } from '../../views/View'; +import { getLineageFilterConfigs, getLineageFilterFields } from '../../views/View'; import { getLocationSubdivision } from '../../views/helpers'; import { type OrganismViewKey } from '../../views/routing'; import { ServerSide } from '../../views/serverSideRouting'; @@ -88,109 +92,52 @@ const noVariantSelected = hasOnlyUndefinedValues(pageState.variantFilter); /> - - - - - - - - - - - - - - - - - + }, + ]} + denominatorFilter={datasetLapisFilter} + lapisDateField={view.organismConstants.mainDateField} + granularity={timeGranularity} + /> + + + + {subdivisionField !== undefined && ( - - - + )} - - - - + - - - + - - - + ) } diff --git a/website/src/types/Subscription.ts b/website/src/types/Subscription.ts index 3ca9487c..4bd29db1 100644 --- a/website/src/types/Subscription.ts +++ b/website/src/types/Subscription.ts @@ -7,7 +7,6 @@ import { organismSchema } from './Organism.ts'; export const lapisFilterSchema = z.record( z.union([z.string(), z.number(), z.null(), z.undefined(), z.boolean(), z.array(z.string())]), ); -export type LapisFilter = z.infer; const triggerEvaluationConditionMetSchema = z.object({ evaluatedValue: z.number(), diff --git a/website/src/views/helpers.ts b/website/src/views/helpers.ts index a9b7c2ac..425a289e 100644 --- a/website/src/views/helpers.ts +++ b/website/src/views/helpers.ts @@ -4,8 +4,6 @@ import type { VariantFilter } from './View.ts'; import type { MutationFilter } from '../components/genspectrum/GsMutationFilter.tsx'; import { CustomDateRangeLabel } from '../types/DateWindow.ts'; -export type LapisFilter = Record; - /** * Sets the value to the search params if the value is not empty, not undefined and not null */ diff --git a/website/src/views/pageStateHandlers/CompareSideBySidePageStateHandler.ts b/website/src/views/pageStateHandlers/CompareSideBySidePageStateHandler.ts index 99cdb66b..fe9f4168 100644 --- a/website/src/views/pageStateHandlers/CompareSideBySidePageStateHandler.ts +++ b/website/src/views/pageStateHandlers/CompareSideBySidePageStateHandler.ts @@ -1,3 +1,5 @@ +import type { LapisFilter } from '@genspectrum/dashboard-components/util'; + import type { SingleVariantConstants } from '../OrganismConstants.ts'; import { type CompareSideBySideData, type DatasetAndVariantData, getLineageFilterFields, type Id } from '../View.ts'; import { compareSideBySideViewConstants } from '../ViewConstants.ts'; @@ -6,7 +8,6 @@ import { getDateRangeFromSearch, getLapisLocationFromSearch, getLapisVariantQuery, - type LapisFilter, setSearchFromDateRange, setSearchFromLapisVariantQuery, setSearchFromLocation, diff --git a/website/src/views/pageStateHandlers/CompareToBaselinePageStateHandler.ts b/website/src/views/pageStateHandlers/CompareToBaselinePageStateHandler.ts index fcce37cd..536f500a 100644 --- a/website/src/views/pageStateHandlers/CompareToBaselinePageStateHandler.ts +++ b/website/src/views/pageStateHandlers/CompareToBaselinePageStateHandler.ts @@ -1,3 +1,5 @@ +import type { LapisFilter, NamedLapisFilter } from '@genspectrum/dashboard-components/util'; + import type { SingleVariantConstants } from '../OrganismConstants.ts'; import { type CompareToBaselineData, @@ -12,14 +14,12 @@ import { getDateRangeFromSearch, getLapisLocationFromSearch, getLapisVariantQuery, - type LapisFilter, setSearchFromDateRange, setSearchFromLapisVariantQuery, setSearchFromLocation, } from '../helpers.ts'; import { decodeFiltersFromSearch, - type NamedLapisFilter, type PageStateHandler, searchParamsFromFilterMap, toDisplayName, diff --git a/website/src/views/pageStateHandlers/CompareVariantsPageStateHandler.ts b/website/src/views/pageStateHandlers/CompareVariantsPageStateHandler.ts index 9511ff4c..cc67d938 100644 --- a/website/src/views/pageStateHandlers/CompareVariantsPageStateHandler.ts +++ b/website/src/views/pageStateHandlers/CompareVariantsPageStateHandler.ts @@ -1,3 +1,5 @@ +import type { LapisFilter, NamedLapisFilter } from '@genspectrum/dashboard-components/util'; + import type { SingleVariantConstants } from '../OrganismConstants.ts'; import { type CompareVariantsData, @@ -12,14 +14,12 @@ import { getDateRangeFromSearch, getLapisLocationFromSearch, getLapisVariantQuery, - type LapisFilter, setSearchFromDateRange, setSearchFromLapisVariantQuery, setSearchFromLocation, } from '../helpers.ts'; import { decodeFiltersFromSearch, - type NamedLapisFilter, type PageStateHandler, searchParamsFromFilterMap, toDisplayName, diff --git a/website/src/views/pageStateHandlers/PageStateHandler.ts b/website/src/views/pageStateHandlers/PageStateHandler.ts index a0d2fb8a..53823b06 100644 --- a/website/src/views/pageStateHandlers/PageStateHandler.ts +++ b/website/src/views/pageStateHandlers/PageStateHandler.ts @@ -1,6 +1,8 @@ +import type { LapisFilter } from '@genspectrum/dashboard-components/util'; + import type { SequencingEffortsConstants } from '../OrganismConstants.ts'; import { type Dataset, type Id, type VariantFilter } from '../View.ts'; -import { type LapisFilter, type LapisLocation } from '../helpers.ts'; +import { type LapisLocation } from '../helpers.ts'; export interface PageStateHandler { parsePageStateFromUrl(url: URL): PageState; @@ -79,11 +81,6 @@ export function searchParamsFromFilterMap( return encodeMultipleFiltersToUrlSearchParam(searchParameterMap); } -export type NamedLapisFilter = { - lapisFilter: LapisFilter; - displayName: string; -}; - export function toDisplayName(variantFilter: VariantFilter) { return [ ...Object.values(variantFilter.lineages).filter((lineage) => lineage !== undefined), diff --git a/website/src/views/pageStateHandlers/SingleVariantPageStateHandler.ts b/website/src/views/pageStateHandlers/SingleVariantPageStateHandler.ts index c77c4eba..4db5b6eb 100644 --- a/website/src/views/pageStateHandlers/SingleVariantPageStateHandler.ts +++ b/website/src/views/pageStateHandlers/SingleVariantPageStateHandler.ts @@ -1,3 +1,5 @@ +import type { LapisFilter } from '@genspectrum/dashboard-components/util'; + import type { SingleVariantConstants } from '../OrganismConstants.ts'; import { type Dataset, type DatasetAndVariantData, getLineageFilterFields } from '../View.ts'; import { singleVariantViewConstants } from '../ViewConstants.ts'; @@ -5,7 +7,6 @@ import { getDateRangeFromSearch, getLapisLocationFromSearch, getLapisVariantQuery, - type LapisFilter, type LapisLocation, setSearchFromDateRange, setSearchFromLapisVariantQuery,