From f90d8a87a119bdc71a23dbd2cb43a068ed54dbc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Prod=27homme?= Date: Thu, 10 Oct 2024 12:27:01 +0200 Subject: [PATCH] Update the name of some fields --- cms/config/sync/admin-role.strapi-author.json | 357 ++++++++++++++---- cms/config/sync/admin-role.strapi-editor.json | 24 +- .../sync/admin-role.strapi-super-admin.json | 26 +- ...types##api##habitat-stat.habitat-stat.json | 26 +- ...overage-stat.protection-coverage-stat.json | 28 +- .../content-types/habitat-stat/schema.json | 4 +- .../protection-coverage-stat/schema.json | 4 +- cms/types/generated/contentTypes.d.ts | 8 +- .../details/tables/global-regional/hooks.tsx | 12 +- .../map/content/map/popup/eez/index.tsx | 4 +- .../map/content/map/popup/regions/index.tsx | 4 +- .../panels/details/widgets/habitat/index.tsx | 6 +- .../widgets/marine-conservation/index.tsx | 4 +- .../terrestrial-conservation/index.tsx | 4 +- .../panels/modelling/widget/index.tsx | 8 +- .../src/types/generated/strapi.schemas.ts | 32 +- 16 files changed, 392 insertions(+), 159 deletions(-) diff --git a/cms/config/sync/admin-role.strapi-author.json b/cms/config/sync/admin-role.strapi-author.json index 1f6d4610..4915b2f7 100644 --- a/cms/config/sync/admin-role.strapi-author.json +++ b/cms/config/sync/admin-role.strapi-author.json @@ -81,7 +81,11 @@ "content", "data_sources" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -112,7 +116,11 @@ "content", "data_sources" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -128,7 +136,11 @@ "content", "data_sources" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -144,7 +156,11 @@ "title", "url" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -175,7 +191,11 @@ "title", "url" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -191,7 +211,11 @@ "title", "url" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -205,7 +229,11 @@ "fields": [ "name" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -234,7 +262,11 @@ "fields": [ "name" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -248,7 +280,11 @@ "fields": [ "name" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -264,7 +300,11 @@ "slug", "data_tool" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -295,7 +335,11 @@ "slug", "data_tool" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -311,7 +355,11 @@ "slug", "data_tool" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -325,7 +373,11 @@ "fields": [ "name" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -354,7 +406,11 @@ "fields": [ "name" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -368,7 +424,11 @@ "fields": [ "name" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -388,7 +448,11 @@ "geography", "data_tool_ecosystems" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -423,7 +487,11 @@ "geography", "data_tool_ecosystems" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -443,7 +511,11 @@ "geography", "data_tool_ecosystems" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -459,7 +531,11 @@ "layers", "slug" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -490,7 +566,11 @@ "layers", "slug" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -506,7 +586,11 @@ "layers", "slug" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -592,7 +676,8 @@ "fields": [ "location", "fishing_protection_level", - "area" + "area", + "pct" ] }, "conditions": [ @@ -616,7 +701,8 @@ "fields": [ "location", "fishing_protection_level", - "area" + "area", + "pct" ] }, "conditions": [ @@ -631,7 +717,8 @@ "fields": [ "location", "fishing_protection_level", - "area" + "area", + "pct" ] }, "conditions": [ @@ -648,7 +735,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -679,7 +770,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -695,7 +790,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -710,8 +809,9 @@ "location", "habitat", "year", - "protectedArea", - "totalArea" + "protected_area", + "total_area", + "environment" ] }, "conditions": [ @@ -736,8 +836,9 @@ "location", "habitat", "year", - "protectedArea", - "totalArea" + "protected_area", + "total_area", + "environment" ] }, "conditions": [ @@ -753,8 +854,9 @@ "location", "habitat", "year", - "protectedArea", - "totalArea" + "protected_area", + "total_area", + "environment" ] }, "conditions": [ @@ -771,7 +873,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -802,7 +908,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -818,7 +928,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -841,9 +955,20 @@ "metadata.resolution", "metadata.content_date", "metadata.license", - "dataset" + "dataset", + "legend_config.type", + "legend_config.items.icon", + "legend_config.items.color", + "legend_config.items.value", + "legend_config.items.description", + "default", + "environment" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -881,9 +1006,20 @@ "metadata.resolution", "metadata.content_date", "metadata.license", - "dataset" + "dataset", + "legend_config.type", + "legend_config.items.icon", + "legend_config.items.color", + "legend_config.items.value", + "legend_config.items.description", + "default", + "environment" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -906,9 +1042,20 @@ "metadata.resolution", "metadata.content_date", "metadata.license", - "dataset" + "dataset", + "legend_config.type", + "legend_config.items.icon", + "legend_config.items.color", + "legend_config.items.value", + "legend_config.items.description", + "default", + "environment" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -927,10 +1074,15 @@ "groups", "members", "fishing_protection_level_stats", + "mpaa_protection_level_stats", "protection_coverage_stats", + "marine_bounds", "total_terrestrial_area", + "terrestrial_bounds", "name_es", - "name_fr" + "name_fr", + "marine_target", + "marine_target_year" ] }, "conditions": [ @@ -959,10 +1111,15 @@ "groups", "members", "fishing_protection_level_stats", + "mpaa_protection_level_stats", "protection_coverage_stats", + "marine_bounds", "total_terrestrial_area", + "terrestrial_bounds", "name_es", - "name_fr" + "name_fr", + "marine_target", + "marine_target_year" ] }, "conditions": [ @@ -982,10 +1139,15 @@ "groups", "members", "fishing_protection_level_stats", + "mpaa_protection_level_stats", "protection_coverage_stats", + "marine_bounds", "total_terrestrial_area", + "terrestrial_bounds", "name_es", - "name_fr" + "name_fr", + "marine_target", + "marine_target_year" ] }, "conditions": [ @@ -1077,7 +1239,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -1108,7 +1274,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -1124,7 +1294,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -1138,6 +1312,7 @@ "fields": [ "mpaa_protection_level", "area", + "percentage", "location" ] }, @@ -1162,6 +1337,7 @@ "fields": [ "mpaa_protection_level", "area", + "percentage", "location" ] }, @@ -1177,6 +1353,7 @@ "fields": [ "mpaa_protection_level", "area", + "percentage", "location" ] }, @@ -1194,7 +1371,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -1225,7 +1406,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -1241,7 +1426,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -1348,8 +1537,14 @@ "fields": [ "location", "year", - "protectedArea", - "protectedAreasCount" + "protected_area", + "protected_areas_count", + "environment", + "coverage", + "pas", + "oecms", + "is_last_year", + "global_contribution" ] }, "conditions": [ @@ -1373,8 +1568,14 @@ "fields": [ "location", "year", - "protectedArea", - "protectedAreasCount" + "protected_area", + "protected_areas_count", + "environment", + "coverage", + "pas", + "oecms", + "is_last_year", + "global_contribution" ] }, "conditions": [ @@ -1389,8 +1590,14 @@ "fields": [ "location", "year", - "protectedArea", - "protectedAreasCount" + "protected_area", + "protected_areas_count", + "environment", + "coverage", + "pas", + "oecms", + "is_last_year", + "global_contribution" ] }, "conditions": [ @@ -1407,7 +1614,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -1438,7 +1649,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -1454,7 +1669,11 @@ "name", "info" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -1471,7 +1690,11 @@ "value", "description" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -1503,7 +1726,11 @@ "value", "description" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" @@ -1520,7 +1747,11 @@ "value", "description" ], - "locales": [] + "locales": [ + "en", + "es", + "fr" + ] }, "conditions": [ "admin::is-creator" diff --git a/cms/config/sync/admin-role.strapi-editor.json b/cms/config/sync/admin-role.strapi-editor.json index e3359efd..8a69f229 100644 --- a/cms/config/sync/admin-role.strapi-editor.json +++ b/cms/config/sync/admin-role.strapi-editor.json @@ -799,8 +799,8 @@ "location", "habitat", "year", - "protectedArea", - "totalArea", + "protected_area", + "total_area", "environment" ] }, @@ -822,8 +822,8 @@ "location", "habitat", "year", - "protectedArea", - "totalArea", + "protected_area", + "total_area", "environment" ] }, @@ -838,8 +838,8 @@ "location", "habitat", "year", - "protectedArea", - "totalArea", + "protected_area", + "total_area", "environment" ] }, @@ -1468,8 +1468,8 @@ "fields": [ "location", "year", - "protectedArea", - "protectedAreasCount", + "protected_area", + "protected_areas_count", "environment", "coverage", "pas", @@ -1495,8 +1495,8 @@ "fields": [ "location", "year", - "protectedArea", - "protectedAreasCount", + "protected_area", + "protected_areas_count", "environment", "coverage", "pas", @@ -1515,8 +1515,8 @@ "fields": [ "location", "year", - "protectedArea", - "protectedAreasCount", + "protected_area", + "protected_areas_count", "environment", "coverage", "pas", diff --git a/cms/config/sync/admin-role.strapi-super-admin.json b/cms/config/sync/admin-role.strapi-super-admin.json index 92284f0f..5d9f481e 100644 --- a/cms/config/sync/admin-role.strapi-super-admin.json +++ b/cms/config/sync/admin-role.strapi-super-admin.json @@ -811,8 +811,8 @@ "location", "habitat", "year", - "protectedArea", - "totalArea", + "protected_area", + "total_area", "environment" ] }, @@ -834,8 +834,8 @@ "location", "habitat", "year", - "protectedArea", - "totalArea", + "protected_area", + "total_area", "environment" ] }, @@ -850,8 +850,8 @@ "location", "habitat", "year", - "protectedArea", - "totalArea", + "protected_area", + "total_area", "environment" ] }, @@ -1480,8 +1480,8 @@ "fields": [ "location", "year", - "protectedArea", - "protectedAreasCount", + "protected_area", + "protected_areas_count", "environment", "coverage", "pas", @@ -1507,8 +1507,8 @@ "fields": [ "location", "year", - "protectedArea", - "protectedAreasCount", + "protected_area", + "protected_areas_count", "environment", "coverage", "pas", @@ -1527,8 +1527,8 @@ "fields": [ "location", "year", - "protectedArea", - "protectedAreasCount", + "protected_area", + "protected_areas_count", "environment", "coverage", "pas", @@ -2182,4 +2182,4 @@ "actionParameters": {} } ] -} +} \ No newline at end of file diff --git a/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##habitat-stat.habitat-stat.json b/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##habitat-stat.habitat-stat.json index 2e1623ec..0db93617 100644 --- a/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##habitat-stat.habitat-stat.json +++ b/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##habitat-stat.habitat-stat.json @@ -64,30 +64,30 @@ "sortable": true } }, - "protectedArea": { + "protected_area": { "edit": { - "label": "protectedArea", + "label": "protected_area", "description": "", "placeholder": "", "visible": true, "editable": true }, "list": { - "label": "protectedArea", + "label": "protected_area", "searchable": true, "sortable": true } }, - "totalArea": { + "total_area": { "edit": { - "label": "totalArea", + "label": "total_area", "description": "", "placeholder": "", "visible": true, "editable": true }, "list": { - "label": "totalArea", + "label": "total_area", "searchable": true, "sortable": true } @@ -188,20 +188,22 @@ { "name": "year", "size": 4 - }, + } + ], + [ { - "name": "protectedArea", - "size": 4 + "name": "environment", + "size": 6 }, { - "name": "totalArea", + "name": "protected_area", "size": 4 } ], [ { - "name": "environment", - "size": 6 + "name": "total_area", + "size": 4 } ] ] diff --git a/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##protection-coverage-stat.protection-coverage-stat.json b/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##protection-coverage-stat.protection-coverage-stat.json index 04982bbf..6178edcd 100644 --- a/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##protection-coverage-stat.protection-coverage-stat.json +++ b/cms/config/sync/core-store.plugin_content_manager_configuration_content_types##api##protection-coverage-stat.protection-coverage-stat.json @@ -49,30 +49,30 @@ "sortable": true } }, - "protectedArea": { + "protected_area": { "edit": { - "label": "protectedArea", + "label": "protected_area", "description": "", "placeholder": "", "visible": true, "editable": true }, "list": { - "label": "protectedArea", + "label": "protected_area", "searchable": true, "sortable": true } }, - "protectedAreasCount": { + "protected_areas_count": { "edit": { - "label": "protectedAreasCount", + "label": "protected_areas_count", "description": "", "placeholder": "", "visible": true, "editable": true }, "list": { - "label": "protectedAreasCount", + "label": "protected_areas_count", "searchable": true, "sortable": true } @@ -246,14 +246,6 @@ } ], [ - { - "name": "protectedArea", - "size": 4 - }, - { - "name": "protectedAreasCount", - "size": 4 - }, { "name": "coverage", "size": 4 @@ -277,6 +269,14 @@ { "name": "global_contribution", "size": 4 + }, + { + "name": "protected_area", + "size": 4 + }, + { + "name": "protected_areas_count", + "size": 4 } ] ] diff --git a/cms/src/api/habitat-stat/content-types/habitat-stat/schema.json b/cms/src/api/habitat-stat/content-types/habitat-stat/schema.json index 2273fbbb..3b4c81d4 100644 --- a/cms/src/api/habitat-stat/content-types/habitat-stat/schema.json +++ b/cms/src/api/habitat-stat/content-types/habitat-stat/schema.json @@ -26,7 +26,7 @@ "type": "integer", "required": true }, - "protectedArea": { + "protected_area": { "type": "decimal", "required": true, "min": 0, @@ -39,7 +39,7 @@ ] } }, - "totalArea": { + "total_area": { "type": "decimal", "required": true, "min": 0, diff --git a/cms/src/api/protection-coverage-stat/content-types/protection-coverage-stat/schema.json b/cms/src/api/protection-coverage-stat/content-types/protection-coverage-stat/schema.json index 58dac49d..ba96f92a 100644 --- a/cms/src/api/protection-coverage-stat/content-types/protection-coverage-stat/schema.json +++ b/cms/src/api/protection-coverage-stat/content-types/protection-coverage-stat/schema.json @@ -23,7 +23,7 @@ "required": true, "min": 0 }, - "protectedArea": { + "protected_area": { "type": "decimal", "min": 0, "column": { @@ -35,7 +35,7 @@ ] } }, - "protectedAreasCount": { + "protected_areas_count": { "type": "integer", "required": true }, diff --git a/cms/types/generated/contentTypes.d.ts b/cms/types/generated/contentTypes.d.ts index 92510c80..62edd575 100644 --- a/cms/types/generated/contentTypes.d.ts +++ b/cms/types/generated/contentTypes.d.ts @@ -1406,12 +1406,12 @@ export interface ApiHabitatStatHabitatStat extends Schema.CollectionType { 'api::habitat.habitat' >; year: Attribute.Integer & Attribute.Required; - protectedArea: Attribute.Decimal & + protected_area: Attribute.Decimal & Attribute.Required & Attribute.SetMinMax<{ min: 0; }>; - totalArea: Attribute.Decimal & + total_area: Attribute.Decimal & Attribute.Required & Attribute.SetMinMax<{ min: 0; @@ -1938,11 +1938,11 @@ export interface ApiProtectionCoverageStatProtectionCoverageStat Attribute.SetMinMax<{ min: 0; }>; - protectedArea: Attribute.Decimal & + protected_area: Attribute.Decimal & Attribute.SetMinMax<{ min: 0; }>; - protectedAreasCount: Attribute.Integer & Attribute.Required; + protected_areas_count: Attribute.Integer & Attribute.Required; environment: Attribute.Relation< 'api::protection-coverage-stat.protection-coverage-stat', 'oneToOne', diff --git a/frontend/src/containers/map/content/details/tables/global-regional/hooks.tsx b/frontend/src/containers/map/content/details/tables/global-regional/hooks.tsx index e8db2c8f..4a2f65cb 100644 --- a/frontend/src/containers/map/content/details/tables/global-regional/hooks.tsx +++ b/frontend/src/containers/map/content/details/tables/global-regional/hooks.tsx @@ -37,7 +37,7 @@ export type GlobalRegionalTableColumns = { slug: string; }; coverage: number; - protectedArea: number; + protected_area: number; pas: number; oecms: number; global_contribution: number; @@ -206,8 +206,8 @@ export const useColumns = ( }, }, { - id: 'protectedArea', - accessorKey: 'protectedArea', + id: 'protected_area', + accessorKey: 'protected_area', header: ({ column }) => ( @@ -216,7 +216,7 @@ export const useColumns = ( ), cell: ({ row }) => { - const { protectedArea: value } = row.original; + const { protected_area: value } = row.original; const formattedValue = cellFormatter.area(locale, value); return {t('area-km2', { area: formattedValue })}; }, @@ -349,7 +349,7 @@ export const useData = ( { // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - fields: ['coverage', 'protectedArea', 'pas', 'oecms', 'global_contribution'], + fields: ['coverage', 'protected_area', 'pas', 'oecms', 'global_contribution'], // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore populate: { @@ -454,7 +454,7 @@ export const useData = ( slug: localizedEnvironment.slug, }, coverage: attributes.coverage, - protectedArea: attributes.protectedArea, + protected_area: attributes.protected_area, pas: attributes.pas, oecms: attributes.oecms, global_contribution: attributes.global_contribution, diff --git a/frontend/src/containers/map/content/map/popup/eez/index.tsx b/frontend/src/containers/map/content/map/popup/eez/index.tsx index c244705a..9b17b0fe 100644 --- a/frontend/src/containers/map/content/map/popup/eez/index.tsx +++ b/frontend/src/containers/map/content/map/popup/eez/index.tsx @@ -114,7 +114,7 @@ const EEZLayerPopup: FCWithMessages<{ layerId: number }> = ({ layerId }) => { }, // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - fields: ['coverage', 'protectedArea'], + fields: ['coverage', 'protected_area'], 'pagination[limit]': 1, }, { @@ -209,7 +209,7 @@ const EEZLayerPopup: FCWithMessages<{ layerId: number }> = ({ layerId }) => {
{t('marine-protected-area', { - protectedArea: formatKM(locale, protectionCoverageStats.protectedArea), + protectedArea: formatKM(locale, protectionCoverageStats.protected_area), totalArea: formatKM( locale, Number(protectionCoverageStats.location.data.attributes.total_marine_area) diff --git a/frontend/src/containers/map/content/map/popup/regions/index.tsx b/frontend/src/containers/map/content/map/popup/regions/index.tsx index 0d591eab..825e4296 100644 --- a/frontend/src/containers/map/content/map/popup/regions/index.tsx +++ b/frontend/src/containers/map/content/map/popup/regions/index.tsx @@ -117,7 +117,7 @@ const RegionsPopup: FCWithMessages<{ layerId: number }> = ({ layerId }) => { }, // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - fields: ['coverage', 'protectedArea'], + fields: ['coverage', 'protected_area'], 'pagination[limit]': 1, }, { @@ -134,7 +134,7 @@ const RegionsPopup: FCWithMessages<{ layerId: number }> = ({ layerId }) => { displayPercentageSign: false, }); - const protectedArea = formatKM(locale, protectionCoverageStats.protectedArea); + const protectedArea = formatKM(locale, protectionCoverageStats.protected_area); return { percentage, diff --git a/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/habitat/index.tsx b/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/habitat/index.tsx index 09fc0183..d2019cae 100644 --- a/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/habitat/index.tsx +++ b/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/habitat/index.tsx @@ -84,7 +84,7 @@ const HabitatWidget: FCWithMessages = ({ location }) => { 'pagination[limit]': -1, // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - fields: ['protectedArea', 'totalArea', 'updatedAt'], + fields: ['protected_area', 'total_area', 'updatedAt'], filters: { location: { code: location?.code, @@ -119,8 +119,8 @@ const HabitatWidget: FCWithMessages = ({ location }) => { title: habitat.name, slug: habitat.slug, background: HABITAT_CHART_COLORS[habitat.slug], - totalArea: stats.totalArea, - protectedArea: stats.protectedArea, + totalArea: stats.total_area, + protectedArea: stats.protected_area, info: metadata?.info, sources: metadata?.sources, updatedAt: stats.updatedAt, diff --git a/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/marine-conservation/index.tsx b/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/marine-conservation/index.tsx index e91c3e28..3cd0461f 100644 --- a/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/marine-conservation/index.tsx +++ b/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/marine-conservation/index.tsx @@ -46,7 +46,7 @@ const MarineConservationWidget: FCWithMessages = 'pagination[limit]': -1, // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - fields: ['year', 'protectedArea', 'updatedAt'], + fields: ['year', 'protected_area', 'updatedAt'], filters: { location: { code: { @@ -76,7 +76,7 @@ const MarineConservationWidget: FCWithMessages = return Object.keys(groupedByYear).map((year) => { const entries = groupedByYear[year]; - const protectedArea = entries[0].attributes.protectedArea; + const protectedArea = entries[0].attributes.protected_area; return { year: Number(year), diff --git a/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/terrestrial-conservation/index.tsx b/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/terrestrial-conservation/index.tsx index ba98ae02..aab79b79 100644 --- a/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/terrestrial-conservation/index.tsx +++ b/frontend/src/containers/map/sidebar/main-panel/panels/details/widgets/terrestrial-conservation/index.tsx @@ -48,7 +48,7 @@ const TerrestrialConservationWidget: FCWithMessages { const entries = groupedByYear[year]; - const protectedArea = entries[0].attributes.protectedArea; + const protectedArea = entries[0].attributes.protected_area; return { year: Number(year), diff --git a/frontend/src/containers/map/sidebar/main-panel/panels/modelling/widget/index.tsx b/frontend/src/containers/map/sidebar/main-panel/panels/modelling/widget/index.tsx index 4e09022b..008772d6 100644 --- a/frontend/src/containers/map/sidebar/main-panel/panels/modelling/widget/index.tsx +++ b/frontend/src/containers/map/sidebar/main-panel/panels/modelling/widget/index.tsx @@ -119,7 +119,7 @@ const ModellingWidget: FCWithMessages = () => { 'pagination[limit]': 1, // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - fields: ['protectedArea'], + fields: ['protected_area'], }, { query: { @@ -127,7 +127,7 @@ const ModellingWidget: FCWithMessages = () => { select: ({ data }) => { if (!data) return null; - const protectedArea = data?.[0].attributes.protectedArea ?? 0; + const protectedArea = data?.[0].attributes.protected_area ?? 0; const location = data?.[0].attributes?.location?.data?.attributes; let totalArea; @@ -202,7 +202,7 @@ const ModellingWidget: FCWithMessages = () => { 'pagination[limit]': 1, // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore - fields: ['protectedArea'], + fields: ['protected_area'], }, { query: { @@ -211,7 +211,7 @@ const ModellingWidget: FCWithMessages = () => { select: ({ data }) => { if (!data) return null; - const protectedArea = data?.[0]?.attributes.protectedArea ?? 0; + const protectedArea = data?.[0]?.attributes.protected_area ?? 0; const location = data?.[0]?.attributes?.location?.data?.attributes; diff --git a/frontend/src/types/generated/strapi.schemas.ts b/frontend/src/types/generated/strapi.schemas.ts index 6e96a2ff..194d6555 100644 --- a/frontend/src/types/generated/strapi.schemas.ts +++ b/frontend/src/types/generated/strapi.schemas.ts @@ -1815,8 +1815,8 @@ export type ProtectionCoverageStatUpdatedBy = { export interface ProtectionCoverageStat { location?: ProtectionCoverageStatLocation; year: number; - protectedArea?: number; - protectedAreasCount: number; + protected_area?: number; + protected_areas_count: number; environment?: ProtectionCoverageStatEnvironment; coverage?: number; pas?: number; @@ -1917,8 +1917,8 @@ export type ProtectionCoverageStatLocationDataAttributesProtectionCoverageStatsD { location?: ProtectionCoverageStatLocationDataAttributesProtectionCoverageStatsDataItemAttributesLocation; year?: number; - protectedArea?: number; - protectedAreasCount?: number; + protected_area?: number; + protected_areas_count?: number; environment?: ProtectionCoverageStatLocationDataAttributesProtectionCoverageStatsDataItemAttributesEnvironment; coverage?: number; pas?: number; @@ -2872,8 +2872,8 @@ export type PaChildrenDataItemAttributesLocationDataAttributesProtectionCoverage { location?: PaChildrenDataItemAttributesLocationDataAttributesProtectionCoverageStatsDataItemAttributesLocation; year?: number; - protectedArea?: number; - protectedAreasCount?: number; + protected_area?: number; + protected_areas_count?: number; environment?: PaChildrenDataItemAttributesLocationDataAttributesProtectionCoverageStatsDataItemAttributesEnvironment; coverage?: number; pas?: number; @@ -3685,8 +3685,8 @@ export type MpaaProtectionLevelStatLocationDataAttributesProtectionCoverageStats { location?: MpaaProtectionLevelStatLocationDataAttributesProtectionCoverageStatsDataItemAttributesLocation; year?: number; - protectedArea?: number; - protectedAreasCount?: number; + protected_area?: number; + protected_areas_count?: number; environment?: MpaaProtectionLevelStatLocationDataAttributesProtectionCoverageStatsDataItemAttributesEnvironment; coverage?: number; pas?: number; @@ -5348,8 +5348,8 @@ export type LocationGroupsDataItemAttributesProtectionCoverageStatsDataItemAttri export type LocationGroupsDataItemAttributesProtectionCoverageStatsDataItemAttributes = { location?: LocationGroupsDataItemAttributesProtectionCoverageStatsDataItemAttributesLocation; year?: number; - protectedArea?: number; - protectedAreasCount?: number; + protected_area?: number; + protected_areas_count?: number; environment?: LocationGroupsDataItemAttributesProtectionCoverageStatsDataItemAttributesEnvironment; coverage?: number; pas?: number; @@ -6492,8 +6492,8 @@ export interface HabitatStat { location?: HabitatStatLocation; habitat?: HabitatStatHabitat; year: number; - protectedArea: number; - totalArea: number; + protected_area: number; + total_area: number; environment?: HabitatStatEnvironment; createdAt?: string; updatedAt?: string; @@ -6660,8 +6660,8 @@ export type HabitatStatLocationDataAttributesProtectionCoverageStatsDataItemAttr export type HabitatStatLocationDataAttributesProtectionCoverageStatsDataItemAttributes = { location?: HabitatStatLocationDataAttributesProtectionCoverageStatsDataItemAttributesLocation; year?: number; - protectedArea?: number; - protectedAreasCount?: number; + protected_area?: number; + protected_areas_count?: number; environment?: HabitatStatLocationDataAttributesProtectionCoverageStatsDataItemAttributesEnvironment; coverage?: number; pas?: number; @@ -7627,8 +7627,8 @@ export type FishingProtectionLevelStatLocationDataAttributesProtectionCoverageSt { location?: FishingProtectionLevelStatLocationDataAttributesProtectionCoverageStatsDataItemAttributesLocation; year?: number; - protectedArea?: number; - protectedAreasCount?: number; + protected_area?: number; + protected_areas_count?: number; environment?: FishingProtectionLevelStatLocationDataAttributesProtectionCoverageStatsDataItemAttributesEnvironment; coverage?: number; pas?: number;