From 6b09aef00bef58162122f31d10bbb192f222c8e4 Mon Sep 17 00:00:00 2001 From: Fabian Engelniederhammer <92720311+fengelniederhammer@users.noreply.github.com> Date: Mon, 13 Jan 2025 09:26:41 +0100 Subject: [PATCH] fix(website): title of sequences by location component on sequencing efforts pages (#463) resolves #434 --- .../GenericSequencingEffortsPage.astro | 11 +++++------ website/src/views/locationHelpers.spec.ts | 4 +--- website/src/views/locationHelpers.ts | 5 ++--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/website/src/components/views/sequencingEfforts/GenericSequencingEffortsPage.astro b/website/src/components/views/sequencingEfforts/GenericSequencingEffortsPage.astro index 115e2831..ae501087 100644 --- a/website/src/components/views/sequencingEfforts/GenericSequencingEffortsPage.astro +++ b/website/src/components/views/sequencingEfforts/GenericSequencingEffortsPage.astro @@ -31,11 +31,10 @@ const timeGranularity = chooseGranularityBasedOnDateRange( pageState.datasetFilter.dateRange, new Date(view.organismConstants.earliestDate), ); -const { - label: locationLabel, - locationField, - mapName, -} = getLocationDisplayConfig(view.organismConstants.locationFields, pageState.datasetFilter.location); +const { locationField, mapName } = getLocationDisplayConfig( + view.organismConstants.locationFields, + pageState.datasetFilter.location, +); const lineageFilterConfigs = getLineageFilterConfigs( view.organismConstants.lineageFilters, pageState.variantFilter.lineages, @@ -87,7 +86,7 @@ const lineageFilterConfigs = getLineageFilterConfigs( { locationField !== undefined && ( { const actual = getLocationDisplayConfig(locationFields, locationFilter); - const expected = { label: 'World', mapName: 'World', locationField: countryField }; + const expected = { mapName: 'World', locationField: countryField }; expect(actual).toEqual(expected); }); @@ -25,7 +25,6 @@ describe('getLocationDisplayConfig', () => { const actual = getLocationDisplayConfig(locationFields, locationFilter); const expected = { - label: 'Country', mapName: 'myContinentValue', locationField: countryField, }; @@ -41,7 +40,6 @@ describe('getLocationDisplayConfig', () => { const actual = getLocationDisplayConfig(locationFields, locationFilter); const expected = { - label: 'Geographic sub-divisions', mapName: 'myCountryValue', locationField: divisionField, }; diff --git a/website/src/views/locationHelpers.ts b/website/src/views/locationHelpers.ts index 1be0d072..33e8e63d 100644 --- a/website/src/views/locationHelpers.ts +++ b/website/src/views/locationHelpers.ts @@ -4,12 +4,11 @@ import { hasOnlyUndefinedValues } from '../util/hasOnlyUndefinedValues.ts'; export function getLocationDisplayConfig(locationFields: string[], locationFilter: LapisLocation) { if (hasOnlyUndefinedValues(locationFilter)) { const locationField = locationFields.find((it) => isCountryField(it)) ?? locationFields[0]; - return { label: 'World', mapName: 'World', locationField }; + return { mapName: 'World', locationField }; } - const { label, locationValue, field } = getLocationSubdivision(locationFields, locationFilter); + const { locationValue, field } = getLocationSubdivision(locationFields, locationFilter); return { - label, mapName: locationValue, locationField: field, };