teqo-backup/src/globals/SiteSettings.ts
Francisco Ignácio Fontoura Solla 56f2d48d8d feat(payload): add pt-BR admin/frontend copy and site settings social links
- add  global and cached global fetch utility
- add , , and  components driven by global settings
- wire global registration in Payload config
- enable Payload admin i18n with Portuguese () language pack
- translate frontend metadata/homepage/custom route copy to pt-BR
- translate collection/global labels, descriptions, and validation messages
- improve social-link a11y with Portuguese fallback labels and external-link icon
- update francisco.solla and  admin labels/groups for Portuguese UX
- regenerate  for new global/schema changes
2026-02-15 01:17:26 -03:00

80 lines
2 KiB
TypeScript

import { revalidateTag } from 'next/cache'
import type { GlobalConfig } from 'payload'
const revalidate = async () => revalidateTag('global_site-settings')
export const SiteSettings: GlobalConfig = {
slug: 'site-settings',
label: 'Configurações do site',
admin: {
group: 'Configurações',
},
access: {
read: () => true,
update: ({ req: { user } }) => Boolean(user),
},
fields: [
{
name: 'headerTitle',
type: 'text',
label: 'Título do cabeçalho',
},
{
name: 'socialLinks',
type: 'array',
label: 'Redes sociais',
labels: {
singular: 'Rede social',
plural: 'Redes sociais',
},
fields: [
{
name: 'platform',
type: 'select',
label: 'Plataforma',
required: true,
options: [
{ label: 'Instagram', value: 'instagram' },
{ label: 'Facebook', value: 'facebook' },
{ label: 'YouTube', value: 'youtube' },
],
},
{
name: 'url',
type: 'text',
label: 'URL',
required: true,
validate: (value: string | null | undefined) => {
if (!value) return 'A URL é obrigatória'
try {
const parsed = new URL(value)
if (!['http:', 'https:'].includes(parsed.protocol)) {
return 'A URL deve começar com http:// ou https://'
}
return true
} catch {
return 'Informe uma URL válida'
}
},
},
{
name: 'label',
type: 'text',
label: 'Rótulo de acessibilidade',
admin: {
description:
'Rótulo opcional para acessibilidade. Se estiver vazio, usamos um rótulo padrão da plataforma.',
},
},
{
name: 'enabled',
type: 'checkbox',
label: 'Ativo',
},
],
},
],
hooks: {
afterChange: [revalidate],
},
}