Skip to content

Commit

Permalink
fix(website): title of sequences by location component on sequencing …
Browse files Browse the repository at this point in the history
…efforts pages

resolves #434
  • Loading branch information
fengelniederhammer committed Jan 13, 2025
1 parent a66d579 commit 9c72cc2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -87,7 +86,7 @@ const lineageFilterConfigs = getLineageFilterConfigs(
{
locationField !== undefined && (
<GsSequencesByLocation
title={locationLabel}
title='Sequences by location'
height={ComponentHeight.large}
lapisLocationField={locationField}
lapisFilter={lapisFilter}
Expand Down
4 changes: 1 addition & 3 deletions website/src/views/locationHelpers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe('getLocationDisplayConfig', () => {

const actual = getLocationDisplayConfig(locationFields, locationFilter);

const expected = { label: 'World', mapName: 'World', locationField: countryField };
const expected = { mapName: 'World', locationField: countryField };
expect(actual).toEqual(expected);
});

Expand All @@ -25,7 +25,6 @@ describe('getLocationDisplayConfig', () => {
const actual = getLocationDisplayConfig(locationFields, locationFilter);

const expected = {
label: 'Country',
mapName: 'myContinentValue',
locationField: countryField,
};
Expand All @@ -41,7 +40,6 @@ describe('getLocationDisplayConfig', () => {
const actual = getLocationDisplayConfig(locationFields, locationFilter);

const expected = {
label: 'Geographic sub-divisions',
mapName: 'myCountryValue',
locationField: divisionField,
};
Expand Down
5 changes: 2 additions & 3 deletions website/src/views/locationHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down

0 comments on commit 9c72cc2

Please sign in to comment.