import { parsePageBlocks } from "@cms/content" import Image from "next/image" type PageEntity = { title: string status: string summary: string | null content: string } type PublicPageViewProps = { page: PageEntity } export function PublicPageView({ page }: PublicPageViewProps) { const blocks = (() => { try { return parsePageBlocks(page.content) } catch { return [ { id: "fallback-rich-text", type: "rich_text" as const, body: page.content, }, ] } })() return (

{page.status}

{page.title}

{page.summary ?

{page.summary}

: null}
{blocks.map((block) => { if (block.type === "hero") { return (

{block.heading}

{block.subheading ?

{block.subheading}

: null} {block.ctaLabel && block.ctaHref ? ( {block.ctaLabel} ) : null}
) } if (block.type === "rich_text") { return (
{block.body}
) } if (block.type === "gallery") { return (
{block.title ?

{block.title}

: null}
{block.imageIds.length === 0 ? (

No media linked yet.

) : ( block.imageIds.map((imageId) => ( )) )}
) } if (block.type === "cta") { return ( {block.label} ) } if (block.type === "form") { return (

{block.title || "Form block"}

{block.description || "Form integration pending."}

formKey: {block.formKey}

) } return (
{block.title ?

{block.title}

: null}
{block.cards.map((card) => (

{card.name}

{card.price ?

{card.price}

: null} {card.description ? (

{card.description}

) : null}
))}
) })}
) }