"use client"; /* eslint-disable @next/next/no-img-element */ import { useMemo, useState } from "react"; import type { MediaFile } from "@/lib/admin/media"; import type { ContentDocuments, ContentKey, LinkContent, PageContent, SeoContent, ServiceContent, TextBlockContent } from "@/lib/content/types"; type Viewport = "desktop" | "tablet" | "mobile"; type ContentTabId = "home" | "services" | "radio-service" | "about" | "contact" | "footer" | "seo"; type SeoPageKey = Exclude; const tabs: Array<{ id: ContentTabId; label: string }> = [ { id: "home", label: "Startseite" }, { id: "services", label: "Leistungen" }, { id: "radio-service", label: "Funkgeräte-Service" }, { id: "about", label: "Über uns" }, { id: "contact", label: "Kontakt" }, { id: "footer", label: "Footer" }, { id: "seo", label: "SEO" }, ]; const seoPages: Array<{ key: SeoPageKey; label: string }> = [ { key: "home", label: "Startseite" }, { key: "services", label: "Leistungen" }, { key: "radio-service", label: "Funkgeräte-Service" }, { key: "repair", label: "Reparatur" }, { key: "about", label: "Über uns" }, { key: "contact", label: "Kontakt" }, ]; type Props = { initialContent: ContentDocuments; mediaFiles: MediaFile[]; }; type ApiResponse = { message?: string; content?: ContentDocuments[K]; }; function contentKeyForTab(tab: ContentTabId, seoPage: SeoPageKey): ContentKey { if (tab === "footer") return "settings"; if (tab === "seo") return seoPage; return tab; } function linesToText(lines: string[]) { return lines.join("\n"); } function textToLines(value: string) { return value.split("\n").map((line) => line.trim()).filter(Boolean); } function updateLink(link: LinkContent, field: keyof LinkContent, value: string): LinkContent { return { ...link, [field]: value }; } function TextInput({ label, value, onChange }: { label: string; value: string; onChange: (value: string) => void }) { return ( ); } function TextArea({ label, value, onChange, rows = 4 }: { label: string; value: string; rows?: number; onChange: (value: string) => void }) { return (