diff --git a/payload.config.ts b/payload.config.ts index b0ecf23..4d180c3 100644 --- a/payload.config.ts +++ b/payload.config.ts @@ -147,7 +147,7 @@ export default buildConfig({ text: true, textarea: true, select: true, - radio: true, + radio: false, email: true, number: true, message: true, diff --git a/src/app/api/admin/seed/route.ts b/src/app/api/admin/seed/route.ts index 38f6b3d..72d5818 100644 --- a/src/app/api/admin/seed/route.ts +++ b/src/app/api/admin/seed/route.ts @@ -695,7 +695,7 @@ export async function POST(req: NextRequest) { emailTo: managerEmail, subject, emailFrom: 'noreply@shumiland.com.ua', - replyTo: '{{email}}', + replyTo: process.env['MANAGER_EMAILS']?.split(',')[0]?.trim() ?? '', message: { root: { type: 'root', @@ -767,7 +767,6 @@ export async function POST(req: NextRequest) { name: 'name', label: "Ваше ім'я", required: true, - placeholder: 'Іван Іванов', width: 50, }, { @@ -775,14 +774,12 @@ export async function POST(req: NextRequest) { name: 'phone', label: 'Телефон', required: true, - placeholder: '+38 (0__) ___-__-__', width: 50, }, { blockType: 'email', name: 'email', label: 'Email', - placeholder: 'your@email.com', width: 50, }, { @@ -790,7 +787,6 @@ export async function POST(req: NextRequest) { name: 'groupSize', label: 'Кількість учасників', required: true, - placeholder: '30', width: 50, }, { blockType: 'date', name: 'preferredDate', label: 'Бажана дата', width: 50 }, @@ -810,7 +806,6 @@ export async function POST(req: NextRequest) { blockType: 'textarea', name: 'message', label: 'Повідомлення', - placeholder: 'Додаткові побажання або запитання...', width: 100, }, ], @@ -835,7 +830,6 @@ export async function POST(req: NextRequest) { name: 'name', label: "Ваше ім'я", required: true, - placeholder: 'Іван Іванов', width: 50, }, { @@ -843,21 +837,18 @@ export async function POST(req: NextRequest) { name: 'phone', label: 'Телефон', required: true, - placeholder: '+38 (0__) ___-__-__', width: 50, }, { blockType: 'email', name: 'email', label: 'Email', - placeholder: 'your@email.com', width: 50, }, { blockType: 'number', name: 'childAge', label: 'Вік іменинника', - placeholder: '7', width: 50, }, { @@ -875,7 +866,6 @@ export async function POST(req: NextRequest) { blockType: 'number', name: 'guestCount', label: 'Кількість гостей', - placeholder: '15', width: 50, }, { @@ -889,7 +879,6 @@ export async function POST(req: NextRequest) { blockType: 'textarea', name: 'wishes', label: 'Побажання', - placeholder: 'Тема свята, улюблені герої, особливі побажання...', width: 100, }, ], diff --git a/src/components/forms/FormBlock.tsx b/src/components/forms/FormBlock.tsx index 1661437..36ec23f 100644 --- a/src/components/forms/FormBlock.tsx +++ b/src/components/forms/FormBlock.tsx @@ -4,6 +4,17 @@ import { useState, useTransition } from 'react' const FONT = 'var(--font-montserrat, Montserrat), sans-serif' +function extractLexicalText(node: unknown): string { + if (!node || typeof node !== 'object') return '' + const n = node as Record + if (n['text'] && typeof n['text'] === 'string') return n['text'] + if (Array.isArray(n['children'])) { + return (n['children'] as unknown[]).map(extractLexicalText).join(' ') + } + if (n['root']) return extractLexicalText(n['root']) + return '' +} + const INPUT_CLS = 'w-full rounded-[12px] border-2 border-white/20 bg-white/10 px-4 py-3 text-[15px] text-white placeholder-white/40 focus:border-[#f28b4a] focus:outline-none' @@ -21,7 +32,7 @@ interface FormField { placeholder?: string defaultValue?: string options?: FieldOption[] - message?: string + message?: unknown width?: number } @@ -77,6 +88,9 @@ export function FormBlock({ form, submitLabel }: FormBlockProps) { } if (success) { + const confirmText = form.confirmationMessage + ? extractLexicalText(form.confirmationMessage) + : "Менеджер зв'яжеться з вами найближчим часом." return (
@@ -84,7 +98,7 @@ export function FormBlock({ form, submitLabel }: FormBlockProps) { Заявку отримано!

- Менеджер зв'яжеться з вами найближчим часом. + {confirmText}

) @@ -102,8 +116,9 @@ export function FormBlock({ form, submitLabel }: FormBlockProps) { key={field.id ?? field.name} className="text-[14px] text-white/60 md:col-span-2" style={{ fontFamily: FONT }} - dangerouslySetInnerHTML={{ __html: field.message ?? '' }} - /> + > + {extractLexicalText(field.message)} + ) }