82 lines
2.6 KiB
TypeScript
82 lines
2.6 KiB
TypeScript
import type { Field } from 'payload'
|
|
|
|
import { datenschutzContent } from '@/spa/datenschutzContent'
|
|
|
|
const text = (name: string, label: string, defaultValue?: string): Field => ({
|
|
name,
|
|
type: 'text',
|
|
label,
|
|
defaultValue,
|
|
})
|
|
|
|
const textarea = (name: string, label: string, defaultValue?: string): Field => ({
|
|
name,
|
|
type: 'textarea',
|
|
label,
|
|
defaultValue,
|
|
})
|
|
|
|
const sectionAdmin = (description: string) => ({
|
|
description,
|
|
initCollapsed: true,
|
|
})
|
|
|
|
export const datenschutzFields: Field[] = [
|
|
{
|
|
name: 'datenschutz',
|
|
label: 'Datenschutz page content',
|
|
type: 'group',
|
|
admin: {
|
|
description:
|
|
'Edit the Datenschutz page content. Legal section body blocks are stored as JSON so nested paragraphs, lists, notices, addresses, and subsections can keep their frontend order.',
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'hero',
|
|
label: '01 · Hero',
|
|
type: 'group',
|
|
admin: sectionAdmin('Top legal page heading and description line.'),
|
|
fields: [
|
|
text('backLabel', 'Back link label', datenschutzContent.hero.backLabel),
|
|
text('eyebrow', 'Eyebrow', datenschutzContent.hero.eyebrow),
|
|
textarea('heading', 'Heading', datenschutzContent.hero.heading),
|
|
textarea('descriptionHtml', 'Description HTML', datenschutzContent.hero.descriptionHtml),
|
|
],
|
|
},
|
|
{
|
|
name: 'navigation',
|
|
label: '02 · Side navigation',
|
|
type: 'group',
|
|
admin: sectionAdmin('Sticky table-of-contents title and related legal-page link.'),
|
|
fields: [
|
|
text('tocTitle', 'TOC title', datenschutzContent.navigation.tocTitle),
|
|
text('sideLinkLabel', 'Side link label', datenschutzContent.navigation.sideLinkLabel),
|
|
text('sideLinkUrl', 'Side link URL', datenschutzContent.navigation.sideLinkUrl),
|
|
],
|
|
},
|
|
{
|
|
name: 'sections',
|
|
label: '03 · Legal sections',
|
|
type: 'array',
|
|
dbName: 'data_sections',
|
|
admin: sectionAdmin('Each section controls one heading, table-of-contents label, and ordered JSON body blocks.'),
|
|
defaultValue: datenschutzContent.sections,
|
|
fields: [
|
|
text('id', 'Anchor ID'),
|
|
text('tocLabel', 'TOC label'),
|
|
text('title', 'Section title'),
|
|
{
|
|
name: 'items',
|
|
label: 'Content blocks JSON',
|
|
type: 'json',
|
|
admin: {
|
|
description:
|
|
'Array of blocks: paragraph, legal, address, list, or subsection. Paragraph/legal blocks use HTML strings for inline links.',
|
|
},
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
]
|