211 lines
8.3 KiB
TypeScript
211 lines
8.3 KiB
TypeScript
import type { Field } from 'payload'
|
|
|
|
import { contactContent } from '@/spa/contactContent'
|
|
|
|
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 sectionAdmin = (description: string) => ({
|
|
description,
|
|
initCollapsed: true,
|
|
})
|
|
|
|
export const contactFields: Field[] = [
|
|
{
|
|
name: 'contact',
|
|
label: 'Contact page layout sections',
|
|
type: 'group',
|
|
admin: {
|
|
description:
|
|
'Edit the contact page in the same order it appears on the frontend. The generic Hero and Content tabs are hidden for this SPA-managed route.',
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'hero',
|
|
label: '01 · Hero',
|
|
type: 'group',
|
|
admin: sectionAdmin('Top image, eyebrow, headline, and intro copy.'),
|
|
fields: [
|
|
uploadField('backgroundImage', 'Background image', `Current frontend image: /images/${contactContent.hero.backgroundImageFilename}`),
|
|
text('imageAlt', 'Image alt text', contactContent.hero.imageAlt),
|
|
text('eyebrow', 'Eyebrow', contactContent.hero.eyebrow),
|
|
textarea('heading', 'Headline', contactContent.hero.heading),
|
|
textarea(
|
|
'description',
|
|
'Intro paragraph',
|
|
contactContent.hero.description,
|
|
),
|
|
],
|
|
},
|
|
{
|
|
name: 'info',
|
|
label: '02 · Direct contact and form panel',
|
|
type: 'group',
|
|
admin: sectionAdmin('Left direct-contact list plus the gold contact form panel.'),
|
|
fields: [
|
|
text('eyebrow', 'Direct contact eyebrow', contactContent.info.eyebrow),
|
|
textarea('heading', 'Direct contact heading', contactContent.info.heading),
|
|
{
|
|
name: 'items',
|
|
label: 'Contact methods',
|
|
type: 'array',
|
|
defaultValue: contactContent.info.items,
|
|
fields: [
|
|
{
|
|
name: 'icon',
|
|
label: 'Icon',
|
|
type: 'select',
|
|
defaultValue: 'mapPin',
|
|
options: [
|
|
{ label: 'Map pin', value: 'mapPin' },
|
|
{ label: 'Mail', value: 'mail' },
|
|
{ label: 'Phone', value: 'phone' },
|
|
{ label: 'Clock', value: 'clock' },
|
|
],
|
|
},
|
|
text('title', 'Title'),
|
|
textarea('lines', 'Lines'),
|
|
],
|
|
},
|
|
text('nextAwardLabel', 'Next award label', contactContent.info.nextAwardLabel),
|
|
text('nextAwardDate', 'Next award date', contactContent.info.nextAwardDate),
|
|
uploadField('formImage', 'Desktop form image', `Current frontend image: /images/${contactContent.info.formImageFilename}`),
|
|
text('formImageAlt', 'Form image alt text', contactContent.info.formImageAlt),
|
|
text('formImageLabel', 'Form image label', contactContent.info.formImageLabel),
|
|
text('formEyebrow', 'Form eyebrow', contactContent.info.formEyebrow),
|
|
text('formTitle', 'Form title', contactContent.info.formTitle),
|
|
{
|
|
name: 'formCopy',
|
|
label: 'Contact form copy',
|
|
type: 'group',
|
|
admin: sectionAdmin('Step labels, subject choices, field labels, validation messages, and success copy.'),
|
|
fields: [
|
|
{
|
|
name: 'steps',
|
|
label: 'Step labels',
|
|
type: 'array',
|
|
defaultValue: contactContent.info.formCopy.steps,
|
|
fields: [text('label', 'Label')],
|
|
},
|
|
{
|
|
name: 'subjects',
|
|
label: 'Subject choices',
|
|
type: 'array',
|
|
defaultValue: contactContent.info.formCopy.subjects,
|
|
fields: [text('value', 'Value'), text('label', 'Label'), textarea('desc', 'Description')],
|
|
},
|
|
{
|
|
name: 'prompts',
|
|
label: 'Prompts',
|
|
type: 'group',
|
|
fields: [
|
|
text('subject', 'Subject step prompt', contactContent.info.formCopy.prompts.subject),
|
|
text('contact', 'Contact step prompt', contactContent.info.formCopy.prompts.contact),
|
|
text('message', 'Message step prompt', contactContent.info.formCopy.prompts.message),
|
|
],
|
|
},
|
|
{
|
|
name: 'fields',
|
|
label: 'Fields',
|
|
type: 'group',
|
|
fields: [
|
|
text('nameLabel', 'Name label', contactContent.info.formCopy.fields.nameLabel),
|
|
text('namePlaceholder', 'Name placeholder', contactContent.info.formCopy.fields.namePlaceholder),
|
|
text('emailLabel', 'Email label', contactContent.info.formCopy.fields.emailLabel),
|
|
text('emailPlaceholder', 'Email placeholder', contactContent.info.formCopy.fields.emailPlaceholder),
|
|
text('messageLabel', 'Message label', contactContent.info.formCopy.fields.messageLabel),
|
|
text('messagePlaceholder', 'Message placeholder', contactContent.info.formCopy.fields.messagePlaceholder),
|
|
],
|
|
},
|
|
{
|
|
name: 'validation',
|
|
label: 'Validation messages',
|
|
type: 'group',
|
|
fields: [
|
|
text('nameRequired', 'Name required', contactContent.info.formCopy.validation.nameRequired),
|
|
text('emailRequired', 'Email required', contactContent.info.formCopy.validation.emailRequired),
|
|
text('emailInvalid', 'Email invalid', contactContent.info.formCopy.validation.emailInvalid),
|
|
text('messageRequired', 'Message required', contactContent.info.formCopy.validation.messageRequired),
|
|
],
|
|
},
|
|
{
|
|
name: 'navigation',
|
|
label: 'Navigation labels',
|
|
type: 'group',
|
|
fields: [
|
|
text('back', 'Back', contactContent.info.formCopy.navigation.back),
|
|
text('next', 'Next', contactContent.info.formCopy.navigation.next),
|
|
text('submit', 'Submit', contactContent.info.formCopy.navigation.submit),
|
|
],
|
|
},
|
|
{
|
|
name: 'success',
|
|
label: 'Success copy',
|
|
type: 'group',
|
|
fields: [
|
|
text('heading', 'Heading', contactContent.info.formCopy.success.heading),
|
|
text('prefix', 'Prefix', contactContent.info.formCopy.success.prefix),
|
|
text('suffixBeforeEmail', 'Suffix before email', contactContent.info.formCopy.success.suffixBeforeEmail),
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'deadlines',
|
|
label: '03 · Deadline timeline',
|
|
type: 'group',
|
|
admin: sectionAdmin('Dark 2026 timeline with three deadline columns.'),
|
|
fields: [
|
|
text('watermark', 'Large background year', contactContent.deadlines.watermark),
|
|
text('eyebrow', 'Eyebrow', contactContent.deadlines.eyebrow),
|
|
{
|
|
name: 'items',
|
|
label: 'Deadline items',
|
|
type: 'array',
|
|
defaultValue: contactContent.deadlines.items,
|
|
fields: [text('step', 'Step'), text('label', 'Label'), text('date', 'Date'), textarea('desc', 'Description')],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'faq',
|
|
label: '04 · FAQ',
|
|
type: 'group',
|
|
admin: sectionAdmin('FAQ heading and accordion entries.'),
|
|
fields: [
|
|
text('eyebrow', 'Eyebrow', contactContent.faq.eyebrow),
|
|
textarea('heading', 'Heading', contactContent.faq.heading),
|
|
{
|
|
name: 'items',
|
|
label: 'FAQ items',
|
|
type: 'array',
|
|
defaultValue: contactContent.faq.items,
|
|
fields: [textarea('q', 'Question'), textarea('a', 'Answer')],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
]
|