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/codeforafrica Navigation CMS setup #511

Merged
merged 71 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
cce3419
Navigation Init
kelvinkipruto Jul 20, 2023
93cb8f6
Working navigation setup
kelvinkipruto Jul 21, 2023
1431809
Mock jest dependencies
kelvinkipruto Jul 21, 2023
47b8033
Fetch homepage from server side
kelvinkipruto Jul 21, 2023
15dd4d2
Modularize Blocks
kelvinkipruto Jul 24, 2023
06cb466
Fix attempt
kelvinkipruto Jul 24, 2023
8a70938
Test Rest Fix
kelvinkipruto Jul 24, 2023
6b0acfd
Revert to local payload
kelvinkipruto Jul 24, 2023
6243269
Update outputFileTracing
kelvinkipruto Jul 24, 2023
66a522f
Update outputFileTracing with exact modules
kelvinkipruto Jul 24, 2023
3a1108e
Test Fix
kelvinkipruto Jul 24, 2023
bf5d75e
Revert to static props
kelvinkipruto Jul 24, 2023
150cbb6
Fix attempt
kelvinkipruto Jul 24, 2023
c37fff5
Remove payload"
kelvinkipruto Jul 24, 2023
dac5afa
Add payload
kelvinkipruto Jul 24, 2023
808ded7
Ignore payload
kelvinkipruto Jul 24, 2023
048dc67
User rest api
kelvinkipruto Jul 24, 2023
080a99b
Add vercel.json file
kelvinkipruto Jul 24, 2023
2e02679
Update vercel json
kelvinkipruto Jul 24, 2023
d578e3b
Remove vercel JSON File"
kelvinkipruto Jul 24, 2023
ada5606
Set up deployments
koechkevin Jul 31, 2023
16f5915
Update domain name
koechkevin Jul 31, 2023
1af1b1d
Add domain name
koechkevin Jul 31, 2023
3d2731a
Update SSH key
koechkevin Jul 31, 2023
187cd15
Fix typo
koechkevin Jul 31, 2023
5f15937
Update domain name
koechkevin Jul 31, 2023
36197b3
Run full workflow
kelvinkipruto Jul 31, 2023
49bc4d4
Update preview template
kelvinkipruto Jul 31, 2023
e722b78
Fix formating"
kelvinkipruto Jul 31, 2023
acb1181
Test Rest Fix
kelvinkipruto Jul 24, 2023
2b596e3
Fix multiple preview urls update
kelvinkipruto Aug 1, 2023
d148043
Update lockfile
kelvinkipruto Aug 1, 2023
23675d7
Working navbar
kelvinkipruto Aug 1, 2023
8ec8323
Merge branch 'feature/update-workflows' into ft/codeforafrica-navigat…
kelvinkipruto Aug 1, 2023
e700237
Merge branch 'feature/update-workflows' into ft/codeforafrica-navigat…
kelvinkipruto Aug 1, 2023
6fda560
Add Social Media links in nav
kelvinkipruto Aug 1, 2023
184baec
Set socila media icons from nav
kelvinkipruto Aug 1, 2023
81e5d18
Merge branch 'develop' into ft/codeforafrica-navigation-cms
kelvinkipruto Aug 30, 2023
b06bc40
Update lockfile
kelvinkipruto Aug 30, 2023
dde4c24
Fix lockfile
kelvinkipruto Aug 30, 2023
d8da368
Fix gh comment
kelvinkipruto Aug 31, 2023
d3db6e5
Fix gh comment
kelvinkipruto Aug 31, 2023
639a8f5
Fix Deploy comment
kelvinkipruto Aug 31, 2023
ca8ba53
Logically group github actlion comments
kelvinkipruto Aug 31, 2023
ac7a1bc
Fix gh comment error
kelvinkipruto Aug 31, 2023
4072c48
Wrap comments
kelvinkipruto Aug 31, 2023
38e6131
Skip steps
kelvinkipruto Aug 31, 2023
ee58511
Remove quotes
kelvinkipruto Aug 31, 2023
d868720
Add skipped steps
kelvinkipruto Aug 31, 2023
a80f3b5
Fix Error and 404 page
kelvinkipruto Aug 31, 2023
3f6a8f8
Fix Projects page
kelvinkipruto Aug 31, 2023
2c8aaaa
About Page
kelvinkipruto Aug 31, 2023
40a9264
Stories Page
kelvinkipruto Aug 31, 2023
7281022
Opportunities Page
kelvinkipruto Aug 31, 2023
3cb547a
Contact Page
kelvinkipruto Aug 31, 2023
c797bf3
Imprint page
kelvinkipruto Aug 31, 2023
06a83f4
Add Navigation
kelvinkipruto Aug 31, 2023
e2604de
Removed unused navbar
kelvinkipruto Aug 31, 2023
c1c93ff
Remove getHeader
kelvinkipruto Aug 31, 2023
ec035b6
Refractor payload lib code
kelvinkipruto Aug 31, 2023
9f9587e
Fix Social Media Icons
kelvinkipruto Aug 31, 2023
0171968
Fix failing tests
kelvinkipruto Aug 31, 2023
a667141
Update NEXT_PUBLIC_APP_URL
kelvinkipruto Aug 31, 2023
4bc481d
Update NEXT_PUBLIC_APP_URL ARGS
kelvinkipruto Aug 31, 2023
974ef02
Remove Next build args
kelvinkipruto Aug 31, 2023
caf26e6
Update NEXT_PUBLIC_APP_URL
kelvinkipruto Sep 4, 2023
0083a29
Merge branch 'develop' into ft/codeforafrica-navigation-cms
kelvinkipruto Sep 4, 2023
9ab517b
Rebase navigation code
kelvinkipruto Sep 5, 2023
fdd079d
After Review changes
kelvinkipruto Sep 5, 2023
448a254
Update Media access
kelvinkipruto Sep 5, 2023
cb788e1
Remove optional chaining from
koechkevin Sep 5, 2023
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: 4 additions & 4 deletions .github/workflows/codeforafrica-deploy-review-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
with:
build-args: |
MONGODB_URL=${{ secrets.CODEFORAFRICA_MONGO_URL }}/${{ env.APP_NAME }}
NEXT_PUBLIC_APP_URL=${{ env.NEXT_PUBLIC_APP_URL }}
NEXT_PUBLIC_APP_URL=https://${{ env.APP_NAME }}.dev.codeforafrica.org
PAYLOAD_SECRET=${{ secrets.CODEFORAFRICA_PAYLOAD_SECRET_KEY }}
GHOST_URL=${{ secrets.GHOST_URL }}
GHOST_API_KEY=${{ secrets.GHOST_API_KEY }}
Expand All @@ -80,14 +80,14 @@ jobs:
deploy_docker_image: ${{ env.IMAGE_NAME }}:${{ github.sha }}

