diff --git a/packages/app/src/pages/actueel/gemeente/[code].tsx b/packages/app/src/pages/actueel/gemeente/[code].tsx index b2d1912d11..b02abd8a07 100644 --- a/packages/app/src/pages/actueel/gemeente/[code].tsx +++ b/packages/app/src/pages/actueel/gemeente/[code].tsx @@ -3,7 +3,6 @@ import { DAY_IN_SECONDS, GmCollectionVaccineCoveragePerAgeGroup, GmHospitalNiceValue, - GmTestedOverallValue, GmSewerValue, GmVaccineCoveragePerAgeGroupValue, TimeframeOption, @@ -11,7 +10,6 @@ import { } from '@corona-dashboard/common'; import { Chevron, - Test, Vaccinaties, Ziekenhuis, RioolwaterMonitoring, @@ -99,24 +97,24 @@ export const getStaticProps = createGetStaticProps( values: cutValuesFromTimeframe( data.selectedGmData.hospital_nice.values, TimeframeOption.FIVE_WEEKS - ) + ), }, tested_overall: { ...data.selectedGmData.tested_overall, values: cutValuesFromTimeframe( data.selectedGmData.tested_overall.values, TimeframeOption.FIVE_WEEKS - ) + ), }, sewer: { ...data.selectedGmData.sewer, values: cutValuesFromTimeframe( data.selectedGmData.sewer.values, TimeframeOption.FIVE_WEEKS - ) - } - } - } + ), + }, + }, + }; }, createGetChoroplethData({ gm: ({ vaccine_coverage_per_age_group }, ctx) => { @@ -161,7 +159,7 @@ const TopicalMunicipality = (props: StaticProps) => { const router = useRouter(); const reverseRouter = useReverseRouter(); const { commonTexts, ...formatters } = useIntl(); - const { hospitalText, positiveTestsText, textGm, sewerText, textShared } = pageText; + const { hospitalText, textGm, sewerText, textShared } = pageText; const gmCode = router.query.code as string; @@ -184,8 +182,6 @@ const TopicalMunicipality = (props: StaticProps) => { true ); - const sewageOnActueelFeature = useFeature('sewageOnActueel'); - const internationalFeature = useFeature('inPositiveTestsPage'); const dataSitemap = useDataSitemap('gm', gmCode, data); @@ -258,35 +254,15 @@ const TopicalMunicipality = (props: StaticProps) => { 'hospital_nice' ), } as MiniTileSelectorItem, - (sewageOnActueelFeature.isEnabled ? { + { label: textGm.mini_trend_tiles.sewer.menu_item_label, - data: dataSewerTotal.values.filter(x => typeof x.average === 'number'), - dataProperty: - 'average', - value: - dataSewerTotal.last_value - ?.average ?? - 0, - warning: getWarning( - content.elements.warning, - 'sewer' + data: dataSewerTotal.values.filter( + (x) => typeof x.average === 'number' ), - } as MiniTileSelectorItem - : { - label: - textGm.mini_trend_tiles.positief_geteste_mensen - .menu_item_label, - data: data.tested_overall.values, - dataProperty: 'infected_moving_average_rounded', - value: - data.tested_overall.last_value - .infected_moving_average_rounded, - warning: getWarning( - content.elements.warning, - 'tested_overall' - ), - } as MiniTileSelectorItem - ), + dataProperty: 'average', + value: dataSewerTotal.last_value?.average ?? 0, + warning: getWarning(content.elements.warning, 'sewer'), + } as MiniTileSelectorItem, { label: textGm.mini_trend_tiles.vaccinatiegraad.menu_item_label, @@ -384,118 +360,47 @@ const TopicalMunicipality = (props: StaticProps) => { 'hospital_nice' )} /> - { sewageOnActueelFeature.isEnabled ? - - - } - iconPlacement="right" - > - {textGm.mini_trend_tiles.sewer.read_more_link} - - - } - icon={} - values={dataSewerTotal.values} - seriesConfig={[ - { - type: 'split-area', - metricProperty: 'average', - label: commonTexts.common.daggemiddelde, - splitPoints: averageSplitPoints, - }, - ]} - dataOptions={{ - valueAnnotation: commonTexts.waarde_annotaties.riool_normalized, - }} - accessibility={{ key: 'topical_sewer' }} - warning={getWarning( - content.elements.warning, - 'sewer' - )} - /> - : - - } - iconPlacement="right" - > + + - - } - icon={} - values={data.tested_overall.values} - seriesConfig={[ - { - type: 'line', - metricProperty: 'infected_moving_average', - label: - positiveTestsText.tooltip_labels - .infected_moving_average, - color: colors.data.primary, - }, - { - type: 'bar', - metricProperty: 'infected', - label: - positiveTestsText.tooltip_labels.infected_overall, - color: colors.data.primary, - }, - ]} - accessibility={{ - key: 'topical_tested_overall_infected', - }} - warning={getWarning( - content.elements.warning, - 'tested_overall' - )} - /> - } + type: 'metric', + text: textGm.data_driven_texts.sewer.value, + metricName: 'sewer', + metricProperty: 'average', + }, + ]} + /> + } + iconPlacement="right" + > + {textGm.mini_trend_tiles.sewer.read_more_link} + + + } + icon={} + values={dataSewerTotal.values} + seriesConfig={[ + { + type: 'split-area', + metricProperty: 'average', + label: commonTexts.common.daggemiddelde, + splitPoints: averageSplitPoints, + }, + ]} + dataOptions={{ + valueAnnotation: + commonTexts.waarde_annotaties.riool_normalized, + }} + accessibility={{ key: 'topical_sewer' }} + warning={getWarning(content.elements.warning, 'sewer')} + /> {isDefined(filteredAgeGroup18Plus) && ( ) => { const reverseRouter = useReverseRouter(); const vrCode = router.query.code as string; const { commonTexts, ...formatters } = useIntl(); - const { hospitalText, positiveTestsText, textVr, sewerText, textShared } = pageText; + const { hospitalText, textVr, sewerText, textShared } = pageText; const dataHospitalIntake = data.hospital_nice; const dataSewerTotal = data.sewer; @@ -191,8 +189,6 @@ const TopicalVr = (props: StaticProps) => { const internationalFeature = useFeature('inPositiveTestsPage'); - const sewageOnActueelFeature = useFeature('sewageOnActueel'); - const metadata = { title: replaceVariablesInText(textVr.metadata.title, { safetyRegionName: vrName, @@ -264,35 +260,15 @@ const TopicalVr = (props: StaticProps) => { 'hospital_nice' ), } as MiniTileSelectorItem, - (sewageOnActueelFeature.isEnabled ? { - label: textVr.mini_trend_tiles.sewer.menu_item_label, - data: dataSewerTotal.values.filter(x => typeof x.average === 'number'), - dataProperty: - 'average', - value: - dataSewerTotal.last_value - ?.average ?? - 0, - warning: getWarning( - content.elements.warning, - 'sewer' - ), - } as MiniTileSelectorItem - : { - label: - textVr.mini_trend_tiles.positief_geteste_mensen - .menu_item_label, - data: data.tested_overall.values, - dataProperty: 'infected_moving_average_rounded', - value: - data.tested_overall.last_value - .infected_moving_average_rounded, - warning: getWarning( - content.elements.warning, - 'tested_overall' - ), - } as MiniTileSelectorItem - ), + { + label: textVr.mini_trend_tiles.sewer.menu_item_label, + data: dataSewerTotal.values.filter( + (x) => typeof x.average === 'number' + ), + dataProperty: 'average', + value: dataSewerTotal.last_value?.average ?? 0, + warning: getWarning(content.elements.warning, 'sewer'), + } as MiniTileSelectorItem, { label: textVr.mini_trend_tiles.vaccinatiegraad.menu_item_label, @@ -390,125 +366,47 @@ const TopicalVr = (props: StaticProps) => { 'hospital_nice' )} /> - {sewageOnActueelFeature.isEnabled ? - - } - iconPlacement="right" - > - {textVr.mini_trend_tiles.sewer.read_more_link} - - - } - icon={} - values={dataSewerTotal.values} - seriesConfig={[ - { - type: 'split-area', - metricProperty: 'average', - label: commonTexts.common.daggemiddelde, - splitPoints: averageSplitPoints, - }, - ]} - dataOptions={{ - valueAnnotation: commonTexts.waarde_annotaties.riool_normalized, - }} - accessibility={{ key: 'topical_sewer' }} - warning={getWarning( - content.elements.warning, - 'sewer' - )} - /> - : - - } - iconPlacement="right" - > + + - - } - icon={} - values={data.tested_overall.values} - seriesConfig={[ - { - type: 'line', - metricProperty: 'infected_moving_average', - label: - positiveTestsText.tooltip_labels - .infected_moving_average, - color: colors.data.primary, - }, - { - type: 'bar', - metricProperty: 'infected', - label: - positiveTestsText.tooltip_labels.infected_overall, - color: colors.data.primary, - }, - ]} - accessibility={{ - key: 'topical_tested_overall_infected', - }} - warning={getWarning( - content.elements.warning, - 'tested_overall' - )} - /> - } + type: 'metric', + text: textVr.data_driven_texts.sewer.value, + metricName: 'sewer', + metricProperty: 'average', + }, + ]} + /> + } + iconPlacement="right" + > + {textVr.mini_trend_tiles.sewer.read_more_link} + + + } + icon={} + values={dataSewerTotal.values} + seriesConfig={[ + { + type: 'split-area', + metricProperty: 'average', + label: commonTexts.common.daggemiddelde, + splitPoints: averageSplitPoints, + }, + ]} + dataOptions={{ + valueAnnotation: + commonTexts.waarde_annotaties.riool_normalized, + }} + accessibility={{ key: 'topical_sewer' }} + warning={getWarning(content.elements.warning, 'sewer')} + /> {isDefined(filteredAgeGroup18Plus) && ( ) => { const dataSewerTotal = data.sewer; const dataICTotal = data.intensive_care_nice; const dataHospitalIntake = data.hospital_nice; - const dataTestedOverall = data.tested_overall; const dataSitemap = useDataSitemap('nl'); const { commonTexts, ...formatters } = useIntl(); const reverseRouter = useReverseRouter(); - const { - hospitalText, - intensiveCareText, - positiveTestsText, - textNl, - textShared, - sewerText, - } = pageText; + const { hospitalText, intensiveCareText, textNl, textShared, sewerText } = + pageText; const { formatPercentageAsNumber } = useFormatLokalizePercentage(); const internationalFeature = useFeature('inPositiveTestsPage'); const riskLevelFeature = useFeature('riskLevel'); - const sewageOnActueelFeature = useFeature('sewageOnActueel'); const metadata = { ...textNl.nationaal_metadata, @@ -317,35 +307,15 @@ const Home = (props: StaticProps) => { 'hospital_nice' ), } as MiniTileSelectorItem, - (sewageOnActueelFeature.isEnabled ? { + { label: textNl.mini_trend_tiles.sewer.menu_item_label, - data: dataSewerTotal.values.filter(x => typeof x.average === 'number'), - dataProperty: - 'average', - value: - dataSewerTotal.last_value - ?.average ?? - 0, - warning: getWarning( - content.elements.warning, - 'sewer' + data: dataSewerTotal.values.filter( + (x) => typeof x.average === 'number' ), - } as MiniTileSelectorItem - : { - label: - textNl.mini_trend_tiles.positief_geteste_mensen - .menu_item_label, - data: dataTestedOverall.values, - dataProperty: 'infected_moving_average_rounded', - value: - dataTestedOverall.last_value - .infected_moving_average_rounded, - warning: getWarning( - content.elements.warning, - 'tested_overall' - ), - } as MiniTileSelectorItem - ), + dataProperty: 'average', + value: dataSewerTotal.last_value?.average ?? 0, + warning: getWarning(content.elements.warning, 'sewer'), + } as MiniTileSelectorItem, { label: textNl.mini_trend_tiles.vaccinatiegraad.menu_item_label, @@ -364,7 +334,7 @@ const Home = (props: StaticProps) => { data.vaccine_coverage_per_age_group_estimated.last_value ?.age_18_plus_fully_vaccinated, }, - } as MiniTileSelectorItem + } as MiniTileSelectorItem, ].filter((x) => x !== undefined)} > ) => { content.elements.warning, 'hospital_nice' )} - />{ sewageOnActueelFeature.isEnabled ? - - - } - iconPlacement="right" - > - {textNl.mini_trend_tiles.sewer.read_more_link} - - - } - icon={} - values={dataSewerTotal.values} - seriesConfig={[ - { - type: 'split-area', - metricProperty: 'average', - label: commonTexts.common.daggemiddelde, - splitPoints: averageSplitPoints, - }, - ]} - dataOptions={{ - valueAnnotation: commonTexts.waarde_annotaties.riool_normalized, - }} - accessibility={{ key: 'topical_sewer' }} - warning={getWarning( - content.elements.warning, - 'sewer' - )} - /> - : - - } - iconPlacement="right" - > + /> + + - - } - icon={} - values={dataTestedOverall.values} - seriesConfig={[ - { - type: 'line', - metricProperty: 'infected_moving_average', - label: - positiveTestsText.tooltip_labels - .infected_moving_average, - color: colors.data.primary, - }, - { - type: 'bar', - metricProperty: 'infected', - label: - positiveTestsText.tooltip_labels.infected_overall, - color: colors.data.primary, - }, - ]} - accessibility={{ - key: 'topical_tested_overall_infected', - }} - warning={getWarning( - content.elements.warning, - 'tested_overall' - )} - dataOptions={{ - forcedMaximumValue: 150000, - outOfBoundsConfig: { - label: - positiveTestsText.tooltip_labels - .infected_out_of_bounds, - tooltipLabel: - positiveTestsText.tooltip_labels.annotations, - checkIsOutofBounds: ( - x: NlTestedOverallValue, - max: number - ) => x.infected > max, - }, - }} - /> - } + type: 'metric', + text: textNl.data_driven_texts.sewer_text.value, + metricName: 'sewer', + metricProperty: 'average', + additionalData: { + newDate: formatters.formatDateFromSeconds( + data.sewer.last_value.date_unix + ), + }, + }, + ]} + /> + } + iconPlacement="right" + > + {textNl.mini_trend_tiles.sewer.read_more_link} + + + } + icon={} + values={dataSewerTotal.values} + seriesConfig={[ + { + type: 'split-area', + metricProperty: 'average', + label: commonTexts.common.daggemiddelde, + splitPoints: averageSplitPoints, + }, + ]} + dataOptions={{ + valueAnnotation: + commonTexts.waarde_annotaties.riool_normalized, + }} + accessibility={{ key: 'topical_sewer' }} + warning={getWarning(content.elements.warning, 'sewer')} + />