Skip to content

Commit

Permalink
feat: add more discontinued wastewater sites
Browse files Browse the repository at this point in the history
Resolves: #1048
  • Loading branch information
JonasKellerer committed Dec 5, 2024
1 parent e61ef18 commit 7845efc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 18 deletions.
33 changes: 20 additions & 13 deletions src/models/wasteWater/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,23 @@ export const wastewaterVariantColors: {
'undetermined': '#969696',
};

export const discontinuedLocations = new Set<string>([
'Sierre/Noes (VS)',
'Lausanne (VD)',
'Sion (VS)',
'Bern (BE)',
'Porrentruy (JU)',
'Neuchâtel (NE)',
'Solothurn (SO)',
'Schwyz (SZ)',
'test_legacylocation', // for tests
]);

export const discontinuedDate = ' since March 26th, 2024';
export const discontinuedSites = [
{
discontinuedLocations: new Set<string>([
'Sierre/Noes (VS)',
'Lausanne (VD)',
'Sion (VS)',
'Bern (BE)',
'Porrentruy (JU)',
'Neuchâtel (NE)',
'Solothurn (SO)',
'Schwyz (SZ)',
'test_legacylocation', // for tests
]),
discontinuedDate: ' March 26th, 2024',
},
{
discontinuedLocations: new Set<string>(['Luzern (LU)', 'Altenrhein (SG)']),
discontinuedDate: ' November 25th, 2024',
},
];
4 changes: 2 additions & 2 deletions src/models/wasteWater/story/WasteWaterSamplingSites.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import DateRangePicker from '../../../components/DateRangePicker';
import { GridCell, PackedGrid } from '../../../components/PackedGrid';
import { WasteWaterLocationTimeWidget } from '../WasteWaterLocationTimeWidget';
import { ShowMoreButton } from '../../../helpers/ui';
import { discontinuedLocations } from '../constants';
import { discontinuedSites } from '../constants';

export interface WasteWaterSitesProps {
locationFilter?: (location: string) => Boolean;
}

export const isDiscontinuedSite = (location: string) => {
return discontinuedLocations.has(location);
return discontinuedSites.some(site => site.discontinuedLocations.has(location));
};

export const WasteWaterSamplingSites = ({ locationFilter }: WasteWaterSitesProps) => {
Expand Down
10 changes: 7 additions & 3 deletions src/models/wasteWater/story/WasteWaterStoryPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useEffect } from 'react';
import { ExternalLink } from '../../../components/ExternalLink';
import { discontinuedDate } from '../constants';
import { isDiscontinuedSite, WasteWaterSamplingSites } from './WasteWaterSamplingSites';
import { discontinuedSites } from '../constants';

export const WasteWaterStoryPage = () => {
useEffect(() => {
Expand Down Expand Up @@ -54,8 +54,12 @@ export const WasteWaterStoryPage = () => {
const DiscontinuedSamplingSites = () => {
return (
<>
<h2>Locations discontinued{discontinuedDate}</h2>
<WasteWaterSamplingSites locationFilter={isDiscontinuedSite} />
{discontinuedSites.map(site => (
<>
<h2>Locations discontinued since{site.discontinuedDate}</h2>
<WasteWaterSamplingSites locationFilter={location => site.discontinuedLocations.has(location)} />
</>
))}
</>
);
};
Expand Down

0 comments on commit 7845efc

Please sign in to comment.