// components/generic/CMS/BlockList.jsx import { BlockWrapper } from "./BlockWrapper"; import { TextBlock } from "./Blocks/Admin/TextBlock"; import { ImageBlock } from "./Blocks/Admin/ImageBlock"; import { TextImageBlock } from "./Blocks/Admin/TextImageBlock"; import { VideoBlock } from "./Blocks/Admin/VideoBlock"; import { TextVideoBlock } from "./Blocks/Admin/TextVideoBlock"; import { AudioBlock } from "./Blocks/Admin/AudioBlock"; import { CodeBlock } from "./Blocks/Admin/CodeBlock"; import { MarkdownBlock } from "./Blocks/Admin/MarkdownBlock"; // ─── Block renderer ─────────────────────────────────────────────────────────── // // blockId is forwarded to TextBlock (and any future rich-text blocks) so the // WYSIWYG editor knows exactly when to seed its innerHTML from saved data. function BlockContent({ block, onUpdate }) { const { id, type, content } = block; switch (type) { case "text": return ( ); case "image": return ; case "text-image": return ; case "video": return ; case "text-video": return ; case "audio": return ; case "code": return ; case "markdown": return ; default: return

Unknown block type.

; } } // ─── Default content per type ───────────────────────────────────────────────── export const DEFAULT_CONTENT = { "text": { body: "" }, "image": { asset_id: null, url: "", alt: "" }, "text-image": { body: "", asset_id: null, url: "", alt: "", image_position: "right" }, "video": { asset_id: null, url: "", thumbnail_url: "", duration_seconds: 0 }, "text-video": { body: "", asset_id: null, url: "", thumbnail_url: "", video_position: "right", duration_seconds: 0 }, "audio": { asset_id: null, url: "", title: "", artist: "", tag: "", thumbnail: "", duration_seconds: 0 }, "code": { language: "javascript", code: "" }, "markdown": { body: "" }, }; // ─── List ───────────────────────────────────────────────────────────────────── export function BlockList({ blocks, onUpdate, onMove, onDelete }) { if (!blocks.length) { return (

No blocks yet.

Use the button below to add your first block.

); } return (
{blocks.map((block, index) => ( onMove(block.id, "up")} onMoveDown={() => onMove(block.id, "down")} onDelete={() => onDelete(block.id)} > onUpdate(block.id, updated)} /> ))}
); }