From 722b4ed112a12ce20f8b24c191a2ee2657f7a02b Mon Sep 17 00:00:00 2001 From: VWSCoronaDashboard18 <93984341+VWSCoronaDashboard18@users.noreply.github.com> Date: Thu, 7 Apr 2022 11:44:42 +0200 Subject: [PATCH] Squashed commit of the following: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit b4cad79f3ab907d99b356fb9f037d48bd210ee1d Author: HO <93981322+VWSCoronaDashboard19@users.noreply.github.com> Date: Thu Apr 7 11:34:29 2022 +0200 fix: mark incomplete data (#4162) * fix: mark incomplete data * fix: remove unused vars commit a1ec9da950dcd58cdd50cf58d52c80e5f40937c9 Author: J <93984341+VWSCoronaDashboard18@users.noreply.github.com> Date: Thu Apr 7 11:01:08 2022 +0200 Set behavior annotations live (#4160) commit 4d01c5c71de25aac3ba8e2b8e6ed4f7a7d8b8697 Author: MN <97020799+VWSCoronaDashboard24@users.noreply.github.com> Date: Thu Apr 7 09:52:46 2022 +0200 Fix/revert new build setup (#4159) * Revert "Dockerfile add WORKDIR (#4158)" This reverts commit 7b7da7537c19b9485df1ba32f67e922f6d9102ea. * Revert "Fix/dockerfile relative paths (#4157)" This reverts commit 3228c1eeb551c81ac65ae02f9910fd2f8afa3400. * Revert "fix: use relative paths for build copy steps (#4154)" This reverts commit dedf734bbcc5043f8dbb9955ced57657f1e4b6f4. * Revert "Feature/docker image optimizations (#4144)" This reverts commit 1f844fe1d433cb189a16ca94dc952e164b06bfc1. Co-authored-by: VWSCoronaDashboard24 commit 1b8eb284ec6bab510f3e93a3c91beb1d9327971e Author: HO <93981322+VWSCoronaDashboard19@users.noreply.github.com> Date: Wed Apr 6 15:16:09 2022 +0200 feat: aligned timeframe options on all charts (#4155) * feat: aligned timeframe options on all charts * feat: moved option list to a maintainable location commit 7b7da7537c19b9485df1ba32f67e922f6d9102ea Author: MN <97020799+VWSCoronaDashboard24@users.noreply.github.com> Date: Wed Apr 6 14:59:13 2022 +0200 Dockerfile add WORKDIR (#4158) * fix: use relative paths for build copy steps * fix: attempt to use correct paths for copy steps * fix: merge conflict * fix: add workdir Co-authored-by: VWSCoronaDashboard24 commit c867a4294967c7f01a30f2efa0919242e98f54bd Author: J <93984341+VWSCoronaDashboard18@users.noreply.github.com> Date: Wed Apr 6 14:20:27 2022 +0200 Feature/update actueel sewer with data driven text (#4156) * Added sanity text * Added sanity text commit 3228c1eeb551c81ac65ae02f9910fd2f8afa3400 Author: MN <97020799+VWSCoronaDashboard24@users.noreply.github.com> Date: Wed Apr 6 13:51:19 2022 +0200 Fix/dockerfile relative paths (#4157) * fix: use relative paths for build copy steps * fix: attempt to use correct paths for copy steps * fix: merge conflict Co-authored-by: VWSCoronaDashboard24 commit dedf734bbcc5043f8dbb9955ced57657f1e4b6f4 Author: MN <97020799+VWSCoronaDashboard24@users.noreply.github.com> Date: Wed Apr 6 11:15:57 2022 +0200 fix: use relative paths for build copy steps (#4154) Co-authored-by: VWSCoronaDashboard24 commit 1f844fe1d433cb189a16ca94dc952e164b06bfc1 Author: MN <97020799+VWSCoronaDashboard24@users.noreply.github.com> Date: Wed Apr 6 10:13:23 2022 +0200 Feature/docker image optimizations (#4144) * feat: use standalone build of NextJS and outputFileTracing to reduce image size * fix: improve download script * wip: file proxy to sanity * wip: rewrite headers * wip: rewrite middlewares * feat: removed helmet, custom next-server.js * fix: cleanup todos * fix: cleanup Dockerfile * fix: cleanup next config * fix: copy static folder after build to make it run locally * fix: merge conflicts Co-authored-by: VWSCoronaDashboard24 commit 897aab5e6f9fd5e6ac75176295d0fe56aac91c65 Author: J <93984341+VWSCoronaDashboard18@users.noreply.github.com> Date: Wed Apr 6 09:58:38 2022 +0200 Feature/add sewerdata to actueel (#4146) * added feature flag for sewage * added sewer to actueel nl * Added to VR and GM and set the right order and replace the postive test instead of IC and added redirect to domain page * turn feature off * added remaining lokalize texts * Adjusted according to PR feedback * Added key in sanity because of mismatch commit 852c487cd00250d702731676835feb767a073597 Author: HO <93981322+VWSCoronaDashboard19@users.noreply.github.com> Date: Wed Apr 6 09:21:53 2022 +0200 Revert to old download command (#4153) * fix: revert to old download command due to pipeline issues * fix: revert data structure change Co-authored-by: VWSCoronaDashboard24 commit d14979832a8300265106539ec9d123fc4537aba7 Author: J <93984341+VWSCoronaDashboard18@users.noreply.github.com> Date: Wed Apr 6 00:15:37 2022 +0200 Feature/behavior annotations match be (#4150) * schema edit for Backend * Adjusted naming for backend input and added locale commit 8627c0050c3d7060054c66032d3f2988f6a6333b Author: MN <97020799+VWSCoronaDashboard24@users.noreply.github.com> Date: Tue Apr 5 17:02:50 2022 +0200 fix: use generate-date-types instead of generate-typescript (#4151) Co-authored-by: VWSCoronaDashboard24 commit ea97fc3c6f831fb6c7d0110280aee5aaa7f20c4e Author: HO <93981322+VWSCoronaDashboard19@users.noreply.github.com> Date: Tue Apr 5 11:06:39 2022 +0200 fix: add halfbarwidth conditionally to chart (#4149) commit 78726659c0d6819c48f7d1f8e3279ace280bcb13 Author: VWSCoronaDashboard20 <93990227+VWSCoronaDashboard20@users.noreply.github.com> Date: Mon Apr 4 13:06:09 2022 +0200 feat: implement redirect and updated script (#4147) Co-authored-by: “MA” <“”> commit 7a721ae31c70735045b01bc89d2a4859d2375ed3 Author: HO <93981322+VWSCoronaDashboard19@users.noreply.github.com> Date: Mon Apr 4 12:04:44 2022 +0200 Feature/update scripts (#4148) * feat: update scripts so we can generate data types * feat: revert fault change * feat: change docs for data types commit 25461602320e50d495bed2931dbf5990186cff37 Author: HO <93981322+VWSCoronaDashboard19@users.noreply.github.com> Date: Mon Apr 4 10:02:50 2022 +0200 feat: Upgrade to latest version of Sanity and update corresponding files (#4145) commit d6b49c24bcd043ea312afddb92e61bfd2d8dc489 Author: A <93994194+VWSCoronaDashboard21@users.noreply.github.com> Date: Thu Mar 31 14:34:40 2022 +0200 feature flag added (#4143) Co-authored-by: VWSCoronaDashboard21 commit 22b52a8d99300c1f2523075797c03c3098d40dd2 Author: A <93994194+VWSCoronaDashboard21@users.noreply.github.com> Date: Thu Mar 31 12:49:45 2022 +0200 add vaccine novavax (#4138) * add vaccine novavax * added novavax to sanity Co-authored-by: VWSCoronaDashboard21 commit 4b1a7bb4fb3ced66b7486dc795dd8b7e6f07132d Author: VWSCoronaDashboard22 <93981265+VWSCoronaDashboard22@users.noreply.github.com> Date: Thu Mar 31 10:57:27 2022 +0200 Expanded timeframe options for most charts (#4142) commit a73541c8670c4bc9dde383f6340419221f423e98 Author: HO <93981322+VWSCoronaDashboard19@users.noreply.github.com> Date: Thu Mar 31 10:21:10 2022 +0200 Update scripts in monorepo and subprojects (#4141) * feat: update scripts - Updated scripts - Added shortcut scripts - Updated docs - Updated linter * fix: added missing changes * feat: rename lokalize scripts * feat: updated github workflow with new scripts commit ab2367ee69719cc20b32bff12e721841a000d095 Author: VWSCoronaDashboard22 <93981265+VWSCoronaDashboard22@users.noreply.github.com> Date: Wed Mar 30 14:42:56 2022 +0200 Added component for rich content input types to display styled validation messages (#4139) commit 412a3ea33defe05ed2f1d0cb5c68bdd69fcdf968 Author: VWSCoronaDashboard22 <93981265+VWSCoronaDashboard22@users.noreply.github.com> Date: Wed Mar 30 14:20:44 2022 +0200 Added timeframe options of one week and six months (#4140) * Added timeframe options of one week and six months * Added new timeframe options to sanity commit 75a3176c44ac48a4ff32a6a42b9fb9e7265b029d Author: J <93984341+VWSCoronaDashboard18@users.noreply.github.com> Date: Wed Mar 30 09:43:26 2022 +0200 Feature/behaviour annotations (#4128) * new data in schema * start changing timeline * Changing the logic and adding the dataconnection * Added x-axis date-range * Added Sanity keys * Fix TS warnings * Fixing Typescript errors * Fixing Typescript errors * Notify when wrong data is used * new data in schema * start changing timeline * Changing the logic and adding the dataconnection * Added x-axis date-range * Added Sanity keys * Fix TS warnings * Fixing Typescript errors * Fixing Typescript errors * Notify when wrong data is used * Update packages/app/src/pages/landelijk/gedrag.tsx Co-authored-by: MN <97020799+VWSCoronaDashboard24@users.noreply.github.com> * Update packages/app/src/domain/behavior/behavior-line-chart-tile.tsx Co-authored-by: MN <97020799+VWSCoronaDashboard24@users.noreply.github.com> * Update packages/app/src/domain/behavior/behavior-line-chart-tile.tsx Co-authored-by: MN <97020799+VWSCoronaDashboard24@users.noreply.github.com> * new data in schema * Changing the logic and adding the dataconnection * Added x-axis date-range * Fix TS warnings * Fixing Typescript errors * Fixing Typescript errors * Notify when wrong data is used * Update packages/app/src/pages/landelijk/gedrag.tsx Co-authored-by: MN <97020799+VWSCoronaDashboard24@users.noreply.github.com> * Update packages/app/src/domain/behavior/behavior-line-chart-tile.tsx Co-authored-by: MN <97020799+VWSCoronaDashboard24@users.noreply.github.com> * Update packages/app/src/domain/behavior/behavior-line-chart-tile.tsx Co-authored-by: MN <97020799+VWSCoronaDashboard24@users.noreply.github.com> * New sanity location * update sanity type errors Co-authored-by: MN <97020799+VWSCoronaDashboard24@users.noreply.github.com> commit 0712ba47fe8030145eb7d2b8d73a1a7d7fc71737 Author: HO <93981322+VWSCoronaDashboard19@users.noreply.github.com> Date: Wed Mar 30 09:13:27 2022 +0200 feat: updated imports (#4137) Compact imports by adding an index to modules commit f795d6cde95ec0e12c6bc929257c63f675c1fb84 Author: VWSCoronaDashboard22 <93981265+VWSCoronaDashboard22@users.noreply.github.com> Date: Mon Mar 28 15:46:13 2022 +0200 Split lokalize texts into common and pages (#4119) * Split lokalize texts into common and pages * Fixed some type issues * More type fixes * Fixed repeating_shot_information_block * Merge branch 'develop' into feature/split-lokalize-text * Fixed types and references * Corrected references * Moved lokalize texts * Renamed some variables for consistency * Fixed text replace vars commit 9c3b9c37c10cf40de236e903c7c6e5b819e66073 Author: J <93984341+VWSCoronaDashboard18@users.noreply.github.com> Date: Fri Mar 25 11:13:44 2022 +0100 removed date interval (#4133) --- .github/workflows/main.yml | 18 +- .github/workflows/sync-sanity-lokalize.yml | 2 +- Dockerfile | 4 +- docs/ci.md | 2 +- docs/developers.md | 10 + docs/feature-flags.md | 3 - docs/lokalize-texts.md | 28 +- docs/release-procedure.md | 9 +- docs/schema.md | 2 +- eslint-overrides.json | 1 + package.json | 19 +- packages/app/README.md | 4 +- packages/app/next.config.js | 5 + packages/app/schema/nl/__index.json | 4 + .../app/schema/nl/behavior_annotations.json | 76 ++ .../app/schema/nl/vaccine_administered.json | 4 + .../app/src/components/article-detail.tsx | 15 +- .../app/src/components/article-teaser.tsx | 4 +- .../components/breadcrumbs/breadcrumbs.tsx | 4 +- .../breadcrumbs/logic/use-breadcrumbs.tsx | 20 +- .../src/components/chart-region-controls.tsx | 24 +- .../src/components/chart-time-controls.tsx | 23 +- .../components/canvas-choropleth-map.tsx | 4 + .../choropleth/components/choropleth-map.tsx | 1 + .../app/src/components/choropleth/index.tsx | 6 +- .../tooltips/choropleth-tooltip.tsx | 4 +- .../components/cms/inline-age-demographic.tsx | 6 +- .../src/components/cms/inline-choropleth.tsx | 12 +- .../src/components/cms/inline-donut-chart.tsx | 10 +- .../app/src/components/cms/inline-kpi.tsx | 6 +- .../cms/inline-time-series-charts.tsx | 26 +- .../src/components/combo-box/combo-box.tsx | 4 +- .../app/src/components/content-teaser.tsx | 7 +- .../data-driven-text/components/metric.tsx | 4 +- .../inline-difference.tsx | 4 +- .../tile-average-difference.tsx | 4 +- .../difference-indicator/tile-difference.tsx | 4 +- .../app/src/components/editorial-detail.tsx | 4 +- .../src/components/error-boundary/index.tsx | 21 +- .../src/components/fullscreen-chart-tile.tsx | 8 +- packages/app/src/components/index.ts | 24 + .../app/src/components/interactive-legend.tsx | 4 +- .../app/src/components/layout/app-content.tsx | 6 +- .../app/src/components/layout/app-footer.tsx | 2 +- .../app/src/components/layout/app-header.tsx | 4 +- .../src/components/layout/components/logo.tsx | 6 +- .../layout/components/top-navigation.tsx | 20 +- packages/app/src/components/loader/loader.tsx | 76 +- .../app/src/components/lokalize-metadata.tsx | 4 +- packages/app/src/components/metadata.tsx | 26 +- .../components/articles.tsx | 4 +- .../components/metadata.tsx | 18 +- .../components/page-links.tsx | 6 +- .../page-information-block.tsx | 6 +- .../rich-content-select.tsx | 4 +- packages/app/src/components/search-input.tsx | 4 +- packages/app/src/components/seo-head.tsx | 8 +- .../components/sitemap/use-data-sitemap.ts | 91 +- .../time-series-chart/components/axes.tsx | 131 ++- .../timeline/components/tooltip-content.tsx | 12 +- .../components/timeline/timeline.tsx | 4 +- .../components/timespan-annotation.tsx | 22 +- .../components/week-numbers.tsx | 6 +- .../time-series-chart/logic/common.ts | 1 + .../time-series-chart/logic/legend.tsx | 6 +- .../time-series-chart/time-series-chart.tsx | 6 +- packages/app/src/data/index.ts | 2 + .../behavior/behavior-choropleths-tile.tsx | 23 +- .../behavior/behavior-line-chart-tile.tsx | 37 +- .../behavior/behavior-per-age-group-tile.tsx | 18 +- .../domain/behavior/behavior-table-tile.tsx | 13 +- .../behavior/components/behavior-trend.tsx | 14 +- .../behavior/components/more-information.tsx | 19 +- .../behavior/components/select-behavior.tsx | 4 +- .../logic/use-behavior-lookup-keys.ts | 6 +- .../behavior/tooltip/vr-behavior-tooltip.tsx | 12 +- packages/app/src/domain/deceased/index.ts | 1 + .../escalation-level-banner.tsx | 4 +- .../escalation-level-label.tsx | 8 +- .../app/src/domain/escalation-level/index.ts | 2 + .../admissions-per-age-group.tsx | 13 +- .../admissions-per-age-group/index.ts | 1 - packages/app/src/domain/hospital/index.ts | 1 + .../components/narrow-infected-table.tsx | 20 +- .../components/wide-infected-table.tsx | 14 +- .../infected-table-tile.tsx | 28 +- .../mult-select-countries-input.tsx | 8 +- .../multi-select-country-results.tsx | 17 +- .../select-country/select-country-input.tsx | 6 +- .../select-country/select-country.tsx | 6 +- .../domain/layout/components/gm-combo-box.tsx | 4 +- .../domain/layout/components/vr-combo-box.tsx | 4 +- packages/app/src/domain/layout/gm-layout.tsx | 10 +- packages/app/src/domain/layout/in-layout.tsx | 4 +- packages/app/src/domain/layout/index.ts | 6 + packages/app/src/domain/layout/layout.tsx | 24 +- .../src/domain/layout/logic/use-sidebar.tsx | 8 +- packages/app/src/domain/layout/nl-layout.tsx | 10 +- packages/app/src/domain/layout/vr-layout.tsx | 8 +- .../components/location-tooltip.tsx | 4 +- .../domain/sewer/sewer-chart/sewer-chart.tsx | 33 +- ...tuations-data-coverage-choropleth-tile.tsx | 2 +- .../situations/situations-over-time-chart.tsx | 4 +- .../domain/tested/g-number-bar-chart-tile.tsx | 4 +- packages/app/src/domain/tested/index.ts | 3 + .../infected-per-age-group.tsx | 29 +- .../domain/tested/reproduction-chart-tile.tsx | 3 +- .../app/src/domain/topical/article-list.tsx | 5 +- .../topical/components/search/context.tsx | 4 +- .../topical/components/search/hit-list.tsx | 16 +- .../components/search/search-input.tsx | 8 +- .../src/domain/topical/highlights-tile.tsx | 5 + packages/app/src/domain/topical/index.ts | 9 + .../topical/mini-tile-selector-layout.tsx | 15 +- .../domain/topical/topical-section-header.tsx | 18 +- .../vaccination-coverage-choropleth.tsx | 45 +- .../components/narrow-coverage-table.tsx | 8 +- .../components/wide-coverage-table.tsx | 12 +- .../vaccine/components/age-group-select.tsx | 19 +- .../vaccination-coverage-kind-select.tsx | 12 +- packages/app/src/domain/vaccine/index.ts | 14 + .../vaccine/logic/use-agegroup-labels.ts | 4 +- ...e-vaccine-coverage-percentage-formatter.ts | 10 +- .../vaccine/vaccinations-over-time-chart.tsx | 24 +- .../vaccine/vaccinations-over-time-tile.tsx | 23 +- .../vaccinations-third-shot-kpi-section.tsx | 39 + .../vaccine-administrations-kpi-section.tsx | 21 +- ...ne-booster-administrations-kpi-section.tsx | 7 +- .../vaccine-coverage-choropleth-per-gm.tsx | 32 +- .../components/narrow-coverage-table.tsx | 13 +- .../components/wide-coverage-table.tsx | 14 +- .../vaccine-coverage-per-age-group.tsx | 7 +- .../vaccine/vaccine-coverage-toggle-tile.tsx | 16 +- .../vaccine/vaccine-delivery-bar-chart.tsx | 21 +- .../vaccine-stock-per-supplier-chart.tsx | 40 +- .../static-props/get-variant-chart-data.ts | 2 +- .../domain/variants/variants-over-time.tsx | 21 +- .../variants-stacked-area-tile.tsx | 122 ++- .../components/narrow-variants-table.tsx | 8 +- .../components/no-percentage-data.tsx | 9 +- .../components/variant-difference.tsx | 18 +- .../components/variant-name-cell.tsx | 5 +- .../components/wide-variants-table.tsx | 3 +- .../logic/use-variant-name-and-description.ts | 52 +- .../variants/variants-table-tile/types.ts | 115 +++ packages/app/src/intl/hooks/use-intl.ts | 8 +- packages/app/src/pages/404.tsx | 8 +- packages/app/src/pages/500.tsx | 8 +- packages/app/src/pages/_app.tsx | 2 +- packages/app/src/pages/_error.tsx | 10 +- .../app/src/pages/actueel/gemeente/[code].tsx | 180 +++- .../app/src/pages/actueel/gemeente/index.tsx | 23 +- .../pages/actueel/veiligheidsregio/[code].tsx | 195 +++- .../pages/actueel/veiligheidsregio/index.tsx | 27 +- packages/app/src/pages/artikelen/[slug].tsx | 16 +- packages/app/src/pages/artikelen/index.tsx | 17 +- packages/app/src/pages/contact.tsx | 4 +- .../app/src/pages/gemeente/[code]/index.tsx | 7 +- .../[code]/positief-geteste-mensen.tsx | 55 +- .../src/pages/gemeente/[code]/rioolwater.tsx | 16 +- .../app/src/pages/gemeente/[code]/sterfte.tsx | 33 +- .../src/pages/gemeente/[code]/vaccinaties.tsx | 70 +- .../gemeente/[code]/ziekenhuis-opnames.tsx | 47 +- packages/app/src/pages/gemeente/index.tsx | 10 +- packages/app/src/pages/index.tsx | 211 +++- .../app/src/pages/internationaal/index.tsx | 4 +- .../positief-geteste-mensen.tsx | 45 +- .../src/pages/internationaal/varianten.tsx | 63 +- .../pages/landelijk/besmettelijke-mensen.tsx | 11 +- .../app/src/pages/landelijk/brononderzoek.tsx | 21 +- .../app/src/pages/landelijk/coronamelder.tsx | 33 +- packages/app/src/pages/landelijk/gedrag.tsx | 90 +- .../src/pages/landelijk/gehandicaptenzorg.tsx | 28 +- packages/app/src/pages/landelijk/index.tsx | 26 +- .../landelijk/intensive-care-opnames.tsx | 65 +- .../app/src/pages/landelijk/maatregelen.tsx | 11 +- .../landelijk/positief-geteste-mensen.tsx | 77 +- .../src/pages/landelijk/reproductiegetal.tsx | 11 +- .../app/src/pages/landelijk/rioolwater.tsx | 26 +- packages/app/src/pages/landelijk/sterfte.tsx | 40 +- .../pages/landelijk/thuiswonende-ouderen.tsx | 21 +- .../app/src/pages/landelijk/vaccinaties.tsx | 95 +- .../app/src/pages/landelijk/varianten.tsx | 22 +- .../landelijk/verdenkingen-huisartsen.tsx | 61 +- .../src/pages/landelijk/verpleeghuiszorg.tsx | 19 +- .../pages/landelijk/ziekenhuis-opnames.tsx | 89 +- packages/app/src/pages/over-risiconiveaus.tsx | 6 +- packages/app/src/pages/over.tsx | 4 +- packages/app/src/pages/toegankelijkheid.tsx | 4 +- .../app/src/pages/veelgestelde-vragen.tsx | 4 +- .../veiligheidsregio/[code]/brononderzoek.tsx | 24 +- .../pages/veiligheidsregio/[code]/gedrag.tsx | 50 +- .../[code]/gehandicaptenzorg.tsx | 23 +- .../pages/veiligheidsregio/[code]/index.tsx | 4 +- .../veiligheidsregio/[code]/maatregelen.tsx | 4 +- .../[code]/positief-geteste-mensen.tsx | 62 +- .../veiligheidsregio/[code]/rioolwater.tsx | 14 +- .../pages/veiligheidsregio/[code]/sterfte.tsx | 39 +- .../[code]/thuiswonende-ouderen.tsx | 18 +- .../veiligheidsregio/[code]/vaccinaties.tsx | 73 +- .../[code]/verpleeghuiszorg.tsx | 16 +- .../[code]/ziekenhuis-opnames.tsx | 49 +- .../app/src/pages/veiligheidsregio/index.tsx | 12 +- packages/app/src/pages/verantwoording.tsx | 7 +- .../use-accessibility-features.spec.tsx | 4 +- .../__tests__/use-format-date-range.spec.tsx | 4 +- .../app/src/utils/get-avarage-split-points.ts | 39 + packages/app/src/utils/index.ts | 12 + .../utils/use-accessibility-annotations.tsx | 12 +- .../app/src/utils/use-escalation-level.tsx | 6 +- packages/app/src/utils/use-scoped-warning.ts | 4 +- packages/cli/README.md | 2 +- packages/cli/package.json | 5 +- .../cli/src/scripts/generate-data-types.ts | 2 +- packages/cms/config/.checksums | 3 +- packages/cms/config/@sanity/vision.json | 3 + packages/cms/package.json | 31 +- .../validated-input/validated-input.tsx | 21 + packages/cms/src/data/data-structure.ts | 10 +- packages/cms/src/lokalize/apply-json-edits.ts | 6 +- .../cms/src/lokalize/{export.ts => import.ts} | 20 +- packages/cms/src/lokalize/key-mutations.csv | 921 ++++++++++++++++++ packages/cms/src/lokalize/logic/files.ts | 2 +- .../lokalize/logic/{export.ts => import.ts} | 4 +- packages/cms/src/lokalize/logic/index.ts | 2 +- .../cms/src/schemas/locale/locale-block.ts | 2 + .../locale/locale-rich-content-block.ts | 2 + packages/common/src/data-sorting.ts | 2 +- packages/common/src/feature-flags/features.ts | 17 + packages/common/src/theme/colors.ts | 1 + packages/common/src/types/data.ts | 30 +- packages/common/src/utils/timeframe/index.ts | 18 +- yarn.lock | 859 ++++++++-------- 233 files changed, 4149 insertions(+), 2283 deletions(-) create mode 100644 packages/app/schema/nl/behavior_annotations.json create mode 100644 packages/app/src/data/index.ts create mode 100644 packages/app/src/domain/deceased/index.ts create mode 100644 packages/app/src/domain/escalation-level/index.ts delete mode 100644 packages/app/src/domain/hospital/admissions-per-age-group/index.ts create mode 100644 packages/app/src/domain/hospital/index.ts create mode 100644 packages/app/src/domain/layout/index.ts create mode 100644 packages/app/src/domain/tested/index.ts create mode 100644 packages/app/src/domain/topical/index.ts rename packages/app/src/domain/{actueel => topical}/vaccination-coverage-choropleth.tsx (85%) create mode 100644 packages/app/src/domain/vaccine/index.ts create mode 100644 packages/app/src/domain/vaccine/vaccinations-third-shot-kpi-section.tsx create mode 100644 packages/app/src/utils/get-avarage-split-points.ts create mode 100644 packages/app/src/utils/index.ts create mode 100644 packages/cms/config/@sanity/vision.json rename packages/cms/src/lokalize/{export.ts => import.ts} (78%) rename packages/cms/src/lokalize/logic/{export.ts => import.ts} (97%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a00059b31b..ca8b5a2ab2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -66,18 +66,18 @@ jobs: run: yarn install - name: Build icon package - run: yarn workspace @corona-dashboard/icons build + run: yarn build:icons - name: Build common module - run: yarn workspace @corona-dashboard/common build + run: yarn build:common - - name: Export texts (develop) + - name: Import texts (develop) if: ${{ env.BRANCH_NAME != 'master' }} - run: yarn workspace @corona-dashboard/cms lokalize:export --clean-json + run: yarn cms:lokalize-import --clean-json - - name: Export texts (production) + - name: Import texts (production) if: ${{ env.BRANCH_NAME == 'master' }} - run: yarn workspace @corona-dashboard/cms lokalize:export --dataset="production" --clean-json + run: yarn cms:lokalize-import:prd --clean-json - name: Typecheck all code run: yarn typecheck @@ -106,13 +106,13 @@ jobs: run: yarn install - name: Build common module - run: yarn workspace @corona-dashboard/common build + run: yarn build:common - name: Build icons module - run: yarn workspace @corona-dashboard/icons build + run: yarn build:icons - name: Export texts - run: yarn workspace @corona-dashboard/cms lokalize:export --clean-json + run: yarn cms:lokalize-import --clean-json - name: Run tests run: yarn test:ci diff --git a/.github/workflows/sync-sanity-lokalize.yml b/.github/workflows/sync-sanity-lokalize.yml index ab31cc6e38..d03c586eaa 100644 --- a/.github/workflows/sync-sanity-lokalize.yml +++ b/.github/workflows/sync-sanity-lokalize.yml @@ -40,7 +40,7 @@ jobs: SANITY_TOKEN: ${{ secrets.sanity_token }} - name: Export production texts - run: yarn workspace @corona-dashboard/cms lokalize:export --dataset=production --clean-json + run: yarn workspace @corona-dashboard/cms lokalize:import --dataset=production --clean-json - name: Typecheck all code with production texts run: yarn workspace @corona-dashboard/app typecheck diff --git a/Dockerfile b/Dockerfile index 67f47f3410..1b7e7cf337 100644 --- a/Dockerfile +++ b/Dockerfile @@ -48,7 +48,7 @@ RUN apk add --no-cache --virtual \ FROM deps as builder COPY . . RUN yarn workspace @corona-dashboard/common build \ -&& yarn workspace @corona-dashboard/cli generate-typescript \ +&& yarn workspace @corona-dashboard/cli generate-data-types \ && yarn workspace @corona-dashboard/icons build \ && yarn test:ci @@ -74,7 +74,7 @@ FROM builder RUN yarn download \ && yarn workspace @corona-dashboard/cli validate-json-all \ && yarn workspace @corona-dashboard/cli validate-last-values --fail-early \ -&& yarn workspace @corona-dashboard/cms lokalize:export --dataset=$NEXT_PUBLIC_SANITY_DATASET \ +&& yarn workspace @corona-dashboard/cms lokalize:import --dataset=$NEXT_PUBLIC_SANITY_DATASET \ && yarn workspace @corona-dashboard/app build \ && mkdir -p /app/packages/app/public/images/choropleth \ && addgroup -g 1001 -S nodejs \ diff --git a/docs/ci.md b/docs/ci.md index b04cb6fbda..0ff75c1d24 100644 --- a/docs/ci.md +++ b/docs/ci.md @@ -37,7 +37,7 @@ The build process follows these steps: - Run the unit tests - Download the server data files - Run all the JSON data validations - - Run lokalize:export to retrieve all the translations from Sanity + - Run lokalize:import to retrieve all the translations from Sanity - Run the NextJs build [Back to index](index.md) diff --git a/docs/developers.md b/docs/developers.md index 9a38c795d6..2226ae2f36 100644 --- a/docs/developers.md +++ b/docs/developers.md @@ -1,5 +1,15 @@ # Developer Notes +## Shortcut scripts + +The monorepo contains projects which the developer can access with shortcut scripts at the root of the project. Instead of writing the path in the CLI like `yarn workspace @corona-dashboard cms lokalize:import`, we can access the script by writing `yarn cms:lokalize-import` to bring your local JSON files up-to-date with the Sanity dataset. Another example is using `yarn build:app` instead of `yarn workspace @corona-dashboard/app build` to make a build during the release procedure. Lastly, running `yarn check-all` will make sure the code, data and tests work as expected, instead of running scripts individually. + +Available shortcut scripts: + +- `yarn check-all` +- `yarn cms:[command]` +- `yarn build:[command]` + ## Common and icon packages The monorepo contains two shared packages: common and icons. diff --git a/docs/feature-flags.md b/docs/feature-flags.md index 0dd5c2d00c..6e98e5b081 100644 --- a/docs/feature-flags.md +++ b/docs/feature-flags.md @@ -89,7 +89,4 @@ already existing metric, then declaring those properties will mean that only the checks are performed on those. If the whole schema / metric is new, as it often is, then specifying only the `metricName` is sufficient. -The script that validates the features (and runs at build-time) can be -triggered locally with `yarn workspace@corona-dashboard/cli validate-features`. - [Back to index](index.md) diff --git a/docs/lokalize-texts.md b/docs/lokalize-texts.md index f9d91c9808..c17a8d5695 100644 --- a/docs/lokalize-texts.md +++ b/docs/lokalize-texts.md @@ -9,7 +9,7 @@ our codebase. Even though these texts now live as documents in Sanity, we still refer to them as "lokalize texts". Each text string lives as a document in the CMS, of which each has a unique "key" -corresponding to a path. These documents are then exported as JSON files (one +corresponding to a path. These documents are then imported as JSON files (one for each language) and consumed by the application as static data. This document describes how to manage and make changes to these texts. @@ -19,15 +19,15 @@ This document describes how to manage and make changes to these texts. In summary these are the most important things you should be aware of: - Commands are run with `yarn lokalize:[command]` from the `packages/cms` root -- The `export` command brings your local JSON files up-to-date with the Sanity +- The `import` command brings your local JSON files up-to-date with the Sanity dataset. The TypeScript compiler will error when your JSON files do not contain all the texts which are referenced in the code. -- The JSON export contains document ids as part of the keys. You can make +- The JSON import contains document ids as part of the keys. You can make changes locally to the **app/src/locale/nl_export.json** file. Add new keys, delete them or rename and move existing ones. After you make changes run the `lokalize:apply-json-edits` script. This will give you a list of changes and you can decide which ones to apply. Changes are written in a mutation log - file, and at the end the JSON is re-exported to reflect all changes. + file, and at the end the JSON is re-imported to reflect all changes. It is recommended to run `lokalize:apply-json-edits` after the feature has been finished, right before merging it to develop since during development changes to the **nl_export.json** file might fluctuate. @@ -63,26 +63,26 @@ scripts. Merge conflicts in this file are common. You should always "accept both changes" when resolving conflicts, so that none of the lines are ever deleted. -## Export +## Import The application reads its locale strings from **packages/app/public/nl_export.json** and **packages/app/public/en_export.json**. -These JSONs are exported from the Sanity lokalize documents, but they are not -part of the repository. Therefore, you will regularly need to run `yarn lokalize:export` in +These JSONs are imported from the Sanity lokalize documents, but they are not +part of the repository. Therefore, you will regularly need to run `yarn lokalize:import` in order to keep your local JSON file up-to-date with the Sanity dataset. The JSONs will include Sanity document ids in every leaf-key which are used to detect add-/delete-/move-actions of texts (`some_key__@__{document_id}`). These ids would result in compile- and run-time errors, but there's a workaround: -- compile-time: every export will also emit a `site-text.d.ts` with a `SiteText` +- compile-time: every import will also emit a `site-text.d.ts` with a `SiteText` interface. This interface is used to type the imported JSONs. - run-time: on load of the app all ids will be removed from the keys. The runtime workaround would be a waste of resources on production, so for this reason we use the `--clean-json` flag to ignore document ids. -### Export/Import technical details +### Technical details In Sanity each lokalize value is stored as a separate `lokalizeText` document. The key property in this document represents the flattened property path in **nl_export.json** @@ -107,7 +107,7 @@ The root key (so in this case `accessibility`) will be saved as the subject prop This allows us to filter on this subject under the Sanity `Lokalize` menu item. Making it a little easier for an editor to lookup a specific key in the menu. -So, `yarn lokalize:export` simply retrieves all of the `lokalizeText` documents, replaces their ids in the root part of the path +So, `yarn lokalize:import` simply retrieves all of the `lokalizeText` documents, replaces their ids in the root part of the path and unflattens this list of paths into a JSON file. (The Dutch texts are serialized as **nl_export.json**, the English as **en_export.json**). `yarn lokalize:apply-json-edits` does the exact opposite, it takes the **nl_export.json** file, flattens the file into an array of paths and saves those to Sanity. Obviously there is a bunch of logic involved that checks if a path is new or existing, but for those @@ -116,7 +116,7 @@ details we refer to the source code. ## How to Add, Delete or Move Texts First make sure the JSONs include document ids (`some_key__@__{document_id}`). -Run `yarn lokalize:export` if these are not yet present in your JSONs. +Run `yarn lokalize:import` if these are not yet present in your JSONs. You can add, delete and move keys by mutating the **nl_export.json** file. The sync script will automagically detect additions, deletions or moved lokalize @@ -129,7 +129,7 @@ file. New texts will only have an NL (Dutch) string when they are added and will use NL as a fallback. -After syncing texts, the export script is called to update your local JSON file +After syncing texts, the import script is called to update your local JSON file and re-generate the SiteText type interface. ### Delete/Move Mutations @@ -139,7 +139,7 @@ dataset, we can not simply remove a lokalize text document from the dataset without potentially breaking other branches. For this reason, when you delete a lokalize text, it will append the delete -action to the mutations file but not actually delete the document. The export +action to the mutations file but not actually delete the document. The import filters out any deletions that were logged to the mutations file. So in effect you end up with a local JSON file that has the deleted key removed, and the TS compiler sees the correct dataset. @@ -148,7 +148,7 @@ The actual deletions from Sanity only happen in the `sync-after-feature` phase, describe below. The same goes for move mutations. When you apply the move in your feature branch -it will be simulated in the JSON export, but not yet applied to the CMS +it will be simulated in the JSON import, but not yet applied to the CMS documents. During sync-after-feature the move is finalized by changing the key and subject properties of the targeted document. This preserves the document history and drafts. diff --git a/docs/release-procedure.md b/docs/release-procedure.md index 6b690bcb63..fbc9c1a59c 100644 --- a/docs/release-procedure.md +++ b/docs/release-procedure.md @@ -6,7 +6,8 @@ 2. Merge the develop branch into the release branch. 3. Do a full build with a Sanity export from production to make sure everything works. - Use `yarn lokalize:export --dataset=production` to create the Sanity export. + Use `yarn cms:lokalize-import:prd` to create the Sanity export. + Use `yarn build:app` to create a build with the latest production dataset Test the build locally by running `yarn start`. @@ -23,9 +24,9 @@ 8. Hit the publish button in the GitHub release draft. This should tag the correct commit in `master`. 9. Important before running the next step is building the common package to avoid any typescript errors, - so run `yarn workspace @corona-dashboard/common build`. + so run `yarn build:common`. 10. After we are sure we are moving to production with the release as it is, - run the `yarn workspace @corona-dashboard/cms lokalize:sync-after-release` + run the `yarn cms:sync-after-release` script. This script will perform any necessary text mutations for keys that have been moved, and also cleans up any deleted texts from the Sanity production dataset. For more information [read this](/docs/lokalize-texts.md#sync-after-release). @@ -99,7 +100,7 @@ the `key-mutations.csv` file and commit this to the release branch. ## CMS Deploy Sometimes a release also contains new configurations for the CMS. These are -deployed via the Sanity CLI as `yarn deploy`. These deployments do +deployed via the Sanity CLI by running `yarn cms:deploy` in the root of the project. These deployments do not usually need to be done simultaneously with the release. If they are backwards-compatible they could be performed at any time and also repeatedly. diff --git a/docs/schema.md b/docs/schema.md index 7cb4d753c4..28bb29c39a 100644 --- a/docs/schema.md +++ b/docs/schema.md @@ -31,7 +31,7 @@ that are referenced by the entry point. The schemas are also used to generate Typescript interfaces from their `title` attribute. This way the data shape is always synchronized with the frontend -implementations. To execute this functionality run the `yarn generate-typescript` command from the project root directory. The output of this +implementations. To execute this functionality run the `yarn generate-data-types` command from the project root directory. The output of this script is saved to the **src/types/data.ts** file. The titles are automatically PascalCased so spaces and \_ are replaced. In other to avoid naming conflicts it is advised to prefix the titles. See [Guidelines For New diff --git a/eslint-overrides.json b/eslint-overrides.json index 9542695829..143799cdc5 100644 --- a/eslint-overrides.json +++ b/eslint-overrides.json @@ -19,6 +19,7 @@ "@typescript-eslint/no-var-requires": 0, "@typescript-eslint/explicit-module-boundary-types": 0, "@typescript-eslint/no-use-before-define": 0, + "@typescript-eslint/triple-slash-reference": 0, "@typescript-eslint/no-unused-vars": [ 2, { diff --git a/package.json b/package.json index ad246fb8fe..8866df08c0 100644 --- a/package.json +++ b/package.json @@ -9,21 +9,30 @@ "bootstrap": "yarn workspaces foreach run bootstrap", "clean": "yarn workspaces foreach run clean && npx rimraf .build-cache", "nuke": "yarn workspaces foreach run nuke && npx rimraf node_modules", - "typecheck": "yarn workspaces foreach run typecheck", - "lint": "yarn workspaces foreach run lint", + "typecheck": "echo 'Starting typecheck...' && yarn workspaces foreach run typecheck", + "lint": "echo 'Starting lint...' && yarn workspaces foreach run lint", "lint:fix": "yarn workspaces foreach run lint --fix", "format": "yarn workspaces foreach run format", "dev": "yarn workspace @corona-dashboard/app dev", "download": "yarn workspace @corona-dashboard/app download", "start": "yarn workspace @corona-dashboard/app start", + "check-all": "yarn lint && yarn typecheck && yarn validate-json-all && yarn test", "validate-json-all": "yarn workspace @corona-dashboard/cli validate-json-all", "validate-json-single": "yarn workspace @corona-dashboard/cli validate-json-single", "validate-last-values": "yarn workspace @corona-dashboard/cli validate-last-values", - "validate-features": "yarn workspace @corona-dashboard/cli validate-features", - "generate-typescript": "yarn workspace @corona-dashboard/cli generate-typescript", + "generate-data-types": "yarn workspace @corona-dashboard/cli generate-data-types", "e2e": "yarn workspace @corona-dashboard/e2e e2e", "e2e:ci": "yarn workspace @corona-dashboard/e2e e2e:ci", - "cms": "yarn workspace @corona-dashboard/cms dev" + "cms": "yarn workspace @corona-dashboard/cms dev", + "cms:lokalize-import": "yarn workspace @corona-dashboard/cms lokalize:import", + "cms:lokalize-import:prd": "yarn workspace @corona-dashboard/cms lokalize:import --dataset=production", + "cms:apply-json-edits": "yarn workspace @corona-dashboard/cms lokalize:apply-json-edits", + "cms:generate-types": "yarn workspace @corona-dashboard/cms lokalize:generate-types", + "cms:sync-after-release": "yarn workspace @corona-dashboard/cms lokalize:sync-after-release", + "cms:deploy": "yarn workspace @corona-dashboard/cms deploy", + "build:app": "yarn workspace @corona-dashboard/app build", + "build:common": "yarn workspace @corona-dashboard/common build", + "build:icons": "yarn workspace @corona-dashboard/icons build" }, "workspaces": { "packages": [ diff --git a/packages/app/README.md b/packages/app/README.md index db50f9d5c2..40a101fedb 100644 --- a/packages/app/README.md +++ b/packages/app/README.md @@ -45,9 +45,9 @@ The "Lokalize" part of Sanity is exported and consumed by the app as JSON. You w need to run this script regularly as an outdated JSON file will result in compile or build-time errors. -`yarn workspace @corona-dashboard/cms lokalize:export` +`yarn cms:lokalize-import` -Alternatively you can run this from `packages/cms` as `yarn lokalize:export` +Alternatively you can run this from `packages/cms` as `yarn lokalize:import` To learn more about the rationale behind Lokalize and how it works [read the documentation](/packages/cms/README.md#lokalize-texts). diff --git a/packages/app/next.config.js b/packages/app/next.config.js index 66520985b7..7419a0810b 100644 --- a/packages/app/next.config.js +++ b/packages/app/next.config.js @@ -105,6 +105,11 @@ const nextConfig = { async redirects() { return [ + { + source: '/over-risiconiveaus', + destination: '/', + permanent: false, + }, { source: '/actueel', destination: '/', diff --git a/packages/app/schema/nl/__index.json b/packages/app/schema/nl/__index.json index dc66a98632..c3ec753eb6 100644 --- a/packages/app/schema/nl/__index.json +++ b/packages/app/schema/nl/__index.json @@ -4,6 +4,7 @@ "title": "nl", "required": [ "behavior", + "behavior_annotations", "booster_and_third_shot_administered", "booster_shot_administered", "repeating_shot_administered", @@ -177,6 +178,9 @@ "behavior_get_tested_support_per_age_group": { "$ref": "behavior_get_tested_support_per_age_group.json" }, + "behavior_annotations": { + "$ref": "behavior_annotations.json" + }, "deceased_rivm": { "$ref": "deceased_rivm.json" }, diff --git a/packages/app/schema/nl/behavior_annotations.json b/packages/app/schema/nl/behavior_annotations.json new file mode 100644 index 0000000000..0b0564efc2 --- /dev/null +++ b/packages/app/schema/nl/behavior_annotations.json @@ -0,0 +1,76 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "nl_behavior_annotations", + "type": "object", + "properties": { + "values": { + "type": "array", + "items": { + "$ref": "#/definitions/value" + } + } + }, + "required": ["values"], + "additionalProperties": false, + "definitions": { + "value": { + "title": "nl_behavior_annotations", + "type": "object", + "properties": { + "behavior_indicator": { + "enum": [ + "wash_hands", + "curfew", + "keep_distance", + "work_from_home", + "avoid_crowds", + "symptoms_stay_home_if_mandatory", + "symptoms_get_tested", + "wear_mask_public_indoors", + "wear_mask_public_transport", + "sneeze_cough_elbow", + "max_visitors", + "ventilate_home", + "selftest_visit" + ] + }, + "message_title_nl": { + "minLength": 1, + "type": "string" + }, + "message_title_en": { + "minLength": 1, + "type": "string" + }, + "message_desc_nl": { + "minLength": 1, + "type": "string" + }, + "message_desc_en": { + "minLength": 1, + "type": "string" + }, + "date_start_unix": { + "type": "integer" + }, + "date_end_unix": { + "type": "integer" + }, + "date_of_insertion_unix": { + "type": "integer" + } + }, + "required": [ + "behavior_indicator", + "message_title_nl", + "message_title_en", + "message_desc_nl", + "message_desc_en", + "date_start_unix", + "date_end_unix", + "date_of_insertion_unix" + ], + "additionalProperties": false + } + } +} diff --git a/packages/app/schema/nl/vaccine_administered.json b/packages/app/schema/nl/vaccine_administered.json index eb4e0794e7..e4b75cbd64 100644 --- a/packages/app/schema/nl/vaccine_administered.json +++ b/packages/app/schema/nl/vaccine_administered.json @@ -7,6 +7,7 @@ "pfizer", "moderna", "astra_zeneca", + "novavax", "total", "date_of_insertion_unix", "date_start_unix", @@ -32,6 +33,9 @@ "sanofi": { "type": "integer" }, + "novavax": { + "type": "integer" + }, "total": { "type": "integer" }, diff --git a/packages/app/src/components/article-detail.tsx b/packages/app/src/components/article-detail.tsx index 89f64a9156..92890c8885 100644 --- a/packages/app/src/components/article-detail.tsx +++ b/packages/app/src/components/article-detail.tsx @@ -6,6 +6,7 @@ import { ContentBlock } from '~/components/cms/content-block'; import { Heading, InlineText } from '~/components/typography'; import { ArticleCategoryType } from '~/domain/topical/common/categories'; import { useIntl } from '~/intl'; +import { SiteText } from '~/locale'; import { Article } from '~/types/cms'; import { Link } from '~/utils/link'; import { mergeAdjacentKpiBlocks } from '~/utils/merge-adjacent-kpi-blocks'; @@ -15,6 +16,7 @@ import { LinkWithIcon } from './link-with-icon'; import { PublicationDate } from './publication-date'; interface ArticleDetailProps { article: Article; + text: SiteText['pages']['topicalPage']['shared']; } const imageSizes = [ @@ -22,8 +24,8 @@ const imageSizes = [ [700, 636], ]; -export function ArticleDetail({ article }: ArticleDetailProps) { - const { siteText } = useIntl(); +export function ArticleDetail({ article, text }: ArticleDetailProps) { + const { commonTexts } = useIntl(); article.intro = mergeAdjacentKpiBlocks(article.intro); article.content = mergeAdjacentKpiBlocks(article.content); @@ -32,7 +34,7 @@ export function ArticleDetail({ article }: ArticleDetailProps) { }> - {siteText.article_detail.back_link.text} + {commonTexts.article_detail.back_link.text} @@ -72,7 +74,7 @@ export function ArticleDetail({ article }: ArticleDetailProps) { - {siteText.pages.topicalPage.shared.secties.artikelen.tags} + {text.secties.artikelen.tags} { - siteText.pages.topicalPage.shared.secties.artikelen - .categorie_filters[item as ArticleCategoryType] + text.secties.artikelen.categorie_filters[ + item as ArticleCategoryType + ] } diff --git a/packages/app/src/components/article-teaser.tsx b/packages/app/src/components/article-teaser.tsx index 34ce62c3c4..132d1ac9d1 100644 --- a/packages/app/src/components/article-teaser.tsx +++ b/packages/app/src/components/article-teaser.tsx @@ -25,7 +25,7 @@ type ArticleTeaserProps = { export function ArticleTeaser(props: ArticleTeaserProps) { const { title, slug, summary, cover, coverSizes } = props; - const { siteText } = useIntl(); + const { commonTexts } = useIntl(); return ( @@ -42,7 +42,7 @@ export function ArticleTeaser(props: ArticleTeaserProps) { {summary} diff --git a/packages/app/src/components/breadcrumbs/breadcrumbs.tsx b/packages/app/src/components/breadcrumbs/breadcrumbs.tsx index bc4fafd50f..20170f3be7 100644 --- a/packages/app/src/components/breadcrumbs/breadcrumbs.tsx +++ b/packages/app/src/components/breadcrumbs/breadcrumbs.tsx @@ -10,7 +10,7 @@ import { useBreadcrumbs } from './logic/use-breadcrumbs'; export function Breadcrumbs() { const breadcrumbs = useBreadcrumbs(); - const { siteText } = useIntl(); + const { commonTexts } = useIntl(); const { pathname } = useRouter(); return ( @@ -31,7 +31,7 @@ export function Breadcrumbs() { px: 4, })} as={'nav'} - aria-label={siteText.breadcrumbs.label} + aria-label={commonTexts.breadcrumbs.label} >
    {breadcrumbs.map(({ title, href, redirectLabel }, index) => ( diff --git a/packages/app/src/components/breadcrumbs/logic/use-breadcrumbs.tsx b/packages/app/src/components/breadcrumbs/logic/use-breadcrumbs.tsx index 858107d080..cc5628faaf 100644 --- a/packages/app/src/components/breadcrumbs/logic/use-breadcrumbs.tsx +++ b/packages/app/src/components/breadcrumbs/logic/use-breadcrumbs.tsx @@ -55,7 +55,7 @@ export const BreadcrumbsDataProvider = ({ export function useBreadcrumbs(): Breadcrumb[] { const { pathname, query } = useRouter(); - const { siteText } = useIntl(); + const { commonTexts } = useIntl(); const ctx = useContext(BreadcrumbsDataContext); return useMemo(() => { @@ -73,7 +73,7 @@ export function useBreadcrumbs(): Breadcrumb[] { }; const getTitle = (str: string): string => { - if (str === '') return siteText.breadcrumbs.paths.actueel; + if (str === '') return commonTexts.breadcrumbs.paths.actueel; const { key } = getQueryParameter(str); str = convertQueryParameter(str); @@ -84,8 +84,8 @@ export function useBreadcrumbs(): Breadcrumb[] { return pageTitle ? pageTitle : str; } - return siteText.breadcrumbs.paths[ - str as keyof typeof siteText.breadcrumbs.paths + return commonTexts.breadcrumbs.paths[ + str as keyof typeof commonTexts.breadcrumbs.paths ]; }; @@ -96,10 +96,10 @@ export function useBreadcrumbs(): Breadcrumb[] { case 'landelijk': case 'actueel': { return replaceVariablesInText( - siteText.breadcrumbs.redirects.template, + commonTexts.breadcrumbs.redirects.template, { - page: siteText.breadcrumbs.redirects[ - str as keyof typeof siteText.breadcrumbs.redirects + page: commonTexts.breadcrumbs.redirects[ + str as keyof typeof commonTexts.breadcrumbs.redirects ], } ); @@ -116,7 +116,7 @@ export function useBreadcrumbs(): Breadcrumb[] { // this is the more complex case where we have a str with a gm/vr code if (str.includes('GM') || str.includes('VR')) { const pageTemplate = replaceVariablesInText( - siteText.breadcrumbs.redirects[ + commonTexts.breadcrumbs.redirects[ str.includes('GM') ? 'gemeente' : 'veiligheidsregio' ], { @@ -125,7 +125,7 @@ export function useBreadcrumbs(): Breadcrumb[] { ); return replaceVariablesInText( - siteText.breadcrumbs.redirects.template, + commonTexts.breadcrumbs.redirects.template, { page: pageTemplate, } @@ -160,5 +160,5 @@ export function useBreadcrumbs(): Breadcrumb[] { }); return breadcrumbs; - }, [ctx, pathname, query, siteText]); + }, [ctx, pathname, query, commonTexts]); } diff --git a/packages/app/src/components/chart-region-controls.tsx b/packages/app/src/components/chart-region-controls.tsx index 122a417f29..c05d728ce0 100644 --- a/packages/app/src/components/chart-region-controls.tsx +++ b/packages/app/src/components/chart-region-controls.tsx @@ -10,24 +10,30 @@ interface ChartRegionControlsProps { } export function ChartRegionControls(props: ChartRegionControlsProps) { - const { siteText } = useIntl(); + const { commonTexts } = useIntl(); const { value, onChange } = props; const items: RadioGroupItem[] = [ { - label: siteText.charts.region_controls.municipal, + label: commonTexts.charts.region_controls.municipal, value: 'gm', - ariaLabel: replaceVariablesInText(siteText.aria_labels.map_toggle_label, { - label: siteText.charts.region_controls.municipal - }), + ariaLabel: replaceVariablesInText( + commonTexts.aria_labels.map_toggle_label, + { + label: commonTexts.charts.region_controls.municipal, + } + ), }, { - label: siteText.charts.region_controls.region, + label: commonTexts.charts.region_controls.region, value: 'vr', - ariaLabel: replaceVariablesInText(siteText.aria_labels.map_toggle_label, { - label: siteText.charts.region_controls.region - }), + ariaLabel: replaceVariablesInText( + commonTexts.aria_labels.map_toggle_label, + { + label: commonTexts.charts.region_controls.region, + } + ), }, ]; diff --git a/packages/app/src/components/chart-time-controls.tsx b/packages/app/src/components/chart-time-controls.tsx index 71a2d7d1fd..75d666480c 100644 --- a/packages/app/src/components/chart-time-controls.tsx +++ b/packages/app/src/components/chart-time-controls.tsx @@ -1,5 +1,8 @@ import { useMemo } from 'react'; -import { TimeframeOption } from '@corona-dashboard/common'; +import { + TimeframeOption, + TimeframeOptionsList, +} from '@corona-dashboard/common'; import { Box } from '~/components/base'; import { Text } from '~/components/typography'; import { RichContentSelect } from '~/components/rich-content-select'; @@ -15,33 +18,27 @@ export function ChartTimeControls(props: ChartTimeControlsProps) { const { onChange, timeframe, - timeframeOptions = [ - TimeframeOption.ALL, - TimeframeOption.TWO_WEEKS, - TimeframeOption.THIRTY_DAYS, - TimeframeOption.THREE_MONTHS, - TimeframeOption.LAST_YEAR, - ], + timeframeOptions = TimeframeOptionsList, } = props; - const { siteText } = useIntl(); + const { commonTexts } = useIntl(); const selectOptions = useMemo( () => timeframeOptions.map((key) => ({ - label: siteText.charts.time_controls[key], + label: commonTexts.charts.time_controls[key], value: key, content: ( - {siteText.charts.time_controls[key]} + {commonTexts.charts.time_controls[key]} ), })), - [siteText.charts.time_controls, timeframeOptions] + [commonTexts.charts.time_controls, timeframeOptions] ); return ( ; dataOptions: DataOptions; featureOutHandler: ChoroplethTooltipHandlers[1]; featureOverHandler: ChoroplethTooltipHandlers[0]; @@ -62,6 +64,7 @@ export const CanvasChoroplethMap = (props: CanvasChoroplethMapProps) => { anchorEventHandlers, annotations, choroplethFeatures, + containerRef, dataOptions, featureOutHandler, featureOverHandler, @@ -165,6 +168,7 @@ export const CanvasChoroplethMap = (props: CanvasChoroplethMapProps) => { handleMouseOver={handleMouseOver} />
    ( anchorEventHandlers={anchorEventHandlers} isTabInteractive={isTabInteractive} getFeatureName={getFeatureName} + containerRef={containerRef} /> )} diff --git a/packages/app/src/components/choropleth/index.tsx b/packages/app/src/components/choropleth/index.tsx index ec7c226d66..5fa6391736 100644 --- a/packages/app/src/components/choropleth/index.tsx +++ b/packages/app/src/components/choropleth/index.tsx @@ -219,7 +219,7 @@ export function Choropleth({ ...props }: ChoroplethProps) { const [tooltip, setTooltip] = useState>(); - const { siteText } = useIntl(); + const { commonTexts } = useIntl(); const tooltipRef = useRef(null); /** Close the tooltip when a click outside of the component occurs */ @@ -227,8 +227,8 @@ export function Choropleth({ const { isTabInteractive, tabInteractiveButton, anchorEventHandlers } = useTabInteractiveButton( - replaceVariablesInText(siteText.choropleth.a11y.tab_navigatie_button, { - subject: siteText.choropleth[props.map].plural, + replaceVariablesInText(commonTexts.choropleth.a11y.tab_navigatie_button, { + subject: commonTexts.choropleth[props.map].plural, }) ); diff --git a/packages/app/src/components/choropleth/tooltips/choropleth-tooltip.tsx b/packages/app/src/components/choropleth/tooltips/choropleth-tooltip.tsx index 18345a6d9a..02894f87b4 100644 --- a/packages/app/src/components/choropleth/tooltips/choropleth-tooltip.tsx +++ b/packages/app/src/components/choropleth/tooltips/choropleth-tooltip.tsx @@ -18,7 +18,7 @@ export function ChoroplethTooltip( ) { const { data, dataFormatters } = props; const { - siteText, + commonTexts, formatNumber, formatPercentage, formatDate, @@ -28,7 +28,7 @@ export function ChoroplethTooltip( formatDateSpan, } = useIntl(); - const text = siteText.choropleth_tooltip; + const text = commonTexts.choropleth_tooltip; const subject = ( text as unknown as Record>> diff --git a/packages/app/src/components/cms/inline-age-demographic.tsx b/packages/app/src/components/cms/inline-age-demographic.tsx index a220d341fb..391dd2ea39 100644 --- a/packages/app/src/components/cms/inline-age-demographic.tsx +++ b/packages/app/src/components/cms/inline-age-demographic.tsx @@ -27,7 +27,7 @@ interface InlineAgeDemographicProps { export function InlineAgeDemographic(props: InlineAgeDemographicProps) { const { configuration, startDate, endDate } = props; - const { siteText } = useIntl(); + const { commonTexts } = useIntl(); const dateUrl = getDataUrl(startDate, endDate, configuration); @@ -39,8 +39,8 @@ export function InlineAgeDemographic(props: InlineAgeDemographicProps) { return ; } - const source = get(siteText, configuration.sourceKey.split('.'), ''); - const text = get(siteText, configuration.text.split('.'), ''); + const source = get(commonTexts, configuration.sourceKey.split('.'), ''); + const text = get(commonTexts, configuration.text.split('.'), ''); return ( diff --git a/packages/app/src/components/cms/inline-choropleth.tsx b/packages/app/src/components/cms/inline-choropleth.tsx index 31104badd0..eff75be27f 100644 --- a/packages/app/src/components/cms/inline-choropleth.tsx +++ b/packages/app/src/components/cms/inline-choropleth.tsx @@ -30,7 +30,7 @@ interface InlineChoroplethProps { export function InlineChoropleth(props: InlineChoroplethProps) { const { configuration } = props; - const { siteText } = useIntl(); + const { commonTexts } = useIntl(); const dateUrl = getDataUrl(undefined, undefined, configuration, 'choropleth'); @@ -50,7 +50,7 @@ export function InlineChoropleth(props: InlineChoroplethProps) { : undefined, tooltipVariables: parseTooltipVariables( configuration.tooltipVariables, - siteText + commonTexts ), highlightSelection: configuration.highlightSelection, isPercentage: configuration.isPercentage, @@ -70,7 +70,7 @@ export function InlineChoropleth(props: InlineChoroplethProps) { noDataFillColor: getColor(configuration.noDataFillColor), }; - const source = get(siteText, configuration.sourceKey.split('.'), ''); + const source = get(commonTexts, configuration.sourceKey.split('.'), ''); return ( @@ -90,7 +90,7 @@ export function InlineChoropleth(props: InlineChoroplethProps) { function parseTooltipVariables( tooltipVarsJson: string | undefined, - siteText: SiteText + commonTexts: SiteText['common'] ) { if (!tooltipVarsJson?.length) { return undefined; @@ -99,10 +99,10 @@ function parseTooltipVariables( const varsObject = JSON.parse(tooltipVarsJson); return Object.fromEntries( Object.entries(varsObject).map(([name, value]) => { - if (isString(value) && value.startsWith('siteText')) { + if (isString(value) && value.startsWith('commonTexts')) { return [ name, - get(siteText, value.replace('siteText.', ''), undefined), + get(commonTexts, value.replace('commonTexts.', ''), undefined), ]; } return [name, value]; diff --git a/packages/app/src/components/cms/inline-donut-chart.tsx b/packages/app/src/components/cms/inline-donut-chart.tsx index a91f408164..9f4a44af63 100644 --- a/packages/app/src/components/cms/inline-donut-chart.tsx +++ b/packages/app/src/components/cms/inline-donut-chart.tsx @@ -29,7 +29,7 @@ export function InlineDonutChart< M extends MetricKeys >(props: InlineDonutChartProps) { const { startDate, endDate, configuration } = props; - const { siteText } = useIntl(); + const { commonTexts } = useIntl(); const dateUrl = getDataUrl(startDate, endDate, configuration, 'donut'); @@ -45,13 +45,13 @@ export function InlineDonutChart< (x) => ({ metricProperty: x.propertyName as any, color: getColor(x.color), - label: get(siteText, x.labelKey.split('.'), null), - tooltipLabel: get(siteText, x.tooltipLabelKey.split('.'), null), + label: get(commonTexts, x.labelKey.split('.'), null), + tooltipLabel: get(commonTexts, x.tooltipLabelKey.split('.'), null), }) ); - const title = get(siteText, configuration.labelKey.split('.'), ''); - const source = get(siteText, configuration.sourceKey.split('.'), ''); + const title = get(commonTexts, configuration.labelKey.split('.'), ''); + const source = get(commonTexts, configuration.sourceKey.split('.'), ''); return ( diff --git a/packages/app/src/components/cms/inline-kpi.tsx b/packages/app/src/components/cms/inline-kpi.tsx index 423a00fda8..ab54357a32 100644 --- a/packages/app/src/components/cms/inline-kpi.tsx +++ b/packages/app/src/components/cms/inline-kpi.tsx @@ -38,7 +38,7 @@ function getDataUrl(configuration: KpiConfiguration, date?: string) { } export function InlineKpi({ configuration, date }: InlineKpiProps) { - const { siteText, formatDateFromSeconds } = useIntl(); + const { commonTexts, formatDateFromSeconds } = useIntl(); const { data } = useSWRImmutable( getDataUrl(configuration, date), @@ -66,8 +66,8 @@ export function InlineKpi({ configuration, date }: InlineKpiProps) { }, }; - const title = get(siteText, configuration.titleKey.split('.'), ''); - const source = get(siteText, configuration.sourceKey.split('.'), ''); + const title = get(commonTexts, configuration.titleKey.split('.'), ''); + const source = get(commonTexts, configuration.sourceKey.split('.'), ''); const lastValue = getLastValue(data, configuration.metricName); diff --git a/packages/app/src/components/cms/inline-time-series-charts.tsx b/packages/app/src/components/cms/inline-time-series-charts.tsx index a32c27e017..fe41f76931 100644 --- a/packages/app/src/components/cms/inline-time-series-charts.tsx +++ b/packages/app/src/components/cms/inline-time-series-charts.tsx @@ -40,7 +40,7 @@ export function InlineTimeSeriesCharts< M extends MetricKeys >(props: InlineTimeSeriesChartsProps) { const { configuration, startDate, endDate } = props; - const { siteText } = useIntl(); + const { commonTexts } = useIntl(); const dateUrl = getDataUrl(startDate, endDate, configuration); @@ -59,7 +59,7 @@ export function InlineTimeSeriesCharts< const config: any = { type: x.type, metricProperty: x.propertyName, - label: get(siteText, x.labelKey.split('.'), null), + label: get(commonTexts, x.labelKey.split('.'), null), color: getColor(x.color), minimumRange: seriesMetricConfig?.minimumRange, }; @@ -70,7 +70,11 @@ export function InlineTimeSeriesCharts< config.fillOpacity = x.fillOpacity; } if (isDefined(x.shortLabelKey) && x.shortLabelKey.length) { - config.shortLabelKey = get(siteText, x.shortLabelKey.split('.'), null); + config.shortLabelKey = get( + commonTexts, + x.shortLabelKey.split('.'), + null + ); } if (isDefined(x.strokeWidth)) { config.strokeWidth = x.strokeWidth; @@ -84,7 +88,7 @@ export function InlineTimeSeriesCharts< scopedMetricConfigs, configuration.metricName, configuration.metricProperties, - siteText, + commonTexts, ]); const dataOptions = useMemo(() => { @@ -99,10 +103,10 @@ export function InlineTimeSeriesCharts< start: calculateStart(x.start, data.values), end: calculateEnd(x.end, x.start, data.values), label: isDefined(x.labelKey) - ? get(siteText, x.labelKey.split('.'), null) + ? get(commonTexts, x.labelKey.split('.'), null) : undefined, shortLabel: isDefined(x.shortLabelKey) - ? get(siteText, x.shortLabelKey.split('.'), null) + ? get(commonTexts, x.shortLabelKey.split('.'), null) : undefined, }) ); @@ -112,17 +116,21 @@ export function InlineTimeSeriesCharts< isPercentage: configuration.isPercentage, renderNullAsZero: configuration.renderNullAsZero, valueAnnotation: configuration.valueAnnotationKey?.length - ? get(siteText, configuration.valueAnnotationKey.split('.'), undefined) + ? get( + commonTexts, + configuration.valueAnnotationKey.split('.'), + undefined + ) : undefined, timespanAnnotations, } as DataOptions; - }, [configuration, siteText, data]); + }, [configuration, commonTexts, data]); if (!isDefined(data)) { return ; } - const source = get(siteText, configuration.sourceKey.split('.'), ''); + const source = get(commonTexts, configuration.sourceKey.split('.'), ''); return ( diff --git a/packages/app/src/components/combo-box/combo-box.tsx b/packages/app/src/components/combo-box/combo-box.tsx index fdea10f363..077d5cb911 100644 --- a/packages/app/src/components/combo-box/combo-box.tsx +++ b/packages/app/src/components/combo-box/combo-box.tsx @@ -46,7 +46,7 @@ type TProps