Shumiland/src/globals/SiteSettings.ts

49 lines
1.9 KiB
TypeScript

import type { GlobalConfig } from 'payload'
import { isAdminOrEditor } from '@/access/isAdminOrEditor'
import { revalidateGlobalAfterChange } from '@/hooks/revalidatePath'
export const SiteSettings: GlobalConfig = {
slug: 'site-settings',
label: 'Налаштування сайту',
admin: { group: 'Контент сайту', hideAPIURL: true },
access: { read: () => true, update: isAdminOrEditor },
hooks: { afterChange: [revalidateGlobalAfterChange] },
fields: [
{ name: 'ga4Id', type: 'text', label: 'Google Analytics 4 Measurement ID' },
{ name: 'binotelId', type: 'text', label: 'Binotel Widget ID' },
{ name: 'telegramChatId', type: 'text', label: 'Telegram Chat ID' },
{ name: 'resendFrom', type: 'email', label: 'Від кого (Resend)' },
{ name: 'defaultMetaTitle', type: 'text' },
{ name: 'defaultMetaDescription', type: 'textarea' },
{ name: 'defaultOgImage', type: 'upload', relationTo: 'media' },
{
name: 'tariffCategoryLabels',
type: 'array',
label: 'Назви категорій тарифів',
admin: {
description: 'Відповідність ключа з ezy API → назва для відображення на сайті',
},
fields: [
{
name: 'key',
type: 'text',
required: true,
admin: { description: 'Ключ з ezy API (напр. dyno, dyvolis, maze)' },
},
{
name: 'label',
type: 'text',
required: true,
admin: { description: 'Назва для відображення (напр. ДиноПарк)' },
},
],
defaultValue: [
{ key: 'dyno', label: 'ДиноПарк' },
{ key: 'dyvolis', label: 'Диво Ліс' },
{ key: 'maze', label: 'Дзеркальний Лабіринт' },
{ key: 'combo', label: 'Комбо' },
{ key: 'family', label: 'Сімейний' },
],
},
],
}