Skip to content

Commit

Permalink
Merge branch 'main' into fix/civicsignal_live_previews
Browse files Browse the repository at this point in the history
  • Loading branch information
m453h authored Nov 15, 2024
2 parents 50d00ed + 22519b6 commit 68747d9
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 14 deletions.
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 ||
"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) {
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 || "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),
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
36 changes: 36 additions & 0 deletions apps/climatemappedafrica/src/payload/globals/HURUMap/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 68747d9

Please sign in to comment.