From 40eb7abd01ef4b8eb95c5b60e0dd01cf7af9a56f Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Mon, 28 Oct 2024 12:17:38 +0300
Subject: [PATCH 01/18] Fix navigation
---
.../src/components/ExplorePage/index.js | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/apps/climatemappedafrica/src/components/ExplorePage/index.js b/apps/climatemappedafrica/src/components/ExplorePage/index.js
index 4296a53b3..047b20921 100644
--- a/apps/climatemappedafrica/src/components/ExplorePage/index.js
+++ b/apps/climatemappedafrica/src/components/ExplorePage/index.js
@@ -80,7 +80,10 @@ function ExplorePage({
]);
useEffect(() => {
if (geoCode) {
- dispatch({ type: "fetch", payload: { code: geoCode } });
+ dispatch({
+ type: "fetch",
+ payload: { code: geoCode, onClick: handleClickTag },
+ });
}
}, [dispatch, geoCode]);
@@ -94,7 +97,7 @@ function ExplorePage({
if (data) {
dispatch({
type: "show",
- payload: { profile: data, options: { onClick: handleClickTag } },
+ payload: { profile: data, onClick: handleClickTag },
});
}
}, [dispatch, data]);
From 4413068d5938a367c1391447cbffcd6b7bc1b14a Mon Sep 17 00:00:00 2001
From: Kevin Koech
Date: Mon, 28 Oct 2024 16:19:03 +0300
Subject: [PATCH 02/18] Added PanelItems options to Payloadcms
---
.../src/lib/data/blockify/explore-page.js | 59 +++------
.../src/lib/data/common/index.js | 2 +-
.../payload/globals/HURUMap/PanelOptions.js | 121 ++++++++++++++++++
.../src/payload/globals/HURUMap/index.js | 3 +-
4 files changed, 143 insertions(+), 42 deletions(-)
create mode 100644 apps/climatemappedafrica/src/payload/globals/HURUMap/PanelOptions.js
diff --git a/apps/climatemappedafrica/src/lib/data/blockify/explore-page.js b/apps/climatemappedafrica/src/lib/data/blockify/explore-page.js
index a08295a60..a78c8682e 100644
--- a/apps/climatemappedafrica/src/lib/data/blockify/explore-page.js
+++ b/apps/climatemappedafrica/src/lib/data/blockify/explore-page.js
@@ -6,6 +6,15 @@ import {
async function explorePage({ block: { slugs }, hurumap }) {
const {
rootGeography,
+ align,
+ anchor,
+ lazyblock,
+ blockUniqueClass,
+ ghostkitSpacings,
+ ghostkitSR,
+ scrollToTopLabel,
+ dataNotAvailable,
+ items: panelItems,
page: { value },
} = hurumap;
const { code: name, rootGeographyHasData: pinRootGeography } = rootGeography;
@@ -35,46 +44,16 @@ async function explorePage({ block: { slugs }, hurumap }) {
// TODO: Move this to a PayloadCMS
const panel = {
- panelItems: [
- {
- value: "rich-data",
- icon: "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2021/11/Group-4505.svg",
- iconProps: {
- src: "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2021/11/Group-4505.svg",
- width: 44,
- height: 44,
- type: "svg",
- blurDataURL:
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGElEQVR4nGNgQAP/T///f/o/jHMWiQMHACIVCyeABSwfAAAAAElFTkSuQmCC",
- placeholder: "blur",
- },
- },
- {
- value: "pin",
- icon: "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2022/01/Path-210-1-1.svg",
- pin: true,
- iconProps: {
- src: "https://cms.dev.codeforafrica.org/pesayetu/wp-content/uploads/sites/2/2022/01/Path-210-1-1.svg",
- width: 44,
- height: 44,
- type: "svg",
- blurDataURL:
- "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAH0lEQVR4nGNgQAP/L/z/f/r//4P/wZzT//+fBbOQAQBvnQ3r6iVM4QAAAABJRU5ErkJggg==",
- placeholder: "blur",
- },
- },
- ],
- scrollToTopLabel: "Back To Top",
- dataNotAvailable: "— DATA NOT AVAILABLE",
- lazyblock: {
- slug: "lazyblock/panel",
- },
- align: "",
- anchor: "",
- blockId: "20amuc",
- blockUniqueClass: "lazyblock-panel-20amuc",
- ghostkitSpacings: "",
- ghostkitSR: "",
+ panelItems,
+ scrollToTopLabel,
+ dataNotAvailable,
+ lazyblock,
+ align,
+ anchor,
+ blockId: "explore-page",
+ blockUniqueClass,
+ ghostkitSpacings,
+ ghostkitSR,
};
const res = {
id: "explore-page",
diff --git a/apps/climatemappedafrica/src/lib/data/common/index.js b/apps/climatemappedafrica/src/lib/data/common/index.js
index fb7918025..c1e0b3f8c 100644
--- a/apps/climatemappedafrica/src/lib/data/common/index.js
+++ b/apps/climatemappedafrica/src/lib/data/common/index.js
@@ -57,7 +57,7 @@ function getNavBar(siteSettings, variant, { slug }) {
export async function getPageProps(api, context) {
// For now, ClimatemappedAfrica only supports single paths i.e. /, /about, etc.,
// so params.slug[0] is good enough
- const slugs = context.params?.slugs || undefined;
+ const slugs = context.params?.slugs || ["index"];
const [slug] = slugs || ["index"];
const { draftMode = false } = context;
const options = { draft: draftMode };
diff --git a/apps/climatemappedafrica/src/payload/globals/HURUMap/PanelOptions.js b/apps/climatemappedafrica/src/payload/globals/HURUMap/PanelOptions.js
new file mode 100644
index 000000000..c3135fe24
--- /dev/null
+++ b/apps/climatemappedafrica/src/payload/globals/HURUMap/PanelOptions.js
@@ -0,0 +1,121 @@
+import image from "../../fields/image";
+
+const PanelOptions = {
+ label: "Panel Options",
+ fields: [
+ {
+ name: "items",
+ type: "array",
+ label: "Panel Items",
+ fields: [
+ {
+ type: "select",
+ name: "value",
+ label: "Value",
+ options: [
+ { value: "rich-data", label: "Rich Data" },
+ { value: "pin", label: "Pin" },
+ ],
+ localized: true,
+ },
+ image({
+ overrides: {
+ name: "icon",
+ required: true,
+ },
+ }),
+ ],
+ },
+ {
+ type: "row",
+ fields: [
+ {
+ name: "scrollToTopLabel",
+ type: "text",
+ label: "Scroll To Top Label",
+ defaultValue: "Scroll To Top",
+ admin: {
+ width: "50%",
+ },
+ localized: true,
+ },
+ {
+ name: "dataNotAvailable",
+ type: "text",
+ label: "Data Not Available",
+ defaultValue: "DATA NOT AVAILABLE",
+ admin: {
+ width: "50%",
+ },
+ localized: true,
+ },
+ {
+ name: "align",
+ type: "text",
+ label: "Align",
+ localized: true,
+ defaultValue: "",
+ admin: {
+ width: "50%",
+ },
+ },
+ {
+ name: "anchor",
+ type: "text",
+ label: "Anchor",
+ localized: true,
+ defaultValue: "",
+ admin: {
+ width: "50%",
+ },
+ },
+ {
+ name: "blockUniqueClass",
+ type: "text",
+ label: "Block Unique Class",
+ defaultValue: "lazyblock-panel-20amuc",
+ localized: true,
+ admin: {
+ width: "50%",
+ },
+ },
+ {
+ name: "ghostkitSpacings",
+ type: "text",
+ label: "Ghostkit Spacings",
+ defaultValue: "",
+ localized: true,
+ admin: {
+ width: "50%",
+ },
+ },
+ {
+ name: "ghostkitSR",
+ type: "text",
+ label: "Ghostkit SR",
+ localized: true,
+ defaultValue: "",
+ admin: {
+ width: "50%",
+ },
+ },
+ ],
+ },
+ {
+ name: "lazyblock",
+ type: "group",
+ label: "Lazy Block",
+ fields: [
+ {
+ name: "slug",
+ type: "text",
+ label: "Slug",
+ defaultValue: "lazyblock/panel",
+ localized: true,
+ },
+ ],
+ },
+ ],
+};
+
+export default PanelOptions;
diff --git a/apps/climatemappedafrica/src/payload/globals/HURUMap/index.js b/apps/climatemappedafrica/src/payload/globals/HURUMap/index.js
index 245ab94d8..d4f24a51e 100644
--- a/apps/climatemappedafrica/src/payload/globals/HURUMap/index.js
+++ b/apps/climatemappedafrica/src/payload/globals/HURUMap/index.js
@@ -1,4 +1,5 @@
import Geography from "./Geography";
+import PanelOptions from "./PanelOptions";
import Profile from "./Profile";
import Tutorial from "./Tutorial";
@@ -22,7 +23,7 @@ const HURUMap = {
},
{
type: "tabs",
- tabs: [Profile, Geography, Tutorial],
+ tabs: [Profile, Geography, Tutorial, PanelOptions],
admin: {
condition: (_, siblingData) => !!siblingData?.enableHURUMap,
},
From e6b3e452e9a83336bd6ec1762137f0f7d9d4eb86 Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Tue, 29 Oct 2024 14:02:50 +0300
Subject: [PATCH 03/18] Fix location search
---
.../DropdownSearch/DownloadSearch.js | 26 ++++++++++---------
.../Navigation/ExploreNavigation/index.js | 5 ++--
.../src/lib/data/common/index.js | 7 +++--
3 files changed, 22 insertions(+), 16 deletions(-)
diff --git a/apps/climatemappedafrica/src/components/DropdownSearch/DownloadSearch.js b/apps/climatemappedafrica/src/components/DropdownSearch/DownloadSearch.js
index dc9f31362..a0ed0598f 100644
--- a/apps/climatemappedafrica/src/components/DropdownSearch/DownloadSearch.js
+++ b/apps/climatemappedafrica/src/components/DropdownSearch/DownloadSearch.js
@@ -16,7 +16,7 @@ import Link from "@/climatemappedafrica/components/Link";
function DropdownSearch({
href: hrefProp = "/explore",
- label = "Search for a location",
+ label,
locations,
onClick,
icon: IconProp = SearchIcon,
@@ -97,15 +97,17 @@ function DropdownSearch({
return (
- ({
- color: palette.text.primary,
- marginBottom: typography.pxToRem(10),
- })}
- >
- {label}
-
+ {label && (
+ ({
+ color: palette.text.primary,
+ marginBottom: typography.pxToRem(10),
+ })}
+ >
+ {label}
+
+ )}
({
},
}));
-function ExploreNavigation({ explorePagePath, logo, variant }) {
+function ExploreNavigation({ explorePagePath, locations, logo, variant }) {
const classes = useStyles();
const { setIsOpen } = useTour();
@@ -72,8 +72,9 @@ function ExploreNavigation({ explorePagePath, logo, variant }) {
Date: Tue, 29 Oct 2024 14:07:17 +0300
Subject: [PATCH 04/18] Fix btn size
Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
---
.../src/components/DropdownSearch/DownloadSearch.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/apps/climatemappedafrica/src/components/DropdownSearch/DownloadSearch.js b/apps/climatemappedafrica/src/components/DropdownSearch/DownloadSearch.js
index a0ed0598f..7947622e2 100644
--- a/apps/climatemappedafrica/src/components/DropdownSearch/DownloadSearch.js
+++ b/apps/climatemappedafrica/src/components/DropdownSearch/DownloadSearch.js
@@ -87,8 +87,8 @@ function DropdownSearch({
component={iconComponent}
viewBox="0 0 48 48"
sx={{
- width: 48,
- height: 48,
+ width: 40,
+ height: 40,
...iconBorder,
}}
/>
From ae55079f2373c155b395012c39ff290b20717d2e Mon Sep 17 00:00:00 2001
From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
Date: Tue, 29 Oct 2024 17:16:35 +0300
Subject: [PATCH 05/18] Regenerate snapshot
Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com>
---
.../src/components/DropdownSearch/DropdownSearch.snap.js | 4 ++--
apps/climatemappedafrica/src/components/Hero/Hero.snap.js | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/apps/climatemappedafrica/src/components/DropdownSearch/DropdownSearch.snap.js b/apps/climatemappedafrica/src/components/DropdownSearch/DropdownSearch.snap.js
index d8dd3412a..06576c3fb 100644
--- a/apps/climatemappedafrica/src/components/DropdownSearch/DropdownSearch.snap.js
+++ b/apps/climatemappedafrica/src/components/DropdownSearch/DropdownSearch.snap.js
@@ -12,7 +12,7 @@ exports[` renders unchanged 1`] = `
Search for a location