"use client"; import Link from "next/link"; import { useLivePreview } from "@payloadcms/live-preview-react"; import { Reveal } from "./Reveal"; import { renderPageBlockSync } from "./PageBlocks"; import { mapPayloadPage, type PayloadPage, type Page } from "../lib/payload"; const PAYLOAD_URL = process.env.NEXT_PUBLIC_PAYLOAD_URL || "https://payload.mk360.de"; // Live-previewable subset of a Pages document: breadcrumb/H1 and the // layout blocks — same "editable subset only" scope as LivePostContent.tsx // (see that file's own comment). `testimonialsRef` blocks are skipped here // (see renderPageBlockSync's own comment) since they need an async fetch a // client component can't perform inline; editing that block still shows up // once the page is saved and reloaded outside the preview iframe. export function LivePageContent({ initialPage }: { initialPage: Page }) { const { data } = useLivePreview({ initialData: initialPage as unknown as PayloadPage, serverURL: PAYLOAD_URL, depth: 2, }); const page = data?.slug ? mapPayloadPage(data) : initialPage; return ( <>

Startseite {page.title}

{page.title}

{page.layout.map(renderPageBlockSync)} ); }