Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ft/Removed hard coded content #246

Merged
merged 37 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7050428
Moved join us to cms
kelvinkipruto Sep 2, 2022
b525b4e
Merge branch 'main' into ft/remove-hard-coded-content
kelvinkipruto Sep 2, 2022
4cd1db3
Removed Console log
kelvinkipruto Sep 2, 2022
01edc86
Fixed failing test
kelvinkipruto Sep 2, 2022
b812a21
Separated joins us from contact
kelvinkipruto Sep 5, 2022
acec6d0
Moved hero slug to netlify
kelvinkipruto Sep 6, 2022
597f811
moved impact slug to netlify
kelvinkipruto Sep 6, 2022
d860dff
Moved get in touch slug to netlify
kelvinkipruto Sep 6, 2022
fd6a409
moved meet our team slug to netlify
kelvinkipruto Sep 6, 2022
e9b9ec1
refractored some slugs and titles
kelvinkipruto Sep 6, 2022
acd80a8
Merge branch 'main' into ft/remove-hard-coded-content
kelvinkipruto Sep 6, 2022
504f28c
Handle slug for file-based collections
kilemensi Sep 8, 2022
827c84a
Partially fixed hard coded slug
kelvinkipruto Sep 8, 2022
234308d
Get news-stories slug from cms
kelvinkipruto Sep 8, 2022
7c00296
Merge branch 'main' into ft/remove-hard-coded-content
kilemensi Sep 9, 2022
238c9b9
Pull slug + restructure to match component props
kilemensi Sep 9, 2022
a6b3560
Remove hard-coded our-partners
kilemensi Sep 9, 2022
b299bed
Add related project config and content to individual partner page
kilemensi Sep 9, 2022
d0e7871
Pull related projects from CMS
kilemensi Sep 9, 2022
1bdb570
Add related project config to our-work-individual
kilemensi Sep 9, 2022
8eb0347
Pull our-work-individual's related-projects from CMS
kilemensi Sep 9, 2022
fda66c6
add related-project to about-members-individual config
kilemensi Sep 9, 2022
b033d4e
pull about-members-individual's related-projects from CMS
kilemensi Sep 9, 2022
a430c47
Use id for matching instead of name
kilemensi Sep 9, 2022
652f54b
Add our-projects to index page
kilemensi Sep 9, 2022
e214ae8
Add ability to pull our-projects to CMS
kilemensi Sep 9, 2022
95021f0
Pull index's our-projects from CMS
kilemensi Sep 9, 2022
d865067
Fixed Join Us
kelvinkipruto Sep 9, 2022
3f85399
Add our-work config to /projects page
kilemensi Sep 9, 2022
94dd8d6
Pull projects from CMS
kilemensi Sep 9, 2022
4ea5818
Pull stories and opportunities from CMS
kilemensi Sep 9, 2022
318226f
Pull related news and stories from CMS
kilemensi Sep 9, 2022
4f7d32f
Pull team content from CMS
kilemensi Sep 9, 2022
5892963
Merge branch 'ft/remove-hard-coded-content' of github.com:CodeForAfri…
kilemensi Sep 9, 2022
f877a1b
Pull contact form from CMS
kilemensi Sep 9, 2022
0098e5d
Pull our offices from CMS
kilemensi Sep 9, 2022
9857764
Refractore some hard coded content
kelvinkipruto Sep 9, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions apps/codeforafrica/content/pages/contact-us-join-us.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
join-us:
title: " We are on Slack!"
subtitle: " Join us"
action:
label: Join Our Slack
href: https://docs.google.com/forms/d/e/1FAIpQLSdkfLU2yi2S1_7D27Z0I1TumkWy5brlam809Od9cc6CnXGA-A/viewform
---
13 changes: 0 additions & 13 deletions apps/codeforafrica/content/pages/contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,6 @@ contact-form:


