diff --git a/apps/civicsignalblog/src/components/ArticleGrid/ArticleGrid.js b/apps/civicsignalblog/src/components/ArticleGrid/ArticleGrid.js index 174bb8eb2..d4240a66a 100644 --- a/apps/civicsignalblog/src/components/ArticleGrid/ArticleGrid.js +++ b/apps/civicsignalblog/src/components/ArticleGrid/ArticleGrid.js @@ -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"; @@ -26,12 +26,10 @@ const ArticleGrid = React.forwardRef(function ArticleGrid(props, ref) { return (
- 0 ? "flex" : "none", + width: "100%", }} > {/* title is below featuredArticle in md and above hence needs margin-top */} @@ -59,7 +57,7 @@ const ArticleGrid = React.forwardRef(function ArticleGrid(props, ref) { mb: { xs: 2.5, md: 5 }, }} /> - + {featuredArticle ? ( renders unchanged 1`] = ` class="MuiGrid-root MuiGrid-container css-teoma9-MuiGrid-root" >
renders unchanged 1`] = ` class="MuiGrid-root MuiGrid-container css-teoma9-MuiGrid-root" >
{ }} ref={ref} > -
-
- {image.alt} -
-
+
+ {image.alt} +
+ + )} ); }); diff --git a/apps/civicsignalblog/src/components/NavBar/NavBar.js b/apps/civicsignalblog/src/components/NavBar/NavBar.js index 1aaec3a0a..502756b94 100644 --- a/apps/civicsignalblog/src/components/NavBar/NavBar.js +++ b/apps/civicsignalblog/src/components/NavBar/NavBar.js @@ -67,8 +67,4 @@ NavBar.propTypes = { ), }; -NavBar.defaultProps = { - menus: undefined, -}; - export default NavBar; diff --git a/apps/civicsignalblog/src/components/Page/Page.js b/apps/civicsignalblog/src/components/Page/Page.js index c8872f8b8..984f46ba1 100644 --- a/apps/civicsignalblog/src/components/Page/Page.js +++ b/apps/civicsignalblog/src/components/Page/Page.js @@ -36,12 +36,4 @@ Page.propTypes = { title: PropTypes.string, }; -Page.defaultProps = { - children: undefined, - navbar: undefined, - blocks: undefined, - footer: undefined, - title: undefined, -}; - export default Page; diff --git a/apps/civicsignalblog/src/components/PageHeader/PageHeader.js b/apps/civicsignalblog/src/components/PageHeader/PageHeader.js index c5d3e039c..c1588ae62 100644 --- a/apps/civicsignalblog/src/components/PageHeader/PageHeader.js +++ b/apps/civicsignalblog/src/components/PageHeader/PageHeader.js @@ -33,7 +33,7 @@ const PageHeader = React.forwardRef(function PageHeader(props, ref) { {title} renders unchanged 1`] = `
-

Let's @@ -28,7 +27,7 @@ exports[` renders unchanged 1`] = ` together -

+
diff --git a/apps/civicsignalblog/src/lib/data/common/index.js b/apps/civicsignalblog/src/lib/data/common/index.js index 8c9474bc5..490f629a1 100644 --- a/apps/civicsignalblog/src/lib/data/common/index.js +++ b/apps/civicsignalblog/src/lib/data/common/index.js @@ -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); diff --git a/apps/civicsignalblog/src/lib/data/pagify/post.js b/apps/civicsignalblog/src/lib/data/pagify/post.js index f8329a3ea..7c6c93583 100644 --- a/apps/civicsignalblog/src/lib/data/pagify/post.js +++ b/apps/civicsignalblog/src/lib/data/pagify/post.js @@ -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; diff --git a/apps/civicsignalblog/src/lib/data/utils/posts.js b/apps/civicsignalblog/src/lib/data/utils/posts.js index 65382fd86..ad7aeea73 100644 --- a/apps/civicsignalblog/src/lib/data/utils/posts.js +++ b/apps/civicsignalblog/src/lib/data/utils/posts.js @@ -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, diff --git a/apps/civicsignalblog/src/payload/access/canAccessApplication.js b/apps/civicsignalblog/src/payload/access/canAccessApplication.js index c191e1fef..7ee683907 100644 --- a/apps/civicsignalblog/src/payload/access/canAccessApplication.js +++ b/apps/civicsignalblog/src/payload/access/canAccessApplication.js @@ -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) ); } diff --git a/apps/civicsignalblog/src/payload/components/allowedAppSelect/index.tsx b/apps/civicsignalblog/src/payload/components/allowedAppSelect/index.tsx index 4c9dccbca..a14502595 100644 --- a/apps/civicsignalblog/src/payload/components/allowedAppSelect/index.tsx +++ b/apps/civicsignalblog/src/payload/components/allowedAppSelect/index.tsx @@ -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({ path }); const [options, setOptions] = useState([]); useEffect(() => { @@ -32,7 +32,7 @@ function CustomSelectComponent({ path, label }) { path={path} name={path} options={options} - value={String(value)} + value={value} onChange={(e) => setValue(e.value)} />
diff --git a/packages/commons-ui-payload/src/RichText/RichText.js b/packages/commons-ui-payload/src/RichText/RichText.js index 610687984..4382312df 100644 --- a/packages/commons-ui-payload/src/RichText/RichText.js +++ b/packages/commons-ui-payload/src/RichText/RichText.js @@ -48,7 +48,7 @@ const serialize = (children, props) => if (!node) { return null; } - const TypographyProps = { ...DEFAULT_PROPS, ...props.TypographyProps }; + const TypographyProps = { ...DEFAULT_PROPS, ...props?.TypographyProps }; switch (node.type) { case "h1": return (