Skip to content

Commit

Permalink
Merge branch 'feature/cfa-projects-list' into feature/single-project-…
Browse files Browse the repository at this point in the history
…page
  • Loading branch information
koechkevin committed Sep 28, 2023
2 parents 069015a + 356dba4 commit 5dfbcdd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
15 changes: 7 additions & 8 deletions apps/codeforafrica/src/components/Projects/Projects.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-env browser */
import { Section } from "@commons-ui/core";
import { Stack } from "@mui/material";
import { useRouter } from "next/router";
Expand Down Expand Up @@ -55,14 +56,12 @@ const Projects = React.forwardRef(function Projects(
}, [data]);

useEffect(() => {
if (router.isReady) {
const [pathname] = router.asPath.split("?");
const url = pathname ? `${pathname}${queryParams}` : queryParams;
router.push(url, undefined, {
scroll: true,
shallow: true,
});
}
const { pathname } = window.location;
const url = pathname ? `${pathname}${queryParams}` : queryParams;
router.push(url, undefined, {
scroll: true,
shallow: true,
});
// We don't want to listen to router changes here since we're the ones
// updating them
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
5 changes: 3 additions & 2 deletions apps/codeforafrica/src/lib/data/blockify/ourWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import { getProjects } from "@/codeforafrica/lib/data/utils/projects";
async function ourWork(block, api, context) {
const { query } = context;
const data = await getProjects(api, query);
const { docs } = await api.getCollection("tag");
const tags = docs.map(({ name }) => name);
const { docs: allProjects } = await api.getCollection("projects");
const projectTags = allProjects.map(({ tag }) => tag?.name).filter(Boolean);
const tags = ["All", ...new Set(projectTags)];

return {
tags,
Expand Down

0 comments on commit 5dfbcdd

Please sign in to comment.