<!--End mc_embed_signup-->
join-us:
icon:
href: https://docs.google.com/forms/d/e/1FAIpQLSdkfLU2yi2S1_7D27Z0I1TumkWy5brlam809Od9cc6CnXGA-A/viewform
src: /images/type-slack-size-64-color-currentcolor.svg
title: We are on Slack!
subtitle: Join us
action: JOIN OUR SLACK
offices-addresses:
- f80da5cc-a72c-4573-abe4-cf0432f1dd87
- 309d67f8-6bb8-46fd-873f-d0475ddee974
- 54814d5a-d844-425d-aa3d-f466a2e71afd
- a57c5c5a-32ab-4e00-a57f-f8b050b58e63
- 4f079340-a9b1-464a-801a-4edabb67b6e8
seo:
title: Contact Us
description: Let’s start something together!
Expand Down
8 changes: 5 additions & 3 deletions apps/codeforafrica/src/lib/api.netlify-cms/getGetInTouch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { getCollectionBySlug } from "./utils";

export default function getGetInTouch() {
return getCollectionBySlug("content/pages", "about", ["get-in-touch"]).items[
"get-in-touch"
];
const getInTouch = getCollectionBySlug("content/pages", "about", [
"get-in-touch",
]).items["get-in-touch"];

return { ...getInTouch, slug: "get-in-touch" };
kelvinkipruto marked this conversation as resolved.
Show resolved Hide resolved
}
13 changes: 13 additions & 0 deletions apps/codeforafrica/src/lib/api.netlify-cms/getJoinUs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getCollectionBySlug } from "./utils";

function getJoinUs() {
const { "join-us": joinUs } = getCollectionBySlug(
"content/pages",
"contact-us-join-us",
["join-us"]
).data;

return { ...joinUs, slug: "join-our-slack" };
}

export default getJoinUs;
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function getOurGuidingPrinciples() {

const list =
principleIds?.map((id) => allPrinciples.find((p) => p.id === id)) ?? null;
return { title, list };
return { title, list, slug: "guiding-principles" };
}

export default getOurGuidingPrinciples;
2 changes: 1 addition & 1 deletion apps/codeforafrica/src/lib/api.netlify-cms/getOurImpact.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ export default function geOurImpact(page = "index") {
// Need to maintain order of how impact were selected in ourImpact
const list = impactIds?.map((id) => impact.find((i) => i.id === id)) ?? null;

return { action, list, title };
return { action, list, title, slug: "our-impact" };
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function getOurMission() {
"our-mission",
]).items;
ourMission.description = marked(ourMission.description);
ourMission.slug = "our-mission";

return ourMission;
}
2 changes: 1 addition & 1 deletion apps/codeforafrica/src/lib/api.netlify-cms/getOurTeam.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export default function geOurPartners() {
"our-team": { title },
} = getCollectionBySlug("content/pages", "about", ["our-team"]).items;