- name: Update Preview URL
run: gh pr comment ${{ env.issue-number }} --edit-last --body=${{ env.body }}
run: (gh pr comment ${{ env.issue-number }} --edit-last --body='${{ env.body }}' || gh pr comment ${{ env.issue-number }} --body='${{ env.body }}')
env:
issue-number: ${{ github.event.pull_request.number }}
body: |
"Latest updated Preview URL
Latest updated Preview URL
| Name | Review |
|-------|--------|
| ${{ env.APP_NAME }} | [Visit](https://${{ env.APP_NAME }}.dev.codeforafrica.org) |"
| ${{ env.APP_NAME }} | [Visit](https://${{ env.APP_NAME }}.dev.codeforafrica.org) |

destroy_review_app:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.codeforafrica
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RUN pnpm install --recursive --offline --frozen-lockfile
ARG PORT=3000 \
MONGODB_URL \
PAYLOAD_SECRET \
NEXT_PUBLIC_APP_URL=http://localhost:3000 \
NEXT_PUBLIC_APP_URL \
kelvinkipruto marked this conversation as resolved.
Show resolved Hide resolved
GHOST_URL \
GHOST_API_KEY

Expand Down
9 changes: 9 additions & 0 deletions apps/codeforafrica/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
/* eslint-env jest */

global.TextEncoder = jest.fn().mockImplementation(() => ({
encode: jest.fn(),
encodeInto: jest.fn(),
}));

global.TextDecoder = jest.fn().mockImplementation(() => ({
decode: jest.fn(),
}));

jest.mock("next/router", () => ({
useRouter: jest.fn().mockImplementation(() => ({
asPath: "",
Expand Down
3 changes: 2 additions & 1 deletion apps/codeforafrica/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"scripts": {
"cms": "netlify-cms-proxy-server",
"build-server": "tsc --project tsconfig.server.json",
"build-next": "NEXT_BUILD=true pnpm pnpm build-server && NEXT_BUILD=true PAYLOAD_PUBLIC_APP_URL=http://localhost:3000 PAYLOAD_CONFIG_PATH=dist/payload.config.js node dist/server.js",
"build-next": "NEXT_BUILD=true pnpm pnpm build-server && NEXT_BUILD=true PAYLOAD_CONFIG_PATH=dist/payload.config.js node dist/server.js",
"build-payload": "payload build",
"dev": "NODE_OPTIONS='--inspect' ts-node --project tsconfig.server.json server.ts",
"lint-check": "TIMING=1 eslint './'",
Expand Down Expand Up @@ -64,6 +64,7 @@
"next-seo": "^5.15.0",
"payload": "^1.7.5",
"prop-types": "^15.8.1",
"qs": "^6.11.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-share": "^4.4.1",
Expand Down
4 changes: 3 additions & 1 deletion apps/codeforafrica/payload.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { buildConfig } from "payload/config";
import Media from "./src/payload/collections/Media";
import Pages from "./src/payload/collections/Pages";
import { CollectionConfig } from "payload/types";
import Navigation from "./src/payload/globals/Navigation";
import { CollectionConfig, GlobalConfig } from "payload/types";
import dotenv from "dotenv";
import seo from "@payloadcms/plugin-seo";
import nestedDocs from "@payloadcms/plugin-nested-docs";
Expand All @@ -27,6 +28,7 @@ const adapter = s3Adapter({
export default buildConfig({
serverURL: appURL,
collections: [Pages, Media] as CollectionConfig[],
globals: [Navigation] as GlobalConfig[],
admin: {
webpack: (config) => ({
...config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import NavBarNavList from "@/codeforafrica/components/NavBarNavList";
import NextImageButton from "@/codeforafrica/components/NextImageButton";

const DesktopNavBar = React.forwardRef(function DesktopNavBar(props, ref) {
const { logo, menu, sx } = props;
const { logo, menu, socialLinks, sx } = props;

return (
<Grid
Expand All @@ -28,7 +28,11 @@ const DesktopNavBar = React.forwardRef(function DesktopNavBar(props, ref) {
</Grid>
<Grid item>
<Box component="nav" sx={{ justifyContent: "flex-end" }}>
<NavBarNavList menu={menu} direction="row" />
<NavBarNavList
menu={menu}
socialLinks={socialLinks}
direction="row"
/>
</Box>
</Grid>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Transition = React.forwardRef(function Transition(props, ref) {
});

const MobileNavBar = React.forwardRef(function MobileNavBar(props, ref) {
const { logo, menu, sx } = props;
const { logo, menu, socialLinks, sx } = props;
const [open, setOpen] = React.useState(false);

const handleClickOpen = () => {
Expand Down Expand Up @@ -82,7 +82,7 @@ const MobileNavBar = React.forwardRef(function MobileNavBar(props, ref) {
}}
onClose={handleClose}
>
<NavBarNavList menu={menu} />
<NavBarNavList menu={menu} socialLinks={socialLinks} />
<NextImageButton
src={closebutton}
alt="Logo"
Expand Down
4 changes: 3 additions & 1 deletion apps/codeforafrica/src/components/NavBar/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,22 @@ import React from "react";
import DesktopNavBar from "@/codeforafrica/components/DesktopNavBar";
import MobileNavBar from "@/codeforafrica/components/MobileNavBar";

function NavBar({ logo, menu }) {
function NavBar({ logo, menu, socialLinks }) {
return (
<NavigationBar sx={{ py: { xs: "10px", md: "15.5" } }}>
<Section sx={{ px: { xs: 2.5, sm: 0 } }}>
<MobileNavBar
logo={logo}
menu={menu}
socialLinks={socialLinks}
sx={{
display: { xs: "flex", md: "none" },
}}
/>
<DesktopNavBar
logo={logo}
menu={menu}
socialLinks={socialLinks}
sx={{
display: { xs: "none", md: "flex" },
}}
Expand Down
51 changes: 36 additions & 15 deletions apps/codeforafrica/src/components/NavBarNavList/NavBarNavList.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,25 @@ import { SvgIcon } from "@mui/material";
import PropTypes from "prop-types";
import React from "react";

import FacebookIcon from "@/codeforafrica/assets/icons/Type=facebook, Size=24, Color=CurrentColor.svg";
import GitHubIcon from "@/codeforafrica/assets/icons/Type=github, Size=24, Color=CurrentColor.svg";
import InstagramIcon from "@/codeforafrica/assets/icons/Type=instagram, Size=24, Color=CurrentColor.svg";
import LinkedInIcon from "@/codeforafrica/assets/icons/Type=linkedin, Size=24, Color=CurrentColor.svg";
import SlackIcon from "@/codeforafrica/assets/icons/Type=slack, Size=24, Color=CurrentColor.svg";
import TwitterIcon from "@/codeforafrica/assets/icons/Type=twitter, Size=24, Color=CurrentColor.svg";
import NavListItem from "@/codeforafrica/components/NavListItem";

const mapPlatformToIcon = {
kelvinkipruto marked this conversation as resolved.
Show resolved Hide resolved
Facebook: FacebookIcon,
Twitter: TwitterIcon,
Instagram: InstagramIcon,
Linkedin: LinkedInIcon,
Github: GitHubIcon,
Slack: SlackIcon,
};

const NavBarNavList = React.forwardRef(function NavBarNavList(props, ref) {
const { direction, menu, ...other } = props;
const { direction, menu, socialLinks, ...other } = props;

if (!menu?.length) {
return null;
Expand All @@ -34,20 +48,27 @@ const NavBarNavList = React.forwardRef(function NavBarNavList(props, ref) {
</Link>
</NavListItem>
))}
<NavListItem sx={{ m: "20px", mr: 0 }}>
<Link
href="https://twitter.com/Code4Africa"
sx={{ color: { xs: "inherit" } }}
>
<SvgIcon
component={TwitterIcon}
sx={{
mt: direction === "column" ? 0 : 1,
fill: { xs: "none" },
}}
/>
</Link>
</NavListItem>
{socialLinks?.map(({ platform, url }) => {
const Icon = mapPlatformToIcon[platform];
return (
kelvinkipruto marked this conversation as resolved.
Show resolved Hide resolved
<NavListItem key={platform} sx={{ m: "20px", mr: 0 }}>
<Link
href={url}
sx={{ color: { xs: "inherit" } }}
target="_blank"
rel="noopener noreferrer"
kelvinkipruto marked this conversation as resolved.
Show resolved Hide resolved
>
<SvgIcon
component={Icon}
sx={{
mt: direction === "column" ? 0 : 1,
fill: { xs: "none" },
}}
/>
</Link>
</NavListItem>
);
})}
</NavList>
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,37 @@ exports[`<NavBarNavList /> renders unchanged 1`] = `
Contact
</a>
</li>
<li
class="css-14eadhm"
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineAlways css-bmq8gb-MuiTypography-root-MuiLink-root"
href="https://www.facebook.com/CodeForAfrica"
rel="noopener noreferrer"
target="_blank"
>
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-o1xeqk-MuiSvgIcon-root"
focusable="false"
viewBox="0 0 24 24"
/>
</a>
</li>
<li
class="css-14eadhm"
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineAlways css-bmq8gb-MuiTypography-root-MuiLink-root"
href="https://twitter.com/Code4Africa"
rel="noreferrer noopener"
rel="noopener noreferrer"
target="_blank"
>
<div
<svg
aria-hidden="true"
class="MuiSvgIcon-root MuiSvgIcon-fontSizeMedium css-o1xeqk-MuiSvgIcon-root"
focusable="false"
viewbox="0 0 24 24"
viewBox="0 0 24 24"
/>
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ const defaultProps = {
href: "/contact",
},
],
socialLinks: [
{
url: "https://www.facebook.com/CodeForAfrica",
platform: "facebook",
kelvinkipruto marked this conversation as resolved.
Show resolved Hide resolved
},
{
url: "https://twitter.com/Code4Africa",
platform: "twitter",
},
],
};

describe("<NavBarNavList />", () => {
Expand Down
2 changes: 0 additions & 2 deletions apps/codeforafrica/src/lib/api.netlify-cms/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import getProjectTeam from "./getProjectTeam";
import getRelatedProjects from "./getRelatedProjects";
import getTeam from "./getTeam";
import getFooter from "./sections/getFooter";
import getHeader from "./sections/getHeader";
import getHero from "./sections/getHero";
import getMeetOurTeam from "./sections/getMeetOurTeam";
import getSeo from "./seo";
Expand All @@ -29,7 +28,6 @@ export {
getContactForm,
getCmsProjects,
getFooter,
getHeader,
getHero,
getGetInTouch,
getJoinUs,
Expand Down

This file was deleted.

Loading