Skip to content

Commit

Permalink
Merge branch 'main' into chore/build-arm-image
Browse files Browse the repository at this point in the history
  • Loading branch information
kilemensi committed Nov 20, 2024
2 parents f510ed0 + e2cbf4a commit c2a4dc6
Show file tree
Hide file tree
Showing 94 changed files with 1,192 additions and 1,013 deletions.
1 change: 0 additions & 1 deletion .github/workflows/climatemappedafrica-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ jobs:
uses: docker/build-push-action@v3
with:
build-args: |
HURUMAP_API_URL=${{ secrets.CLIMATEMAPPEDAFRICA_HURUMAP_API_URL }}
MONGO_URL=${{ secrets.CLIMATEMAPPEDAFRICA_MONGO_URL }}
NEXT_PUBLIC_APP_URL=${{ env.NEXT_PUBLIC_APP_URL }}
PAYLOAD_SECRET=${{ secrets.CLIMATEMAPPEDAFRICA_PAYLOAD_SECRET }}
Expand Down
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -387,9 +387,7 @@ ARG NEXT_TELEMETRY_DISABLED \
SENTRY_AUTH_TOKEN \
SENTRY_ENVIRONMENT \
SENTRY_ORG \
SENTRY_PROJECT \
# Custom (runtime)
HURUMAP_API_URL
SENTRY_PROJECT

# This is in app-builder instead of base-builder just incase app-deps adds deps
COPY --from=climatemappedafrica-deps /workspace/node_modules ./node_modules
Expand Down
1 change: 0 additions & 1 deletion apps/charterafrica/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
"monaco-editor": "catalog:",
"next": "catalog:",
"next-seo": "catalog:",
"nodemailer-sendgrid": "catalog:",
"payload": "catalog:",
"prop-types": "catalog:",
"qs": "catalog:",
Expand Down
31 changes: 22 additions & 9 deletions apps/charterafrica/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { spawn } from "child_process";
import { loadEnvConfig } from "@next/env";
import express from "express";
import next from "next";
import nodemailerSendgrid from "nodemailer-sendgrid";
import payload from "payload";
import { Payload } from "payload/dist/payload";

Expand All @@ -20,8 +19,17 @@ const dev = process.env.NODE_ENV !== "production";
// https://github.com/vercel/next.js/discussions/33835#discussioncomment-2559392
const hostname = process.env.NEXT_HOSTNAME || "localhost";
const port = Number.parseInt(process.env.PORT || "3000", 10);
const sendGridAPIKey = process.env.SENDGRID_API_KEY;

