From a5fb968e36c2d68ea415087dfe8af9a2b6fa3007 Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Thu, 14 Nov 2024 12:19:10 +0300 Subject: [PATCH 1/7] Update workflow Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> --- .github/workflows/climatemappedafrica-deploy-dev.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/climatemappedafrica-deploy-dev.yml b/.github/workflows/climatemappedafrica-deploy-dev.yml index 285b91405..c12755221 100644 --- a/.github/workflows/climatemappedafrica-deploy-dev.yml +++ b/.github/workflows/climatemappedafrica-deploy-dev.yml @@ -2,7 +2,7 @@ name: Climate Mapped Africa | Deploy | DEV on: push: - branches: [main] + branches: [ft/climatemapped-arm-build] paths: - "apps/climatemappedafrica/**" - "Dockerfile" @@ -33,6 +33,10 @@ jobs: with: fetch-depth: 0 + # Add support for more platforms with QEMU (optional) + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -61,6 +65,7 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new context: . + platforms: linux/arm64 target: climatemappedafrica-runner push: true tags: "${{ env.IMAGE_NAME }}:${{ github.sha }}" From 061ed659864bea7fad335b9cb4103fdf03b403a4 Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:37:23 +0300 Subject: [PATCH 2/7] Include zoom Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> --- .../src/payload/globals/HURUMap/Profile.js | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/apps/climatemappedafrica/src/payload/globals/HURUMap/Profile.js b/apps/climatemappedafrica/src/payload/globals/HURUMap/Profile.js index 3f00e390e..03bf2bd07 100644 --- a/apps/climatemappedafrica/src/payload/globals/HURUMap/Profile.js +++ b/apps/climatemappedafrica/src/payload/globals/HURUMap/Profile.js @@ -80,6 +80,42 @@ const Profile = { }, ], }, + { + name: "zoom", + type: "group", + fields: [ + { + type: "row", + fields: [ + { + name: "desktop", + label: "Zoom Level for Desktop", + type: "number", + defaultValue: 3.05, + required: true, + admin: { + description: + "Indicates how the map should appear on desktop devices", + }, + }, + { + name: "mobile", + label: "Zoom Level for Mobile", + type: "number", + required: true, + defaultValue: 2.7, + admin: { + description: + "Indicates how the map should appear on small devices", + }, + }, + ], + }, + ], + admin: { + hideGutter: true, + }, + }, { name: "hasData", type: "checkbox", From 4ad0ff2464446bdd6f8ef4858c732c6a73a3a10d Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Thu, 14 Nov 2024 14:06:44 +0300 Subject: [PATCH 3/7] Revert workflow file Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> --- .github/workflows/climatemappedafrica-deploy-dev.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/climatemappedafrica-deploy-dev.yml b/.github/workflows/climatemappedafrica-deploy-dev.yml index c12755221..285b91405 100644 --- a/.github/workflows/climatemappedafrica-deploy-dev.yml +++ b/.github/workflows/climatemappedafrica-deploy-dev.yml @@ -2,7 +2,7 @@ name: Climate Mapped Africa | Deploy | DEV on: push: - branches: [ft/climatemapped-arm-build] + branches: [main] paths: - "apps/climatemappedafrica/**" - "Dockerfile" @@ -33,10 +33,6 @@ jobs: with: fetch-depth: 0 - # Add support for more platforms with QEMU (optional) - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -65,7 +61,6 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new context: . - platforms: linux/arm64 target: climatemappedafrica-runner push: true tags: "${{ env.IMAGE_NAME }}:${{ github.sha }}" From 1eeadeef4be4e9ea714e9de38e7a8215def122be Mon Sep 17 00:00:00 2001 From: Kevin Koech Date: Thu, 14 Nov 2024 14:38:57 +0300 Subject: [PATCH 4/7] chore: Update SMTP configuration for Charter Africa CMS Update the SMTP configuration in the Charter Africa CMS server file to use the environment variables `SMTP_PASS`, `SMTP_FROM_NAME`, `SMTP_FROM_ADDRESS`, and `SMTP_PORT` for the SMTP authentication password, from name, from address, and port respectively. This ensures that the SMTP settings can be easily customized and managed. --- apps/charterafrica/package.json | 1 - apps/charterafrica/server.ts | 31 ++++++++++++++++++++++--------- pnpm-lock.yaml | 3 --- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/apps/charterafrica/package.json b/apps/charterafrica/package.json index 8f7516a0d..02a78d66b 100644 --- a/apps/charterafrica/package.json +++ b/apps/charterafrica/package.json @@ -68,7 +68,6 @@ "monaco-editor": "catalog:", "next": "catalog:", "next-seo": "catalog:", - "nodemailer-sendgrid": "catalog:", "payload": "catalog:", "prop-types": "catalog:", "qs": "catalog:", diff --git a/apps/charterafrica/server.ts b/apps/charterafrica/server.ts index c19eb1e8c..cf70c8c6a 100644 --- a/apps/charterafrica/server.ts +++ b/apps/charterafrica/server.ts @@ -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"; @@ -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 || + "noreply@codeforafrica.org"; +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) { @@ -35,15 +43,20 @@ const start = async (): Promise => { 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 || "admin@example.com", + 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), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4257f0de9..3097b61e5 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -720,9 +720,6 @@ importers: next-seo: specifier: 'catalog:' version: 6.6.0(next@14.2.16(@babel/core@7.26.0)(@opentelemetry/api@1.9.0)(@playwright/test@1.48.2)(babel-plugin-macros@3.1.0)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)(sass@1.69.4))(react-dom@18.3.1(react@18.3.1))(react@18.3.1) - nodemailer-sendgrid: - specifier: 'catalog:' - version: 1.0.3 payload: specifier: 'catalog:' version: 2.30.3(@swc/helpers@0.5.5)(@types/react@18.3.12)(encoding@0.1.13)(typescript@5.6.3)(webpack@5.96.1(@swc/core@1.8.0(@swc/helpers@0.5.5))(webpack-cli@4.10.0)) From c4635f20539b76af0a08760a30dafb4d74f82536 Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:20:24 +0300 Subject: [PATCH 5/7] Fix image path Signed-off-by: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> --- .../src/components/HURUmap/Tutorial/TutorialStep/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/index.js b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/index.js index 2e8aa2fed..1613f2e3f 100644 --- a/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/index.js +++ b/apps/climatemappedafrica/src/components/HURUmap/Tutorial/TutorialStep/index.js @@ -1,13 +1,13 @@ import { RichText } from "@commons-ui/payload"; import { Grid, Typography, IconButton, Avatar } from "@mui/material"; import { useTour } from "@reactour/tour"; -import Image from "next/legacy/image"; import PropTypes from "prop-types"; import React from "react"; import useStyles from "./useStyles"; import CloseIcon from "@/climatemappedafrica/assets/icons/close.svg"; +import Image from "@/climatemappedafrica/components/Image"; function TutorialStep({ description, title, image, selector, ...props }) { const classes = useStyles(props); From 7480f044503dd7f98a2552dfa0e6673954d468b5 Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:21:57 +0300 Subject: [PATCH 6/7] Revert "Revert workflow file" This reverts commit 4ad0ff2464446bdd6f8ef4858c732c6a73a3a10d. --- .github/workflows/climatemappedafrica-deploy-dev.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/climatemappedafrica-deploy-dev.yml b/.github/workflows/climatemappedafrica-deploy-dev.yml index 285b91405..c12755221 100644 --- a/.github/workflows/climatemappedafrica-deploy-dev.yml +++ b/.github/workflows/climatemappedafrica-deploy-dev.yml @@ -2,7 +2,7 @@ name: Climate Mapped Africa | Deploy | DEV on: push: - branches: [main] + branches: [ft/climatemapped-arm-build] paths: - "apps/climatemappedafrica/**" - "Dockerfile" @@ -33,6 +33,10 @@ jobs: with: fetch-depth: 0 + # Add support for more platforms with QEMU (optional) + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -61,6 +65,7 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new context: . + platforms: linux/arm64 target: climatemappedafrica-runner push: true tags: "${{ env.IMAGE_NAME }}:${{ github.sha }}" From 4fa0c2d191fea008de37943d4c25f9dd58ad7f39 Mon Sep 17 00:00:00 2001 From: Kipruto <43873157+kelvinkipruto@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:50:19 +0300 Subject: [PATCH 7/7] Revert workflow file --- .github/workflows/climatemappedafrica-deploy-dev.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/climatemappedafrica-deploy-dev.yml b/.github/workflows/climatemappedafrica-deploy-dev.yml index c12755221..285b91405 100644 --- a/.github/workflows/climatemappedafrica-deploy-dev.yml +++ b/.github/workflows/climatemappedafrica-deploy-dev.yml @@ -2,7 +2,7 @@ name: Climate Mapped Africa | Deploy | DEV on: push: - branches: [ft/climatemapped-arm-build] + branches: [main] paths: - "apps/climatemappedafrica/**" - "Dockerfile" @@ -33,10 +33,6 @@ jobs: with: fetch-depth: 0 - # Add support for more platforms with QEMU (optional) - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -65,7 +61,6 @@ jobs: cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new context: . - platforms: linux/arm64 target: climatemappedafrica-runner push: true tags: "${{ env.IMAGE_NAME }}:${{ github.sha }}"