diff --git a/src/site/SiteApp.tsx b/src/site/SiteApp.tsx index 22ce54c..8107375 100644 --- a/src/site/SiteApp.tsx +++ b/src/site/SiteApp.tsx @@ -163,11 +163,11 @@ export default function SiteApp({ pageId = 'p1', articleSlug, previewContent, su {mounts['mobile-sdk-demo-mount'] && createPortal(, mounts['mobile-sdk-demo-mount'])} - {mounts['news-grid-mount'] && createPortal(, mounts['news-grid-mount'])} + {mounts['news-grid-mount'] && createPortal(, mounts['news-grid-mount'])} {mounts['home-news-mount'] && createPortal( - , + , mounts['home-news-mount'], )} @@ -190,7 +190,10 @@ export default function SiteApp({ pageId = 'p1', articleSlug, previewContent, su {articleSlug && mounts['pg-article'] && - createPortal(, mounts['pg-article'])} + createPortal( + , + mounts['pg-article'], + )} ) } diff --git a/src/site/blog/ArticlePage.tsx b/src/site/blog/ArticlePage.tsx index 6b1688c..b815624 100644 --- a/src/site/blog/ArticlePage.tsx +++ b/src/site/blog/ArticlePage.tsx @@ -3,15 +3,25 @@ import { useNavigate } from 'react-router-dom' import { formatPostDate, publishedPosts, useContent } from '../../cms/store' import { applyJsonLd, applyMeta, articleJsonLd } from '../../cms/seo' import { categoryMeta, splitAuthor } from './NewsGrid' -import type { Post } from '../../cms/types' +import type { Post, SiteContent } from '../../cms/types' /** * A single article at /blog/. Rendered into the #pg-article container inside * the site markup, so it inherits the real nav, footer and enquiry modal — and the * white-section rule that makes the body copy readable. */ -export default function ArticlePage({ slug, suppressMeta = false }: { slug: string; suppressMeta?: boolean }) { - const content = useContent() +export default function ArticlePage({ + slug, + suppressMeta = false, + content: contentProp, +}: { + slug: string + suppressMeta?: boolean + /** Admin preview: use the editor's draft rather than the published context. */ + content?: SiteContent +}) { + const publishedContent = useContent() + const content = contentProp || publishedContent const navigate = useNavigate() // Drafts are reachable by direct link so they can be reviewed before going live, diff --git a/src/site/blog/NewsGrid.tsx b/src/site/blog/NewsGrid.tsx index 192c600..fea7d69 100644 --- a/src/site/blog/NewsGrid.tsx +++ b/src/site/blog/NewsGrid.tsx @@ -1,6 +1,6 @@ import { useMemo, useState } from 'react' import { useNavigate } from 'react-router-dom' -import { POST_CATEGORIES, type Post, type PostCategory } from '../../cms/types' +import { POST_CATEGORIES, type Post, type PostCategory, type SiteContent } from '../../cms/types' import { formatPostDate, publishedPosts, useContent } from '../../cms/store' export const categoryMeta = (id: string) => POST_CATEGORIES.find((c) => c.id === id) || POST_CATEGORIES[0] @@ -48,8 +48,20 @@ function Card({ post, onOpen }: { post: Post; onOpen: (post: Post) => void }) { * The newsroom grid (/news) and the home page's latest-three strip. Both read the * same CMS post library, so publishing an article puts it everywhere it belongs. */ -export default function NewsGrid({ limit, showFilters = true, heading }: { limit?: number; showFilters?: boolean; heading?: string }) { - const content = useContent() +export default function NewsGrid({ + limit, + showFilters = true, + heading, + content: contentProp, +}: { + limit?: number + showFilters?: boolean + heading?: string + /** Admin preview: use the editor's draft rather than the published context. */ + content?: SiteContent +}) { + const publishedContent = useContent() + const content = contentProp || publishedContent const navigate = useNavigate() const [filter, setFilter] = useState('all')