Files
bmp-website-2026/src/collections/Pages/preistraegerIndexFields.ts
syntaxbullet d2fdf8e3c5 feat: add JuryMitglieder collection and migration for jury members
- Created a new collection `JuryMitglieder` with fields for name, image, quote, role, organization, bio, website, LinkedIn, sort order, active status, and published date.
- Implemented access control for creating, reading, updating, and deleting jury members.
- Added migration script to create necessary database tables and columns for jury members, including versioning support.
- Updated existing `preistraeger` table to include new columns for award group, winner rank, sort order, and visibility settings.
- Introduced a temporary global switch to control the visibility of testimonials in the SPA.
2026-07-07 14:57:15 +02:00

160 lines
6.1 KiB
TypeScript

import type { Field } from 'payload'
import { preistraegerIndexContent } from '@/spa/preistraegerIndexContent'
const uploadField = (name: string, label: string, description?: string): Field => ({
name,
type: 'upload',
relationTo: 'media',
label,
admin: description ? { description } : undefined,
})
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 number = (name: string, label: string, defaultValue: number, description?: string): Field => ({
name,
type: 'number',
label,
defaultValue,
min: 1,
admin: description ? { description } : undefined,
})
const ctaGroup = (name: string, label: string, labelDefault: string, urlDefault: string): Field => ({
name,
label,
type: 'group',
fields: [text('label', 'Label', labelDefault), text('url', 'URL', urlDefault)],
})
const sectionAdmin = (description: string) => ({
description,
initCollapsed: true,
})
export const preistraegerIndexFields: Field[] = [
{
name: 'preistraegerIndex',
label: 'Preisträger index page content',
type: 'group',
admin: {
description:
'Edit the Preisträger listing page chrome. Individual winner cards are managed through the Preisträger collection.',
},
fields: [
{
name: 'hero',
label: '01 · Hero image',
type: 'group',
admin: sectionAdmin('Large image above the year selector. Upload an image or keep the migrated URL fallback.'),
fields: [
uploadField('image', 'Hero image'),
text('imageUrl', 'Fallback image URL', preistraegerIndexContent.hero.imageUrl),
text('imageAlt', 'Image alt text', preistraegerIndexContent.hero.imageAlt),
],
},
{
name: 'breadcrumb',
label: '02 · Breadcrumb bar',
type: 'group',
admin: sectionAdmin('Small page label below the image.'),
fields: [text('label', 'Label', preistraegerIndexContent.breadcrumb.label)],
},
{
name: 'count',
label: '03 · Count bar',
type: 'group',
admin: sectionAdmin('Label after the selected-year result count.'),
fields: [text('label', 'Count label', preistraegerIndexContent.count.label)],
},
{
name: 'rules',
label: '04 · Gewinnerlogik',
type: 'group',
admin: sectionAdmin('Public page rules for the selected year. Winner records are still managed in the Preisträger collection.'),
fields: [
number('totalWinners', 'Gewinner gesamt', preistraegerIndexContent.rules.totalWinners, 'The public page displays at most this many winners per year.'),
number('goldeneBavariaCount', 'Goldene Bavaria Gewinner', preistraegerIndexContent.rules.goldeneBavariaCount, 'These top-ranked winners are shown in the separate Goldene Bavaria section.'),
],
},
{
name: 'empty',
label: '05 · Empty state',
type: 'group',
admin: sectionAdmin('Message when the selected year returns no winners.'),
fields: [textarea('message', 'Empty message', preistraegerIndexContent.empty.message)],
},
{
name: 'goldeneBavaria',
label: '06 · Goldene Bavaria section',
type: 'group',
admin: sectionAdmin('Copy for the separate section that highlights the best three winners.'),
fields: [
text('eyebrow', 'Eyebrow', preistraegerIndexContent.goldeneBavaria.eyebrow),
textarea('heading', 'Heading', preistraegerIndexContent.goldeneBavaria.heading),
textarea('description', 'Description', preistraegerIndexContent.goldeneBavaria.description),
textarea('emptyMessage', 'Empty message', preistraegerIndexContent.goldeneBavaria.emptyMessage),
],
},
{
name: 'winners',
label: '07 · Winners section',
type: 'group',
admin: sectionAdmin('Copy for the remaining winners below the Goldene Bavaria section.'),
fields: [
text('eyebrow', 'Eyebrow', preistraegerIndexContent.winners.eyebrow),
textarea('heading', 'Heading', preistraegerIndexContent.winners.heading),
textarea('description', 'Description', preistraegerIndexContent.winners.description),
],
},
{
name: 'card',
label: '08 · Winner cards',
type: 'group',
admin: sectionAdmin('Hover label shown on winner cards.'),
fields: [
uploadField('fallbackImage', 'Fallback card image', `Current frontend fallback image: /images/${preistraegerIndexContent.card.fallbackImageFilename}`),
text('hoverLabel', 'Hover label', preistraegerIndexContent.card.hoverLabel),
{
name: 'fallbackWinner',
label: 'Missing winner field fallbacks',
type: 'group',
fields: [
text('name', 'Name', preistraegerIndexContent.card.fallbackWinner.name),
text('category', 'Category', preistraegerIndexContent.card.fallbackWinner.category),
text('awardType', 'Award type', preistraegerIndexContent.card.fallbackWinner.awardType),
text('location', 'Location', preistraegerIndexContent.card.fallbackWinner.location),
text('industry', 'Industry', preistraegerIndexContent.card.fallbackWinner.industry),
],
},
],
},
{
name: 'cta',
label: '09 · Bottom CTA',
type: 'group',
admin: sectionAdmin('Bottom application and membership CTA.'),
fields: [
textarea('text', 'CTA text', preistraegerIndexContent.cta.text),
ctaGroup('primaryCta', 'Primary CTA', preistraegerIndexContent.cta.primaryCta.label, preistraegerIndexContent.cta.primaryCta.url),
text('secondaryPrefix', 'Secondary prefix', preistraegerIndexContent.cta.secondaryPrefix),
ctaGroup('secondaryCta', 'Secondary CTA', preistraegerIndexContent.cta.secondaryCta.label, preistraegerIndexContent.cta.secondaryCta.url),
],
},
],
},
]