return { title };
return { title, slug: "our-team" };
}
2 changes: 2 additions & 0 deletions apps/codeforafrica/src/lib/api.netlify-cms/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import getBody from "./getBody";
import getContactForm from "./getContactForm";
import getGetInTouch from "./getGetInTouch";
import getJoinUs from "./getJoinUs";
import getNewsAndStories from "./getNewsAndStories";
import getOffices from "./getOffices";
import getOurGuidingPrinciples from "./getOurGuidingPrinciples";
Expand All @@ -25,6 +26,7 @@ export {
getHeader,
getHero,
getGetInTouch,
getJoinUs,
getMeetOurTeam,
getNewsAndStories,
getOffices,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const indexPageDir = join(process.cwd(), "content/pages");
export default function getHero(page, fields = ["hero"]) {
const { hero } = getCollectionBySlug(indexPageDir, page, fields).items;
hero.title = marked.parseInline(hero.title);
hero.slug = "hero";

return hero;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ export default function getMeetOurTeam(
];
meetOurTeam.logo = meetOurTeam.image?.src;
meetOurTeam.description = marked(meetOurTeam.description);
meetOurTeam.slug = "meet-our-team";
return meetOurTeam;
}
41 changes: 5 additions & 36 deletions apps/codeforafrica/src/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
getGetInTouch,
getHeader,
getHero,
getJoinUs,
getMeetOurTeam,
getNewsAndStories,
getOffices,
Expand Down Expand Up @@ -156,7 +157,7 @@ async function getProcessedNewsAndStories() {
const allStories = await getAllStories();
const articles = prioritiseFeaturedStory(allStories).slice(0, count);

return { title, articles };
return { title, articles, slug: "news-stories" };
}

async function getHomePageStaticProps() {
Expand All @@ -167,25 +168,22 @@ async function getHomePageStaticProps() {
sections: [
{
...getHero("index"),
slug: "hero",
},
{
slug: "projects",
projects,
tags: getProjectTags({ includeAll: false }),
},
{ ...meetOurTeam, slug: "meet-our-team" },
{ ...meetOurTeam },
{
...(await getProcessedNewsAndStories()),
slug: "news-stories",
},
{
slug: "our-partners",
partners: getOurPartners(),
},
{
...getOurImpact(),
slug: "our-impact",
},
],
footer,
Expand Down Expand Up @@ -242,7 +240,6 @@ async function getOpportunitiesPageStaticProps() {
seo,
sections: [
{
slug: "hero",
...getHero("opportunities"),
},
{
Expand Down Expand Up @@ -288,7 +285,6 @@ function getImprintPageStaticProps() {
sections: [
{
...getHero("imprint"),
slug: "hero",
},
],
footer,
Expand All @@ -308,7 +304,6 @@ function getPrivacyPageStaticProps() {
sections: [
{
...getHero("privacy-policy"),
slug: "hero",
},
],
footer,
Expand Down Expand Up @@ -371,7 +366,6 @@ function getProjectsPageStaticProps() {
seo,
sections: [
{
slug: "hero",
...getHero("our-work"),
},
{
Expand Down Expand Up @@ -491,15 +485,12 @@ function getAboutImpactPageStaticProps() {
sections: [
{
...getHero("about"),
slug: "hero",
},
{
slug: "our-impact",
...getOurImpact("about"),
},
{
...getGetInTouch(),
slug: "get-in-touch",
},
],
footer,
Expand Down Expand Up @@ -549,18 +540,15 @@ function getAboutMembersPageStaticProps() {
sections: [
{
...getHero("about"),
slug: "hero",
},
{
...getOurTeam(),
pathname: "/about/members",
tags: getMembersFieldTags(),
team: getMembers(),
slug: "our-team",
},
{
...getGetInTouch(),
slug: "get-in-touch",
},
],
footer,
Expand All @@ -579,34 +567,28 @@ function getAboutPageStaticProps() {
sections: [
{
...getHero("about"),
slug: "hero",
},
{
...getOurMission(),
slug: "our-mission",
},
{
...getOurGuidingPrinciples(),
slug: "guiding-principles",
},

{
...getOurTeam(),
tags: getMembersFieldTags(),
team: getMembers(),
slug: "our-team",
},
{
slug: "our-partners",
partners: getOurPartners("about"),
},
{
...getOurImpact("about"),
slug: "our-impact",
},
{
...getGetInTouch(),
slug: "get-in-touch",
},
],
footer,
Expand Down Expand Up @@ -659,15 +641,13 @@ function getAboutPartnersPageStaticProps() {
sections: [
{
...getHero("about"),
slug: "hero",
},
{
slug: "our-partners",
partners: getOurPartners("about"),
},
{
...getGetInTouch(),
slug: "get-in-touch",
},
],
footer,
Expand All @@ -685,21 +665,14 @@ function getContactPageStaticProps() {
seo,
sections: [
{
slug: "hero",
...getHero("contact"),
},
{
...getContactForm(),
slug: "contact-form",
},
{
slug: "join-our-slack",
title: "We are on Slack!",
subtitle: "Join us",
action: {
label: "Join our Slack",
href: "https://docs.google.com/forms/d/e/1FAIpQLSdkfLU2yi2S1_7D27Z0I1TumkWy5brlam809Od9cc6CnXGA-A/viewform",
},
...getJoinUs(),
},
{
slug: "office-addresses",
Expand Down Expand Up @@ -728,7 +701,7 @@ async function getProcessedRecentStories(page) {
const allStories = await getAllStories();
const { title, count = 3 } = getNewsAndStories(page);
const articles = allStories.slice(0, count);
return { title, articles };
return { title, articles, slug: "news-stories" };
}

async function getErrorPageStaticProps() {
Expand All @@ -740,11 +713,9 @@ async function getErrorPageStaticProps() {
sections: [
{
...getHero("error"),
slug: "hero",
},
{
...(await getProcessedRecentStories("error")),
slug: "news-stories",
},
],
footer,
Expand All @@ -763,11 +734,9 @@ async function get404PageStaticProps() {
sections: [
{
...getHero("404"),
slug: "hero",
},
{
...(await getProcessedRecentStories("404")),
slug: "news-stories",
title: "Recent Stories",
},
],
Expand Down
Loading