Skip to content

Commit

Permalink
Merge pull request #472 from CodeForAfrica/fix/charterafrica_navigati…
Browse files Browse the repository at this point in the history
…on_data

@/charterafrica Reduce navigation data
  • Loading branch information
kilemensi committed Jun 30, 2023
2 parents d50a064 + 6b0f74d commit c6ce72c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ const NavBarDropdown = React.forwardRef(function NavBarDropdown(props, ref) {
e.stopPropagation();
setOpen((prevOpen) => !prevOpen);
};
// TODO(kilemensi): Since we current don't have any of the child pages, we
// have to manually hide the popup.
// SHOULD BE REMOVED ONCE CHILD PAGES ARE IMPLEMENTED.
const handleClickMenuItem = () => {
setOpen(false);
};
Expand Down
14 changes: 13 additions & 1 deletion apps/charterafrica/src/lib/data/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,19 @@ export async function getGlobalProps({ locale, defaultLocale }, api) {
href: "/",
priority: true,
},
menus: menus ?? null,
menus:
menus?.map((originalMenu) => {
const { doc, ...menu } = originalMenu;
// Remove pages (doc) from menu and it's children
// This can also be done via afterRead global hook on navigation block
// but it may interfere with CMS functionality
if (menu.children) {
menu.children =
menu.children?.map(({ doc: _, ...other }) => ({ ...other })) ??
null;
}
return menu;
}) ?? null,
};
const footer = await api.findGlobal("footer", {
locale,
Expand Down

1 comment on commit c6ce72c

@vercel
Copy link

@vercel vercel bot commented on c6ce72c Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.