import type { Block } from 'payload' /** * Comparison Block * * Vergleichstabellen für Produkte, Dienstleistungen, Pläne etc. * Unterstützt verschiedene Layouts und Darstellungsformen. */ export const ComparisonBlock: Block = { slug: 'comparison', labels: { singular: 'Vergleich', plural: 'Vergleiche', }, fields: [ { name: 'title', type: 'text', label: 'Überschrift', localized: true, }, { name: 'subtitle', type: 'text', label: 'Untertitel', localized: true, }, { name: 'description', type: 'textarea', label: 'Beschreibung', localized: true, }, // Vergleichstyp { name: 'comparisonType', type: 'select', defaultValue: 'table', label: 'Vergleichs-Typ', options: [ { label: 'Tabelle', value: 'table' }, { label: 'Karten nebeneinander', value: 'cards' }, { label: 'Vorher/Nachher', value: 'before-after' }, { label: 'Pro/Contra', value: 'pros-cons' }, { label: 'Feature-Matrix', value: 'feature-matrix' }, ], }, // Tabellen-Vergleich { name: 'tbl', type: 'group', label: 'Tabellen-Vergleich', admin: { condition: (data, siblingData) => siblingData?.comparisonType === 'table' || siblingData?.comparisonType === 'feature-matrix', }, fields: [ // Spalten (Produkte/Optionen) { name: 'columns', type: 'array', label: 'Spalten (Optionen)', minRows: 2, maxRows: 6, fields: [ { name: 'name', type: 'text', required: true, label: 'Name', localized: true, }, { name: 'subtitle', type: 'text', label: 'Untertitel', localized: true, }, { name: 'image', type: 'upload', relationTo: 'media', label: 'Bild/Logo', }, { name: 'price', type: 'text', label: 'Preis', localized: true, }, { name: 'isHighlighted', type: 'checkbox', defaultValue: false, label: 'Hervorheben', }, { name: 'highlightLabel', type: 'text', label: 'Highlight-Label', localized: true, admin: { condition: (data, siblingData) => siblingData?.isHighlighted, description: 'z.B. "Empfohlen", "Bestseller"', }, }, { name: 'ctaText', type: 'text', label: 'Button-Text', localized: true, }, { name: 'ctaLink', type: 'text', label: 'Button-Link', }, ], }, // Zeilen (Features) { name: 'rows', type: 'array', label: 'Zeilen (Features)', fields: [ { name: 'feature', type: 'text', required: true, label: 'Feature', localized: true, }, { name: 'category', type: 'text', label: 'Kategorie', admin: { description: 'Für Gruppierung', }, }, { name: 'tooltip', type: 'text', label: 'Tooltip', localized: true, }, { name: 'values', type: 'array', label: 'Werte', fields: [ { name: 'columnIndex', type: 'number', label: 'Spalten-Index', admin: { description: '0 = erste Spalte', }, }, { name: 'valueType', type: 'select', defaultValue: 'text', label: 'Wert-Typ', options: [ { label: 'Text', value: 'text' }, { label: 'Ja/Nein', value: 'boolean' }, { label: 'Teilweise', value: 'partial' }, { label: 'Nicht verfügbar', value: 'na' }, ], }, { name: 'textValue', type: 'text', label: 'Text-Wert', localized: true, admin: { condition: (data, siblingData) => siblingData?.valueType === 'text', }, }, { name: 'booleanValue', type: 'checkbox', label: 'Ja/Nein', admin: { condition: (data, siblingData) => siblingData?.valueType === 'boolean', }, }, { name: 'partialNote', type: 'text', label: 'Hinweis', localized: true, admin: { condition: (data, siblingData) => siblingData?.valueType === 'partial', description: 'z.B. "Eingeschränkt", "Mit Aufpreis"', }, }, ], }, ], }, ], }, // Karten-Vergleich { name: 'crd', type: 'group', label: 'Karten-Vergleich', admin: { condition: (data, siblingData) => siblingData?.comparisonType === 'cards', }, fields: [ { name: 'items', type: 'array', label: 'Karten', minRows: 2, maxRows: 4, fields: [ { name: 'title', type: 'text', required: true, label: 'Titel', localized: true, }, { name: 'subtitle', type: 'text', label: 'Untertitel', localized: true, }, { name: 'image', type: 'upload', relationTo: 'media', label: 'Bild', }, { name: 'description', type: 'richText', label: 'Beschreibung', localized: true, }, { name: 'features', type: 'array', label: 'Features', fields: [ { name: 'text', type: 'text', required: true, localized: true, }, { name: 'included', type: 'checkbox', defaultValue: true, }, ], }, { name: 'price', type: 'text', label: 'Preis', localized: true, }, { name: 'ctaText', type: 'text', label: 'Button-Text', localized: true, }, { name: 'ctaLink', type: 'text', label: 'Button-Link', }, { name: 'isHighlighted', type: 'checkbox', defaultValue: false, label: 'Hervorheben', }, { name: 'accentColor', type: 'select', label: 'Akzentfarbe', options: [ { label: 'Standard', value: 'default' }, { label: 'Primär', value: 'primary' }, { label: 'Sekundär', value: 'secondary' }, { label: 'Grün', value: 'green' }, { label: 'Blau', value: 'blue' }, ], }, ], }, ], }, // Vorher/Nachher { name: 'beforeAfter', type: 'group', label: 'Vorher/Nachher', admin: { condition: (data, siblingData) => siblingData?.comparisonType === 'before-after', }, fields: [ { name: 'beforeLabel', type: 'text', defaultValue: 'Vorher', label: 'Vorher-Label', localized: true, }, { name: 'afterLabel', type: 'text', defaultValue: 'Nachher', label: 'Nachher-Label', localized: true, }, { name: 'items', type: 'array', label: 'Vergleiche', fields: [ { name: 'title', type: 'text', label: 'Titel', localized: true, }, { name: 'beforeImage', type: 'upload', relationTo: 'media', label: 'Vorher-Bild', }, { name: 'afterImage', type: 'upload', relationTo: 'media', label: 'Nachher-Bild', }, { name: 'beforeText', type: 'textarea', label: 'Vorher-Text', localized: true, }, { name: 'afterText', type: 'textarea', label: 'Nachher-Text', localized: true, }, ], }, { name: 'displayStyle', type: 'select', defaultValue: 'slider', label: 'Darstellung', options: [ { label: 'Slider (Schieberegler)', value: 'slider' }, { label: 'Nebeneinander', value: 'side-by-side' }, { label: 'Übereinander', value: 'stacked' }, { label: 'Flip', value: 'flip' }, ], }, ], }, // Pro/Contra { name: 'prosCons', type: 'group', label: 'Pro/Contra', admin: { condition: (data, siblingData) => siblingData?.comparisonType === 'pros-cons', }, fields: [ { name: 'prosLabel', type: 'text', defaultValue: 'Vorteile', label: 'Vorteile-Label', localized: true, }, { name: 'consLabel', type: 'text', defaultValue: 'Nachteile', label: 'Nachteile-Label', localized: true, }, { name: 'items', type: 'array', label: 'Einträge', fields: [ { name: 'title', type: 'text', label: 'Titel', localized: true, }, { name: 'image', type: 'upload', relationTo: 'media', label: 'Bild', }, { name: 'pros', type: 'array', label: 'Vorteile', fields: [ { name: 'text', type: 'text', required: true, localized: true, }, ], }, { name: 'cons', type: 'array', label: 'Nachteile', fields: [ { name: 'text', type: 'text', required: true, localized: true, }, ], }, { name: 'verdict', type: 'textarea', label: 'Fazit', localized: true, }, { name: 'rating', type: 'number', min: 0, max: 5, label: 'Bewertung (0-5)', }, ], }, ], }, // Layout-Optionen { name: 'stickyHeader', type: 'checkbox', defaultValue: true, label: 'Sticky Header', admin: { condition: (data, siblingData) => siblingData?.comparisonType === 'table' || siblingData?.comparisonType === 'feature-matrix', }, }, { name: 'showCategories', type: 'checkbox', defaultValue: true, label: 'Kategorien anzeigen', admin: { condition: (data, siblingData) => siblingData?.comparisonType === 'table' || siblingData?.comparisonType === 'feature-matrix', }, }, { name: 'collapsibleCategories', type: 'checkbox', defaultValue: false, label: 'Kategorien einklappbar', admin: { condition: (data, siblingData) => siblingData?.comparisonType === 'table' || siblingData?.comparisonType === 'feature-matrix', }, }, { name: 'showRowDividers', type: 'checkbox', defaultValue: true, label: 'Zeilen-Trennlinien', }, { name: 'highlightDifferences', type: 'checkbox', defaultValue: false, label: 'Unterschiede hervorheben', }, // Mobile { name: 'mobileView', type: 'select', defaultValue: 'scroll', label: 'Mobile-Ansicht', options: [ { label: 'Horizontal scrollen', value: 'scroll' }, { label: 'Karten gestapelt', value: 'stacked' }, { label: 'Accordion', value: 'accordion' }, { label: 'Dropdown-Auswahl', value: 'dropdown' }, ], }, // Symbole { name: 'symbols', type: 'group', label: 'Symbole', fields: [ { name: 'checkSymbol', type: 'text', defaultValue: '✓', label: 'Häkchen-Symbol', }, { name: 'crossSymbol', type: 'text', defaultValue: '✗', label: 'X-Symbol', }, { name: 'partialSymbol', type: 'text', defaultValue: '○', label: 'Teilweise-Symbol', }, ], }, // Styling { name: 'backgroundColor', type: 'select', defaultValue: 'white', label: 'Hintergrund', options: [ { label: 'Weiß', value: 'white' }, { label: 'Hell (Grau)', value: 'light' }, { label: 'Dunkel', value: 'dark' }, ], }, { name: 'tableStyle', type: 'select', defaultValue: 'bordered', label: 'Tabellen-Stil', options: [ { label: 'Umrandet', value: 'bordered' }, { label: 'Striped', value: 'striped' }, { label: 'Minimalistisch', value: 'minimal' }, { label: 'Karten', value: 'cards' }, ], admin: { condition: (data, siblingData) => siblingData?.comparisonType === 'table' || siblingData?.comparisonType === 'feature-matrix', }, }, { name: 'checkColor', type: 'select', defaultValue: 'green', label: 'Häkchen-Farbe', options: [ { label: 'Grün', value: 'green' }, { label: 'Primär', value: 'primary' }, { label: 'Blau', value: 'blue' }, ], }, { name: 'crossColor', type: 'select', defaultValue: 'red', label: 'X-Farbe', options: [ { label: 'Rot', value: 'red' }, { label: 'Grau', value: 'gray' }, { label: 'Transparent', value: 'transparent' }, ], }, ], }