Skip to content

Commit

Permalink
Merge pull request #1051 from CodeForAfrica/fix/climate-mapped-africa…
Browse files Browse the repository at this point in the history
…-fixes

ClimateMapped Africa Fixes
  • Loading branch information
kelvinkipruto authored Feb 25, 2025
2 parents 7b67587 + c05ad0f commit 8fedd80
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ function DropdownSearch({
{suggestions.map(({ name, code }) => (
<ListItem
component={Link}
href={`${hrefProp}/${code}`}
variant="subtitle1"
underline="none"
onClick={() => handleSelect(code, name)}
Expand Down
4 changes: 3 additions & 1 deletion apps/climatemappedafrica/src/components/ExplorePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function ExplorePage({
if (geoCode) {
dispatch({
type: "fetch",
payload: { code: geoCode, onClick: handleClickTag },
payload: { code: geoCode },
});
}
}, [dispatch, geoCode]);
Expand Down Expand Up @@ -129,6 +129,8 @@ function ExplorePage({
};

const handleClickMap = (_, feature) => {
const code = feature?.properties?.code;
setGeoCode(code);
return handleSelectLocation(feature.properties);
};

Expand Down
21 changes: 2 additions & 19 deletions apps/climatemappedafrica/src/components/HURUmap/Chart/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { RichTypography } from "@commons-ui/next";
import { ChartTooltip, IndicatorTitle, Download, Share } from "@hurumap/core";
import { Source } from "@hurumap/next";
import { Box, useMediaQuery, useTheme } from "@mui/material";
import { debounce } from "lodash";
import React, { useState, useRef, useCallback, useEffect } from "react";
import * as vega from "vega";
import embed from "vega-embed";
Expand Down Expand Up @@ -68,25 +67,9 @@ function Chart({

const handler = useCallback(
(_, event, item, value) => {
const debouncedTooltip = debounce((e, i, v) => {
if (!v) {
setTooltipData(null);
return;
}
if (
!tooltipData ||
tooltipData.value?.group !== v?.group ||
tooltipData.event?.clientX !== e?.clientX ||
tooltipData.event?.clientY !== e?.clientY
) {
setTooltipData({ item: i, value: v, id, geoCode, event: e });
}
}, 50);

debouncedTooltip(event, item, value);
return () => debouncedTooltip.cancel();
setTooltipData({ item, value, id, geoCode, event });
},
[id, geoCode, tooltipData],
[id, geoCode],
);

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function DesktopPanel({ sx, ...props }) {
overscrollBehaviorBlock: "none",
},
}}
variant="persistent"
{...(open && { variant: "persistent" })}
PaperProps={{
elevation: 0,
square: true,
Expand Down
4 changes: 2 additions & 2 deletions apps/climatemappedafrica/src/lib/data/blockify/hero.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export default async function hero(block, _api, _context, { hurumap }) {
});
const { level } = geometries.boundary?.properties ?? {};
const childLevelMaps = {
continent: "country",
country: "region",
Continent: "Country",
Country: "Region",
};
const childLevel = childLevelMaps[level];
const { locations, preferredChildren } = await fetchProfile({
Expand Down
1 change: 1 addition & 0 deletions apps/pesayetu/src/components/DropdownSearch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ function DropdownSearch({
{suggestions.map(({ name, code }) => (
<ListItem
component={Link}
href={`${hrefProp}/${code}`}
variant="subtitle1"
underline="none"
onClick={() => handleSelect(code, name)}
Expand Down
2 changes: 2 additions & 0 deletions apps/pesayetu/src/components/ExplorePage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ function ExplorePage({ panelProps, profile: profileProp, ...props }) {
};

const handleClickMap = (_, feature) => {
const code = feature?.properties?.code;
setGeoCode(code);
return handleSelectLocation(feature.properties);
};

Expand Down

0 comments on commit 8fedd80

Please sign in to comment.