import Image from "next/image";
import Link from "next/link";
import type { PageBlock } from "../lib/payload";
import { getTestimonials } from "../lib/payload";
import { RichText } from "./RichText";
import { Quote } from "./Quote";
import { StepArrow } from "./StepArrow";
import { STEP_ICONS, SYMBOLIC_ICONS } from "./icons/StepIcons";
import { TestimonialsGrid } from "./TestimonialsGrid";
// Renders a Payload Pages document's `layout` blocks field — structurally
// parallel to RichText.tsx's own `blocks: {...}` converter map, but one
// level up (full page sections, not inline Lexical nodes). Each block
// component reuses the exact same visual treatment already hand-built on
// /lebensuhr, /3x3-system, and /7-tage-klarheits-check, rather than
// inventing new styling — this is what those pages' repeated patterns get
// consolidated into for CMS-driven pages going forward.
export async function PageBlocks({ blocks }: { blocks: PageBlock[] }) {
const rendered = await Promise.all(
blocks.map(async (block) => {
if (block.blockType === "testimonialsRef") {
const testimonials = await getTestimonials(block.page);
if (testimonials.length === 0) return null;
return {block.text}
;
case "icon": {
const SymbolIcon = SYMBOLIC_ICONS[block.icon];
return SymbolIcon ?
{block.caption}
}{item.text}
| {block.labelHeader} | {block.valueHeader} |
|---|---|
| {row.label} | {row.value} |
{item.title}
{item.subtitle &&{item.subtitle}
}{item.description}
{block.eyebrow}
{block.title}
{block.description &&{block.description}
}