From 0839136bc5f4c0fba821645af57baf356034b2e6 Mon Sep 17 00:00:00 2001 From: gnnko Date: Mon, 23 Jan 2023 08:12:10 +0300 Subject: [PATCH 1/2] fix(map): Fixes - Fixed issues with map legends not working when the extreme values are undefined --- package.json | 2 +- .../components/MapLayerProvider/hooks/index.tsx | 10 +++++++++- .../MapProvider/components/MapLayerProvider/index.tsx | 3 +++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d46c919..5130e43 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@hisptz/react-ui", "homepage": "https://hisptz.github.io/react-ui", - "version": "1.0.85", + "version": "1.0.85 ", "description": "A collection of reusable complex DHIS2 react ui components.", "license": "BSD-3-Clause", "scripts": { diff --git a/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx b/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx index 67820fa..0fd9466 100644 --- a/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx +++ b/src/components/Map/components/MapProvider/components/MapLayerProvider/hooks/index.tsx @@ -135,11 +135,19 @@ export function useThematicLayers(): any { scale: defaultClasses, colorClass: defaultColorScaleName, }; - const sortedData = sortBy(layer.data, "data"); + const sortedData = sortBy( + layer.data.filter((datum) => !!datum.data), + "data" + ); const autoLegends = generateLegends(last(sortedData)?.data ?? 0, head(sortedData)?.data ?? 0, { classesCount: scale, colorClass, }); + console.log({ + scale, + colorClass, + sortedData, + }); legends.push(...autoLegends); } return { diff --git a/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx b/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx index aa54c52..845d11c 100644 --- a/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx +++ b/src/components/Map/components/MapProvider/components/MapLayerProvider/index.tsx @@ -43,6 +43,9 @@ export function MapLayersProvider({ layers, children }: { layers: MapLayerConfig const sanitizedBoundaryLayers = (boundaryLayers ?? []) as CustomBoundaryLayer[]; const sanitizedPointLayer = head(pointLayers ?? []) ? await sanitizePointLayer(head(pointLayers) as CustomPointLayer) : undefined; const sanitizedEarthEngineLayers = await sanitizeEarthEngineLayers([...(earthEngineLayers ?? [])] as unknown as CustomGoogleEngineLayer[]); + + console.log(sanitizedThematicLayers); + setUpdatedLayers( compact([...(sanitizedBoundaryLayers ?? []), ...(sanitizedThematicLayers ?? []), sanitizedPointLayer, ...(sanitizedEarthEngineLayers ?? [])]) ); From a7f5160a9a7b261e2821f09ba3e3544669f0a1da Mon Sep 17 00:00:00 2001 From: gnnko Date: Mon, 23 Jan 2023 08:13:10 +0300 Subject: [PATCH 2/2] chore(package.json): Version update - Changed version to v1.0.86 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5130e43..c4577df 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@hisptz/react-ui", "homepage": "https://hisptz.github.io/react-ui", - "version": "1.0.85 ", + "version": "1.0.86", "description": "A collection of reusable complex DHIS2 react ui components.", "license": "BSD-3-Clause", "scripts": {