Skip to content

Commit

Permalink
Update tags
Browse files Browse the repository at this point in the history
  • Loading branch information
koechkevin committed Oct 4, 2023
1 parent 96d7a07 commit f006c13
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
7 changes: 2 additions & 5 deletions apps/codeforafrica/src/lib/data/blockify/ourWork.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { sortTags } from "@/codeforafrica/lib/data/utils/posts";
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: allProjects } = await api.getCollection("projects");
const projectTags = allProjects.map(({ tag }) => tag).filter(Boolean);
const tags = Array.from(new Set(projectTags.map((item) => item.id))).map(
(id) => {
return projectTags.find((item) => item.id === id);
},
);
const tags = sortTags(projectTags);

return {
tags: [{ name: "All", slug: "all" }, ...tags],
Expand Down
8 changes: 3 additions & 5 deletions apps/codeforafrica/src/lib/data/blockify/ourWorkShowcase.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { sortTags } from "@/codeforafrica/lib/data/utils/posts";

async function ourWorkShowcase(block, api) {
const { docs: projects } = await api.getCollection("projects");
const projectTags = projects.map(({ tag }) => tag).filter(Boolean);
const tags = Array.from(new Set(projectTags.map((item) => item.id))).map(
(id) => {
return projectTags.find((item) => item.id === id);
},
);
const tags = sortTags(projectTags);

return {
tags,
Expand Down
3 changes: 0 additions & 3 deletions apps/codeforafrica/src/payload/blocks/OurWorkShowcase.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ const OurWorkShowcase = {
en: "Default Tag",
},
hasMany: false,
admin: {
position: "sidebar",
},
}),
],
};
Expand Down

0 comments on commit f006c13

Please sign in to comment.