const smtpAuthPass = process.env.SMTP_PASS || process.env.SENDGRID_API_KEY;
const smtpFromName =
process.env.SMTP_FROM_NAME ||
process.env.SENDGRID_FROM_NAME ||
"Charter Africa CMS";
const smtpFromAddress =
process.env.SMTP_FROM_ADDRESS ||
process.env.SENDGRID_FROM_EMAIL ||
"[email protected]";
const smtpPort = Number(process.env.SMTP_PORT || 587);
// Make sure commands gracefully respect termination signals (e.g. from Docker)
// Allow the graceful termination to be manually configurable
if (!process.env.NEXT_MANUAL_SIG_HANDLE) {
Expand All @@ -35,15 +43,20 @@ const start = async (): Promise<void> => {
let localPayload: Payload;
try {
localPayload = await payload.init({
...(sendGridAPIKey
...(smtpAuthPass
? {
email: {
transportOptions: nodemailerSendgrid({
apiKey: sendGridAPIKey,
}),
fromName: process.env.SENDGRID_FROM_NAME || "Admin",
fromAddress:
process.env.SENDGRID_FROM_EMAIL || "[email protected]",
transportOptions: {
auth: {
user: process.env.SMTP_USER || "apikey",
pass: smtpAuthPass,
},
host: process.env.SMTP_HOST || "smtp.sendgrid.net",
port: smtpPort,
secure: smtpPort === 465, // true for port 465, false (the default) for 587 and others
},
fromName: smtpFromName,
fromAddress: smtpFromAddress,
},
}
: undefined),
Expand Down
10 changes: 4 additions & 6 deletions apps/civicsignalblog/src/components/ArticleGrid/ArticleGrid.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Section } from "@commons-ui/core";
import { RichTypography } from "@commons-ui/next";
import { Grid } from "@mui/material";
import { Box, Grid } from "@mui/material";
import React from "react";

import ArticleCardList from "@/civicsignalblog/components/ArticleCardList";
Expand All @@ -26,12 +26,10 @@ const ArticleGrid = React.forwardRef(function ArticleGrid(props, ref) {
return (
<Section sx={{ px: { xs: "20px", sm: 0 }, ...sx }} {...other} ref={ref}>
<Grid container sx={{ py: { xs: "28px", md: 8, lg: "105.29px" } }}>
<Grid
item
xs={12}
<Box
sx={{
order: { xs: 0, md: 1 },
display: articles?.length > 0 ? "flex" : "none",
width: "100%",
}}
>
{/* title is below featuredArticle in md and above hence needs margin-top */}
Expand Down Expand Up @@ -59,7 +57,7 @@ const ArticleGrid = React.forwardRef(function ArticleGrid(props, ref) {
mb: { xs: 2.5, md: 5 },
}}
/>
</Grid>
</Box>
{featuredArticle ? (
<Grid
item
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports[`<ArticleGrid /> renders unchanged 1`] = `
class="MuiGrid-root MuiGrid-container css-teoma9-MuiGrid-root"
>
<div
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12 css-1rk8ai9-MuiGrid-root"
class="MuiBox-root css-1xugy04"
>
<div
class="MuiStack-root css-kbcct1-MuiStack-root"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`<Articles /> renders unchanged 1`] = `
class="MuiGrid-root MuiGrid-container css-teoma9-MuiGrid-root"
>
<div
class="MuiGrid-root MuiGrid-item MuiGrid-grid-xs-12 css-1cj7j73-MuiGrid-root"
class="MuiBox-root css-1xugy04"
>
<div
class="MuiTypography-root MuiTypography-h4 css-7yxv5i-MuiTypography-root"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const FooterDescription = React.forwardRef(
</Link>
<RichText
variant="footer"
typographyProps={{
TypographyProps={{
LinkProps: {
color: "text.secondary",
sx: { textDecorationColor: "text.secondary" },
Expand Down
48 changes: 25 additions & 23 deletions apps/civicsignalblog/src/components/LongFormMedia/LongFormMedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,34 @@ const LongFormMedia = React.forwardRef((props, ref) => {
}}
ref={ref}
>
<Figure
ImageProps={{
alt: image.alt,
sx: {
objectFit: "cover",
position: "relative !important",
},
src: image.src,
}}
sx={{
height: {
xs: "200px",
md: "500px",
},
width: "100%",
}}
>
<figcaption
style={{
{image && (
<Figure
ImageProps={{
alt: image.alt,
sx: {
objectFit: "cover",
position: "relative !important",
},
src: image.src,
}}
sx={{
height: {
xs: "200px",
md: "500px",
},
width: "100%",
margin: "0 auto",
}}
>
{image.alt}
</figcaption>
</Figure>
<figcaption
style={{
width: "100%",
margin: "0 auto",
}}
>
{image.alt}
</figcaption>
</Figure>
)}
</Box>
);
});
Expand Down
4 changes: 0 additions & 4 deletions apps/civicsignalblog/src/components/NavBar/NavBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,4 @@ NavBar.propTypes = {
),
};

NavBar.defaultProps = {
menus: undefined,
};

export default NavBar;
8 changes: 0 additions & 8 deletions apps/civicsignalblog/src/components/Page/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,4 @@ Page.propTypes = {
title: PropTypes.string,
};

Page.defaultProps = {
children: undefined,
navbar: undefined,
blocks: undefined,
footer: undefined,
title: undefined,
};

export default Page;
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const PageHeader = React.forwardRef(function PageHeader(props, ref) {
{title}
</RichTypography>
<RichText
typographyProps={{
TypographyProps={{
fontWeight: "normal",
variant: "h2",
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ exports[`<PageHeader /> renders unchanged 1`] = `
</h2>
<div
class="MuiBox-root css-0"
typographyprops="[object Object]"
>
<p
class="MuiTypography-root MuiTypography-body1 css-oo170e-MuiTypography-root"
<h2
class="MuiTypography-root MuiTypography-h2 css-hd3436-MuiTypography-root"
>
Let's
<strong>
Expand All @@ -28,7 +27,7 @@ exports[`<PageHeader /> renders unchanged 1`] = `
<strong>
together
</strong>
</p>
</h2>
</div>
</div>
</div>
Expand Down
6 changes: 4 additions & 2 deletions apps/civicsignalblog/src/lib/data/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,11 +155,13 @@ function getDefaultErrorPageProps(slug = "404") {
}

export async function getPageProps(api, context) {
const { params } = context;
const { params, draftMode = false } = context;
const options = { draft: draftMode };

const slug = getPageSlug(context);
let {
docs: [page],
} = await api.findPage(slug);
} = await api.findPage(slug, options);
if (!page) {
if (["404", "500"].includes(slug)) {
return getDefaultErrorPageProps(slug);
Expand Down
5 changes: 3 additions & 2 deletions apps/civicsignalblog/src/lib/data/pagify/post.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { getPost } from "@/civicsignalblog/lib/data/utils/posts";

async function post(api, context) {
const { params } = context;
const { params, draftMode = false } = context;
const options = { draft: draftMode };
const page = params.slugs[1];
const slug = params.slugs[2];
return getPost(api, slug, page);
return getPost(api, slug, page, options);
}

export default post;
3 changes: 2 additions & 1 deletion apps/civicsignalblog/src/lib/data/utils/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ export async function getPosts(api, params, primaryTag) {
};
}

export async function getPost(api, slug, primaryTag) {
export async function getPost(api, slug, primaryTag, options) {
const { docs } = await api.getCollection("posts", {
...options,
where: {
slug: {
equals: slug,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default async function canAccessApplication(req, searchString) {
if (user) {
const app = headers["CS-App"] || user.currentApp || user.defaultApp;
return (
app.toLowerCase() === searchString.toLowerCase() &&
app?.toLowerCase() === searchString.toLowerCase() &&
user.allowedApps.includes(app)
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import applications from "#civicsignalblog/payload/lib/data/common/applications"

function CustomSelectComponent({ path, label }) {
const { user } = useAuth();
const { value, setValue } = useField({ path });
const { value, setValue } = useField<string>({ path });
const [options, setOptions] = useState([]);

useEffect(() => {
Expand All @@ -32,7 +32,7 @@ function CustomSelectComponent({ path, label }) {
path={path}
name={path}
options={options}
value={String(value)}
value={value}
onChange={(e) => setValue(e.value)}
/>
</div>
Expand Down
3 changes: 0 additions & 3 deletions apps/climatemappedafrica/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,3 @@ S3_REGION=bucket-region-us-east-1
MONGO_URL="mongodb+srv://<user>:<pass>@host/db"
PAYLOAD_PUBLIC_APP_URL="http://localhost:3000"
PAYLOAD_SECRET="secure random string"

# HURUmap
HURUMAP_API_URL="https://ng.hurumap.org/api/v1/"
Binary file not shown.
Binary file not shown.
Binary file modified apps/climatemappedafrica/public/apple-touch-icon.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 0 additions & 9 deletions apps/climatemappedafrica/public/browserconfig.xml

This file was deleted.

Binary file removed apps/climatemappedafrica/public/favicon-16x16.png
Binary file not shown.
Binary file removed apps/climatemappedafrica/public/favicon-32x32.png
Binary file not shown.
Binary file added apps/climatemappedafrica/public/favicon-96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/climatemappedafrica/public/favicon.ico
100644 → 100755
Binary file not shown.
3 changes: 3 additions & 0 deletions apps/climatemappedafrica/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/climatemappedafrica/public/image.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/climatemappedafrica/public/image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed apps/climatemappedafrica/public/mstile-150x150.png
Binary file not shown.
24 changes: 0 additions & 24 deletions apps/climatemappedafrica/public/safari-pinned-tab.svg

This file was deleted.

16 changes: 9 additions & 7 deletions apps/climatemappedafrica/public/site.webmanifest
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"name": "",
"short_name": "",
"name": "ClimateMap Africa",
"short_name": "CM A",
"icons": [
{
"src": "/android-chrome-192x192.png",
"src": "/web-app-manifest-192x192.png",
"sizes": "192x192",
"type": "image/png"
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/android-chrome-512x512.png",
"src": "/web-app-manifest-512x512.png",
"sizes": "512x512",
"type": "image/png"
"type": "image/png",
"purpose": "maskable"
}
],
"theme_color": "#ffffff",
"theme_color": "#0B2AEA",
"background_color": "#ffffff",
"display": "standalone"
}
Loading

0 comments on commit c2a4dc6

Please sign in to comment.