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

@/CivicSignalBlog - Add Ability to Manage MediaData Page #931

Merged
merged 41 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
1555c16
chore: Include SEO fields in application specific pages and post coll…
m453h Oct 2, 2024
a13a620
feat: Implement MediaData Collection
m453h Oct 2, 2024
dcc287f
feat: Implement PageHeader block for Research and WebTools Pages
m453h Oct 2, 2024
90ace97
chore: Rename common applications and allow non authenticated users t…
m453h Oct 3, 2024
c59dc96
chore: Add Document upload feature for Media Data
m453h Oct 4, 2024
d968728
feat: Add ResourceList Block to civicsignal tools pages
m453h Oct 8, 2024
9dda643
Merge branch 'main' into feat/civicsignal_webtools_media_data
m453h Oct 8, 2024
9b58733
Update apps/civicsignalblog/src/payload/blocks/WebTools/ResourceList.js
m453h Oct 8, 2024
213f029
Merge branch 'main' into feat/civicsignal_webtools_media_data
m453h Oct 10, 2024
d7da82b
Merge branch 'feat/civicsignal_webtools_media_data' of github.com:Cod…
m453h Oct 11, 2024
87182e3
feat: Add API key authentication in users collection
m453h Oct 15, 2024
3c0468c
refractor: Use shared page header and add RichText support to Researc…
m453h Oct 15, 2024
0284159
Merge branch 'main' into feat/civicsignal_webtools_media_data
m453h Oct 15, 2024
5ec8a10
chore: Update Jest snapshots after adding RichText support in PageHeader
m453h Oct 15, 2024
fcb4b65
Merge branch 'feat/civicsignal_webtools_media_data' of github.com:Cod…
m453h Oct 15, 2024
eb85cb4
chore: Merge main into feat/civicsignal_webtools_media_data
m453h Oct 16, 2024
2b1c09d
chore: Use RichText component from @commons-ui/payload
m453h Oct 16, 2024
c785453
chore: Update Jest snapshots for CMSContent and LongFormRichText
m453h Oct 16, 2024
6379219
chore: Create Subscriber role
m453h Oct 17, 2024
7452b85
feat: Add check on user allowed apps
m453h Oct 17, 2024
4694601
feat: Update app selection component to only include allowed apps
m453h Oct 18, 2024
9167015
feat: Restrict changing of default, current and allowed apps for non …
m453h Oct 18, 2024
5809930
chore: Implement access control for collections
m453h Oct 18, 2024
0e6586c
fix: Add custom x-current-app header to list of allowed headers
m453h Oct 18, 2024
b2a186c
chore: Fix formatting issues
m453h Oct 18, 2024
8642b72
Update apps/civicsignalblog/payload.config.ts
m453h Oct 18, 2024
9be202d
Update apps/civicsignalblog/src/payload/access/canAccessApplication.js
m453h Oct 18, 2024
0042654
Update apps/civicsignalblog/src/payload/collections/Main/MediaData.js
m453h Oct 18, 2024
05a8c47
chore: Improve field names in MediaData and removed unecessary ref in…
m453h Oct 18, 2024
8fb9931
feat: Implement Custom Allowed App Selection field
m453h Oct 22, 2024
279b57d
fix: Fix failed build due to missing TypeScript parser
m453h Oct 22, 2024
0d92d37
Update apps/civicsignalblog/src/payload/components/allowedAppSelect/i…
m453h Oct 23, 2024
31bfee8
chore: Add comment describing the need for typescript-eslint/parser
m453h Oct 23, 2024
999107d
chore: Fix merge conflict after merging changes from feat/civicsignal…
m453h Oct 23, 2024
412826e
Update apps/civicsignalblog/payload.config.ts
m453h Oct 23, 2024
3b7a0ea
chore: Improve handling of custom headers and clean up eslint warnings
m453h Oct 24, 2024
5cb5e49
feat: Explicitly set leaves supported by SlateEditor
m453h Oct 24, 2024
3a37f14
Merge branch 'main' into feat/civicsignal_webtools_media_data
m453h Oct 24, 2024
d4d2aea
chore: Fix merge conflicts on pnpm-lock.yaml
m453h Oct 24, 2024
1ed6712
chore: Remove typescript parser
m453h Oct 24, 2024
ee84370
Merge branch 'main' into feat/civicsignal_webtools_media_data
m453h Oct 25, 2024
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
1 change: 1 addition & 0 deletions apps/civicsignalblog/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
m453h marked this conversation as resolved.
Show resolved Hide resolved
extends: ["eslint-config-commons-ui/next"],
settings: {
"import/resolver": {
Expand Down
3 changes: 2 additions & 1 deletion apps/civicsignalblog/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"paths": {
"@/civicsignalblog/*": ["./src/*"],
"@/commons-ui/core/*": ["../../packages/commons-ui-core/src/*"],
"@/commons-ui/next/*": ["../../packages/commons-ui-next/src/*"]
"@/commons-ui/next/*": ["../../packages/commons-ui-next/src/*"],
"@/commons-ui/payload/*": ["../../packages/commons-ui-payload/src/*"]
}
},
"exclude": ["node_modules"]
Expand Down
6 changes: 5 additions & 1 deletion apps/civicsignalblog/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ const nextConfig = {
},
pageExtensions: ["page.js"],
reactStrictMode: true,
transpilePackages: ["@commons-ui/core", "@commons-ui/next"],
transpilePackages: [
"@commons-ui/core",
"@commons-ui/next",
"@commons-ui/payload",
],
webpack: (config) => {
config.module.rules.push(
{
Expand Down
1 change: 1 addition & 0 deletions apps/civicsignalblog/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@aws-sdk/lib-storage": "catalog:",
"@commons-ui/core": "workspace:*",
"@commons-ui/next": "workspace:*",
"@commons-ui/payload": "workspace:*",
"@emotion/cache": "catalog:",
"@emotion/react": "catalog:",
"@emotion/server": "catalog:",
Expand Down
20 changes: 20 additions & 0 deletions apps/civicsignalblog/payload.config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Request, Response, NextFunction } from "express";
import path from "path";

import { buildConfig } from "payload/config";
Expand All @@ -17,6 +18,7 @@ import Authors from "./src/payload/collections/Research/Authors";
import Media from "./src/payload/collections/Research/Media";
import Pages from "./src/payload/collections/Research/Pages";
import CivicSignalPages from "./src/payload/collections/Main/Pages";
import MediaData from "./src/payload/collections/Main/MediaData";
import Posts from "./src/payload/collections/Research/Posts";
import Publication from "./src/payload/globals/Publication";
import Research from "./src/payload/globals/Site/research";
Expand All @@ -37,6 +39,8 @@ const cors =
?.map((d) => d.trim())
?.filter(Boolean) ?? [];

const customHeaders: string[] = ["CS-App"];

const csrf =
process?.env?.PAYLOAD_CSRF?.split(",")
?.map((d) => d.trim())
Expand Down Expand Up @@ -67,6 +71,7 @@ export default buildConfig({
Posts,
Tags,
CivicSignalPages,
MediaData,
Users,
] as CollectionConfig[],
globals: [Publication, Research, Main] as GlobalConfig[],
Expand Down Expand Up @@ -153,4 +158,19 @@ export default buildConfig({
}),
] as any[],
telemetry: process?.env?.NODE_ENV !== "production",
// We need to add a postMiddleware function to add support for custom headers in Payload
express: {
postMiddleware: [
(_req: Request, res: Response, next: NextFunction) => {
m453h marked this conversation as resolved.
Show resolved Hide resolved
const existingHeaders =
res.getHeader("Access-Control-Allow-Headers") || "";
const additionalHeaders = customHeaders.join(", ");
m453h marked this conversation as resolved.
Show resolved Hide resolved
res.header(
"Access-Control-Allow-Headers",
`${existingHeaders}, ${additionalHeaders}`,
);
next();
},
],
},
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exports[`<CMSContent /> renders unchanged 1`] = `
>
Women make up only 22% of the people seen, heard or read about in the news in Africa, the results of the 
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineAlways MuiTypography-root MuiTypography-inherit css-1yokalx-MuiTypography-root-MuiLink-root-MuiTypography-root"
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineAlways MuiTypography-root MuiTypography-body1 css-ww82j7-MuiTypography-root-MuiLink-root-MuiTypography-root"
href="https://whomakesthenews.org/gmmp-2020-final-reports/"
rel="noreferrer noopener"
target="_blank"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* eslint-env browser */
import { Figure, Link } from "@commons-ui/next";
import { RichText } from "@commons-ui/payload";
import { Stack } from "@mui/material";
import PropTypes from "prop-types";
import React from "react";

import RichText from "@/civicsignalblog/components/RichText";

const FooterDescription = React.forwardRef(
function FooterDescription(props, ref) {
const { description, logo, sx } = props;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { RichText } from "@commons-ui/payload";
import React from "react";

import RichText from "@/civicsignalblog/components/RichText";

const LongFormRichText = React.forwardRef((props, ref) => {
const { richTextBlockFields: { content } = {} } = props;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ exports[`<LongFormRichText /> renders unchanged 1`] = `
>
Women make up only 22% of the people seen, heard or read about in the news in Africa, the results of the 
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineAlways MuiTypography-root MuiTypography-inherit css-1yokalx-MuiTypography-root-MuiLink-root-MuiTypography-root"
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineAlways MuiTypography-root MuiTypography-body1 css-ww82j7-MuiTypography-root-MuiLink-root-MuiTypography-root"
href="https://whomakesthenews.org/gmmp-2020-final-reports/"
rel="noreferrer noopener"
target="_blank"
Expand Down
11 changes: 8 additions & 3 deletions apps/civicsignalblog/src/components/PageHeader/PageHeader.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Section } from "@commons-ui/core";
import { RichTypography } from "@commons-ui/next";
import { RichText } from "@commons-ui/payload";
import React from "react";

import TwoToneBackground from "../TwoToneBackground";
Expand Down Expand Up @@ -31,9 +32,13 @@ const PageHeader = React.forwardRef(function PageHeader(props, ref) {
>
{title}
</RichTypography>
<RichTypography component="h2" variant="h2">
{subtitle}
</RichTypography>
<RichText
typographyProps={{
m453h marked this conversation as resolved.
Show resolved Hide resolved
fontWeight: "normal",
variant: "h2",
}}
elements={subtitle}
/>
</Section>
</TwoToneBackground>
);
Expand Down
19 changes: 15 additions & 4 deletions apps/civicsignalblog/src/components/PageHeader/PageHeader.snap.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,22 @@ exports[`<PageHeader /> renders unchanged 1`] = `
>
Contact
</h2>
<h2
class="MuiTypography-root MuiTypography-h2 css-1w3bpx1-MuiTypography-root"
<div
class="MuiBox-root css-0"
>
Let’s start something together!
</h2>
<h2
class="MuiTypography-root MuiTypography-h2 css-hd3436-MuiTypography-root"
>
Let's
<strong>
start
</strong>
something
<strong>
together
</strong>
</h2>
</div>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ const render = createRender({ theme });

const defaultProps = {
title: "Contact",
subtitle: "Let’s start something together!",
subtitle: [
{
children: [
{ text: "Let's", children: null },
{ children: null, bold: true, text: " start " },
{ children: null, text: "something" },
{ children: null, bold: true, text: " together" },
],
},
],
};

describe("<PageHeader />", () => {
Expand Down
114 changes: 0 additions & 114 deletions apps/civicsignalblog/src/components/RichText/RichText.js

This file was deleted.

31 changes: 0 additions & 31 deletions apps/civicsignalblog/src/components/RichText/RichText.snap.js

This file was deleted.

Loading