Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Commit

Permalink
feat(COR-1628): Added extra categories to the Sewer choropleth (#4846)
Browse files Browse the repository at this point in the history
* feat(COR-1666): added extra categories to the sewer chropleth

* fix: fixed typo in lokalise key

---------

Co-authored-by: VWSCoronaDashboard27 <[email protected]>
Co-authored-by: AP <[email protected]>
  • Loading branch information
3 people authored Aug 23, 2023
1 parent 8669389 commit 76cba63
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 25 deletions.
45 changes: 27 additions & 18 deletions packages/app/src/components/choropleth-legenda.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,37 @@ interface ChoroplethLegendaProps {
}

export function ChoroplethLegenda({ title, thresholds, valueAnnotation, pageType, outdatedDataLabel }: ChoroplethLegendaProps) {
const { commonTexts } = useIntl();
const { commonTexts, formatNumber } = useIntl();

const breakpoints = useBreakpoints(true);

const legendItems = thresholds.map(
(x: ChoroplethThresholdsValue, i) =>
({
label: thresholds[i + 1]
? replaceVariablesInText(commonTexts.common.value_until_value, {
value_1: x.threshold,
value_2: thresholds[i + 1].threshold,
})
: replaceVariablesInText(commonTexts.common.value_and_higher, {
value: x.threshold,
}),
shape: 'square',
color: x.color,
} as LegendItem)
);
const legendItems = thresholds.map((x: ChoroplethThresholdsValue, i) => {
let label = thresholds[i + 1]
? replaceVariablesInText(commonTexts.common.value_until_value, {
value_1: formatNumber(x.threshold),
value_2: formatNumber(thresholds[i + 1].threshold),
})
: replaceVariablesInText(commonTexts.common.value_and_higher, {
value: formatNumber(x.threshold),
});
if (pageType === 'sewer' && i === 0 && x.threshold === 0) {
label = commonTexts.common.no_virus_particles_measured;
}
if (pageType === 'sewer' && i === 1) {
label = replaceVariablesInText(commonTexts.common.greater_than_value, {
value_1: x.threshold,
value_2: thresholds[i + 1].threshold,
});
}
return {
label: label,
shape: 'square',
color: x.color,
} as LegendItem;
});

if (pageType === 'sewer') {
legendItems.push({
legendItems.unshift({
label: outdatedDataLabel,
shape: 'square',
color: colors.yellow1,
Expand All @@ -48,7 +58,6 @@ export function ChoroplethLegenda({ title, thresholds, valueAnnotation, pageType
{title && <Text variant="subtitle1">{title}</Text>}

<Legend items={legendItems} columns={breakpoints.lg ? 1 : 2} />

<ValueAnnotation>{valueAnnotation}</ValueAnnotation>
</Box>
);
Expand Down
22 changes: 15 additions & 7 deletions packages/app/src/components/choropleth/logic/thresholds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,29 +96,37 @@ const sewerThresholds: ChoroplethThresholdsValue[] = [
threshold: 0,
},
{
color: colors.scale.blue[0],
threshold: 0.01,
color: colors.scale.blueDetailed[0],
threshold: 0,
},
{
color: colors.scale.blue[1],
color: colors.scale.blueDetailed[1],
threshold: 50,
},
{
color: colors.scale.blue[2],
color: colors.scale.blueDetailed[2],
threshold: 250,
},
{
color: colors.scale.blue[3],
color: colors.scale.blueDetailed[3],
threshold: 500,
},
{
color: colors.scale.blue[4],
color: colors.scale.blueDetailed[4],
threshold: 750,
},
{
color: colors.scale.blue[5],
color: colors.scale.blueDetailed[5],
threshold: 1000,
},
{
color: colors.scale.blueDetailed[6],
threshold: 1500,
},
{
color: colors.scale.blueDetailed[8],
threshold: 2000,
},
];

const vrHospitalAdmissionsThresholds: ChoroplethThresholdsValue[] = [
Expand Down
4 changes: 4 additions & 0 deletions packages/cms/src/lokalize/key-mutations.csv
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
timestamp,action,key,document_id,move_to
2023-08-21T14:27:33.421Z,add,common.common.no_virus_particles_measured,J4TD0W3ViFgya1T3ReztMI,__
2023-08-21T14:27:34.547Z,add,common.common.greate_than_value,hLG40qywMr1wCqg8ytKijJ,__
2023-08-22T09:05:05.942Z,add,common.common.greater_than_value,VlbjYO9GDKwaUp5hRVukdB,__
2023-08-22T09:05:05.946Z,delete,common.common.greate_than_value,hLG40qywMr1wCqg8ytKijJ,__
2023-08-22T10:02:41.476Z,delete,pages.infectie_radar_page.nl.chart_infectie_radar_age_groups.description,ZmGr7z0dpqDTcKeIJulxUI,__
2023-08-22T10:02:41.477Z,delete,pages.infectie_radar_page.nl.chart_infectie_radar_age_groups.source,ZmGr7z0dpqDTcKeIJutJsZ,__
2023-08-22T10:02:41.478Z,delete,pages.infectie_radar_page.nl.chart_infectie_radar_age_groups.source.rivm.download,xT2YXVOH9b7Mo5ggz8DopY,__
Expand Down

0 comments on commit 76cba63

Please sign in to comment.