Skip to content
This repository has been archived by the owner on Aug 23, 2023. It is now read-only.

Commit

Permalink
Merge branch 'release/v1.0.58'
Browse files Browse the repository at this point in the history
  • Loading branch information
nnkogift committed Aug 9, 2022
2 parents f5bf273 + 0d9ef72 commit 8ac0021
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@hisptz/react-ui",
"homepage": "https://hisptz.github.io/react-ui",
"version": "1.0.57",
"version": "1.0.58",
"description": "A collection of reusable complex DHIS2 react ui components.",
"license": "BSD-3-Clause",
"scripts": {
Expand Down
19 changes: 19 additions & 0 deletions src/components/Map/Map.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,25 @@ BoundaryLayer.args = {
},
};

export const BoundaryLayerWithLevels = Template.bind({});
BoundaryLayerWithLevels.args = {
orgUnitSelection: {
orgUnits: [
{
id: "ImspTQPwCqd",
displayName: "Sierra Leone",
name: "Sierra Leone",
path: "/ImspTQPwCqd",
children: [],
},
],
levels: ["2"],
},
boundaryLayer: {
enabled: true,
},
};

export const ChoroplethThematicLayer = Template.bind({});
ChoroplethThematicLayer.args = {
orgUnitSelection: { orgUnits: [], userOrgUnit: true, userSubUnit: true, userSubX2Unit: true },
Expand Down
1 change: 1 addition & 0 deletions src/components/Map/components/MapProvider/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export function MapProvider({ children, orgUnitSelection, periodSelection }: Map
useEffect(() => {
async function getOrgUnits() {
const rawOrgUnitIds = getOrgUnitsSelection(orgUnitSelection);
console.log(rawOrgUnitIds);
const data = await refetch({ orgUnitIds: rawOrgUnitIds });
const { analytics, boundaries } = (data as any) ?? {};
const rawOrgUnits = sanitizeOrgUnits(analytics?.metaData);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Map/utils/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function getOrgUnitsSelection(orgUnitSelection: OrgUnitSelection) {
orgUnits.push("USER_ORGUNIT_GRANDCHILDREN");
}
if (!isEmpty(orgUnitSelection.levels)) {
forEach(orgUnitSelection.levels, (level) => `LEVEL-${level}`);
forEach(orgUnitSelection.levels, (level) => orgUnits.push(`LEVEL-${level}`));
}

return [...orgUnits, ...(orgUnitSelection?.orgUnits?.map((ou: OrganisationUnit) => `${ou.id}`) ?? [])];
Expand Down
5 changes: 4 additions & 1 deletion src/dataProviders/map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ export default function MapDataProvider({ children }: { children: React.ReactNod
return (
<CustomDataProvider
data={{
...mapData,
geoFeatures: async (type, query) => {
console.log(query);
return mapData.geoFeatures;
},
analytics: async (type, query) => {
if (query?.params?.skipData) {
return mapData.analytics;
Expand Down

0 comments on commit 8ac0021

Please sign in to comment.