Admin panel in English and Polish, reworded per docs/dev/admin-ux.md

- admin-i18n module: AdminText { en, pl }, component texts under the ipal
  namespace (project translations win), en + pl admin languages when the
  project sets none (project's supportedLanguages wins)
- every plugin label, description, option, tab and group as { en, pl };
  explicit labels instead of auto-labels; sentence case; glossary terms
- visible renames (slugs, names, data unchanged): Cookie banner, Form
  messages, Privacy group, Search engines, Maintenance, Spam protection,
  E-mail sending, stats nav link Overview (hidden without access)
- Polish visitor defaults by page locale: cookie banner, form messages,
  validators, lightbox, accessibility widget; {field} uses the label
- fixes: e-mail status banner used Turnstile wording; developer words and
  env var names out of editor messages; stats numbers/dates in the admin
  language; test e-mail no longer says ipal-kit
- test/adminUx.test.ts: length limits, en + pl present, no developer words

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-27 15:46:25 +01:00
co-authored by Claude Opus 5.5
parent eeac33ed2f
commit 6b46bc0c14
108 changed files with 2806 additions and 981 deletions
+223 -132
View File
@@ -1,163 +1,254 @@
import type { Field } from 'payload'
import { CONSENT_CATEGORIES } from '../../modules/consent/categories.js'
import { rowLabel } from '../../modules/admin-ui/index.js'
import { consentCategoryOptions } from '../../modules/consent/categoryLabels.js'
const DEFAULT_HINT = { en: 'Leave empty to use the default.', pl: 'Zostaw puste, aby użyć domyślnej wartości.' }
const HIDDEN_HINT = { en: 'Leave empty to hide it.', pl: 'Zostaw puste, aby go nie pokazywać.' }
/**
* Fields for the CookieSettings global — GDPR consent banner copy, editable
* per locale. The privacy-policy link TARGET is NOT stored here: it comes from
* the pages module (system page role 'privacyPolicy'), keeping one source of
* truth. Only the link's visible text lives here (privacyLinkLabel).
*
* The tabs are unnamed (presentation only): the data stays flat, as before.
*/
export const cookieSettingsFields: Field[] = [
{
name: 'policyVersion',
type: 'number',
admin: {
description:
'Raise by 1 when you add a tool or change the cookie policy — every visitor is asked for consent again.',
description: {
en: 'Raise by 1 after adding a tool or changing the cookie policy, and every visitor is asked for consent again.',
pl: 'Zwiększ o 1 po dodaniu narzędzia lub zmianie polityki cookies, a każdy odwiedzający zostanie ponownie zapytany o zgodę.',
},
position: 'sidebar',
step: 1,
},
defaultValue: 1,
label: { en: 'Consent version', pl: 'Wersja zgody' },
min: 1,
required: true,
},
{
name: 'eyebrow',
type: 'text',
admin: {
description: 'Small label above the banner title, e.g. "Privacy & cookies". Empty → not shown.',
},
localized: true,
},
{
name: 'title',
type: 'text',
admin: {
description: 'Banner heading, e.g. "We respect your privacy". Empty → not shown.',
},
localized: true,
},
{
name: 'message',
type: 'textarea',
admin: {
description: 'Main consent message shown in the banner.',
},
localized: true,
},
{
name: 'settingsTitle',
type: 'text',
admin: {
description: 'Heading for the detailed settings panel.',
},
localized: true,
},
{
name: 'settingsDescription',
type: 'textarea',
admin: {
description: 'Intro under the settings heading — what cookies are for and that the choice can be changed later.',
},
localized: true,
},
{
name: 'alwaysActiveLabel',
type: 'text',
admin: {
description: 'Badge next to the Necessary category, e.g. "Always active". Empty → a disabled switch/checkbox is shown instead.',
},
localized: true,
},
{
name: 'privacyLinkLabel',
type: 'text',
admin: {
description:
'Text of the privacy-policy link in the banner, e.g. "Privacy policy". The link target is the page assigned as Privacy Policy in Site Settings → System Pages. Empty → the page title is used.',
},
localized: true,
},
{
name: 'buttons',
type: 'group',
admin: {
description: 'Button labels.',
},
fields: [
{ name: 'acceptAll', type: 'text', localized: true },
{ name: 'reject', type: 'text', localized: true },
{ name: 'settings', type: 'text', localized: true },
// Not `save`: Mongoose reserves that path name and warns on every start/build.
{ name: 'savePreferences', type: 'text', label: 'Save', localized: true },
{ name: 'back', type: 'text', localized: true },
type: 'tabs',
tabs: [
{
name: 'close',
type: 'text',
admin: { description: 'Screen-reader label of the ✕ button in the settings dialog.' },
localized: true,
},
],
},
{
name: 'detailLabels',
type: 'group',
admin: {
description:
'Labels of the cookie list in the detailed settings window (CookieBanner settings="detailed"). The list itself comes from Cookies below.',
},
fields: [
{ name: 'cookies', type: 'text', admin: { description: 'Expander under each category, e.g. "Cookies used" — the count is added.' }, localized: true },
{ name: 'provider', type: 'text', localized: true },
{ name: 'purpose', type: 'text', localized: true },
{ name: 'duration', type: 'text', localized: true },
],
},
{
name: 'categories',
type: 'array',
admin: {
description: 'Per-category titles and descriptions.',
},
fields: [
{
name: 'key',
type: 'select',
options: CONSENT_CATEGORIES.map((c) => ({ label: c, value: c })),
required: true,
},
{ name: 'title', type: 'text', localized: true },
{ name: 'description', type: 'textarea', localized: true },
],
},
{
name: 'cookies',
type: 'array',
admin: {
description:
'Cookies the site uses — shown on the cookie policy page (<CookieTable>) and per category in the detailed settings window. Fill it from a scan: Cookie review → Scan cookies (cookieScanner option), or ipal-consent-check → cookie-scan.',
initCollapsed: true,
},
fields: [
{
type: 'row',
fields: [
{ name: 'name', type: 'text', admin: { width: '40%' }, required: true },
{ name: 'provider', type: 'text', admin: { description: 'e.g. Google, this site', width: '30%' } },
{
name: 'category',
type: 'select',
admin: { width: '30%' },
defaultValue: 'necessary',
options: CONSENT_CATEGORIES.map((c) => ({ label: c, value: c })),
required: true,
name: 'eyebrow',
type: 'text',
admin: { description: HIDDEN_HINT, placeholder: { en: 'Privacy & cookies', pl: 'Prywatność i cookies' } },
label: { en: 'Label above title', pl: 'Etykieta nad tytułem' },
localized: true,
},
{
name: 'title',
type: 'text',
admin: { description: HIDDEN_HINT, placeholder: { en: 'We respect your privacy', pl: 'Dbamy o prywatność' } },
label: { en: 'Title', pl: 'Tytuł' },
localized: true,
},
{
name: 'message',
type: 'textarea',
admin: { description: DEFAULT_HINT },
label: { en: 'Message', pl: 'Treść' },
localized: true,
},
{
name: 'privacyLinkLabel',
type: 'text',
admin: {
description: {
en: 'Leave empty to use the title of the privacy policy page set in Site settings.',
pl: 'Zostaw puste, aby użyć tytułu strony polityki prywatności wskazanej w ustawieniach witryny.',
},
placeholder: { en: 'Privacy policy', pl: 'Polityka prywatności' },
},
label: { en: 'Privacy link text', pl: 'Tekst linku' },
localized: true,
},
{
name: 'buttons',
type: 'group',
admin: { description: DEFAULT_HINT },
fields: [
{
type: 'row',
fields: [
{ name: 'acceptAll', type: 'text', admin: { placeholder: { en: 'Accept all', pl: 'Akceptuj wszystkie' } }, label: { en: 'Accept all', pl: 'Akceptuj wszystkie' }, localized: true },
{ name: 'reject', type: 'text', admin: { placeholder: { en: 'Reject', pl: 'Odrzuć' } }, label: { en: 'Reject', pl: 'Odrzuć' }, localized: true },
{ name: 'settings', type: 'text', admin: { placeholder: { en: 'Settings', pl: 'Ustawienia' } }, label: { en: 'Settings', pl: 'Ustawienia' }, localized: true },
],
},
{
type: 'row',
fields: [
// Not `save`: Mongoose reserves that path name and warns on every start/build.
{ name: 'savePreferences', type: 'text', admin: { placeholder: { en: 'Save preferences', pl: 'Zapisz ustawienia' } }, label: { en: 'Save', pl: 'Zapisz' }, localized: true },
{ name: 'back', type: 'text', admin: { placeholder: { en: 'Back', pl: 'Wstecz' } }, label: { en: 'Back', pl: 'Wstecz' }, localized: true },
{
name: 'close',
type: 'text',
admin: {
description: { en: 'Read aloud by screen readers for the ✕ button.', pl: 'Odczytywany przez czytniki ekranu dla przycisku ✕.' },
placeholder: { en: 'Close', pl: 'Zamknij' },
},
label: { en: 'Close', pl: 'Zamknij' },
localized: true,
},
],
},
],
label: { en: 'Buttons', pl: 'Przyciski' },
},
],
label: { en: 'Banner', pl: 'Baner' },
},
{
fields: [
{
name: 'settingsTitle',
type: 'text',
admin: { description: DEFAULT_HINT, placeholder: { en: 'Cookie settings', pl: 'Ustawienia cookies' } },
label: { en: 'Title', pl: 'Tytuł' },
localized: true,
},
{
name: 'settingsDescription',
type: 'textarea',
admin: {
description: {
en: 'What cookies are for and that the choice can be changed later, or leave empty to hide it.',
pl: 'Do czego służą cookies i że wybór można później zmienić, lub zostaw puste, aby go nie pokazywać.',
},
},
label: { en: 'Introduction', pl: 'Wstęp' },
localized: true,
},
{
name: 'alwaysActiveLabel',
type: 'text',
admin: {
description: {
en: 'Shown next to necessary cookies; leave empty to show a locked switch instead.',
pl: 'Widoczne przy niezbędnych cookies; zostaw puste, aby pokazać zablokowany przełącznik.',
},
placeholder: { en: 'Always active', pl: 'Zawsze aktywne' },
},
label: { en: 'Always active badge', pl: 'Oznaczenie „zawsze aktywne”' },
localized: true,
},
{
name: 'detailLabels',
type: 'group',
admin: {
description: {
en: 'Shown above the cookie list under each category; leave empty to use the default.',
pl: 'Widoczne nad listą cookies w każdej kategorii; zostaw puste, aby użyć domyślnej wartości.',
},
},
fields: [
{
name: 'cookies',
type: 'text',
admin: {
description: { en: 'The number of cookies is added after it.', pl: 'Po tekście dodawana jest liczba cookies.' },
placeholder: { en: 'Cookies used', pl: 'Używane cookies' },
},
label: { en: 'List toggle', pl: 'Rozwijanie listy' },
localized: true,
},
{
type: 'row',
fields: [
{ name: 'provider', type: 'text', admin: { placeholder: { en: 'Provider', pl: 'Dostawca' } }, label: { en: 'Provider', pl: 'Dostawca' }, localized: true },
{ name: 'purpose', type: 'text', admin: { placeholder: { en: 'Purpose', pl: 'Cel' } }, label: { en: 'Purpose', pl: 'Cel' }, localized: true },
{ name: 'duration', type: 'text', admin: { placeholder: { en: 'Duration', pl: 'Okres' } }, label: { en: 'Duration', pl: 'Okres' }, localized: true },
],
},
],
label: { en: 'Cookie list headings', pl: 'Nagłówki listy cookies' },
},
],
label: { en: 'Settings window', pl: 'Okno ustawień' },
},
{
fields: [
{
name: 'categories',
type: 'array',
admin: {
components: rowLabel(['title', 'key'], { en: 'Category', pl: 'Kategoria' }),
description: {
en: 'A category not listed here uses the default title and description.',
pl: 'Kategoria spoza listy używa domyślnego tytułu i opisu.',
},
},
fields: [
{
name: 'key',
type: 'select',
label: { en: 'Category', pl: 'Kategoria' },
options: consentCategoryOptions(),
required: true,
},
{ name: 'title', type: 'text', label: { en: 'Title', pl: 'Tytuł' }, localized: true },
{ name: 'description', type: 'textarea', label: { en: 'Description', pl: 'Opis' }, localized: true },
],
label: { en: 'Categories', pl: 'Kategorie' },
labels: { plural: { en: 'Categories', pl: 'Kategorie' }, singular: { en: 'Category', pl: 'Kategoria' } },
},
],
label: { en: 'Categories', pl: 'Kategorie' },
},
{
fields: [
{
name: 'cookies',
type: 'array',
admin: {
components: rowLabel(['name'], { en: 'Cookie', pl: 'Plik cookie' }),
description: {
en: 'Shown on the cookie policy page and in the settings window; fill it from Cookie review.',
pl: 'Widoczna na stronie polityki cookies i w oknie ustawień; uzupełnij ją z przeglądu cookies.',
},
initCollapsed: true,
},
fields: [
{
type: 'row',
fields: [
{ name: 'name', type: 'text', admin: { placeholder: '_ga', width: '40%' }, label: { en: 'Name', pl: 'Nazwa' }, required: true },
{ name: 'provider', type: 'text', admin: { placeholder: 'Google', width: '30%' }, label: { en: 'Provider', pl: 'Dostawca' } },
{
name: 'category',
type: 'select',
admin: { width: '30%' },
defaultValue: 'necessary',
label: { en: 'Category', pl: 'Kategoria' },
options: consentCategoryOptions(),
required: true,
},
],
},
{ name: 'purpose', type: 'textarea', label: { en: 'Purpose', pl: 'Cel' }, localized: true },
{
name: 'duration',
type: 'text',
admin: { placeholder: { en: '2 years', pl: '2 lata' } },
label: { en: 'Duration', pl: 'Okres' },
localized: true,
},
],
label: { en: 'Cookies', pl: 'Cookies' },
labels: { plural: { en: 'Cookies', pl: 'Cookies' }, singular: { en: 'Cookie', pl: 'Cookie' } },
},
],
label: { en: 'Cookie list', pl: 'Lista cookies' },
},
{ name: 'purpose', type: 'textarea', localized: true },
{ name: 'duration', type: 'text', admin: { description: 'e.g. "2 years", "session"' }, localized: true },
],
labels: { plural: 'Cookies', singular: 'Cookie' },
},
]
+2 -2
View File
@@ -15,9 +15,9 @@ export function buildCookieSettings(): GlobalConfig {
update: ({ req }) => userMeetsRole(req, 'editor'), // consent texts are legal copy — not for plain 'user' accounts
},
admin: {
group: 'Settings',
group: { en: 'Privacy', pl: 'Prywatność' },
},
fields: cookieSettingsFields,
label: 'Cookie Settings',
label: { en: 'Cookie banner', pl: 'Baner cookies' },
}
}
+72 -81
View File
@@ -1,12 +1,33 @@
import type { Field } from 'payload'
import { LIGHTBOX_FALLBACK } from '../../modules/lightbox/texts.js'
import { LIGHTBOX_FALLBACK, LIGHTBOX_FALLBACK_PL } from '../../modules/lightbox/texts.js'
import { NOTIFICATION_FALLBACK, NOTIFICATION_FALLBACK_PL } from '../../modules/notifications/defaults.js'
const EN = NOTIFICATION_FALLBACK.form
const PL = NOTIFICATION_FALLBACK_PL.form
/** A form text: the default in both languages is the placeholder. */
const formText = (
name: keyof typeof EN,
label: { en: string; pl: string },
extra: { description?: { en: string; pl: string }; width?: string } = {},
): Field => ({
name,
type: 'text',
admin: {
placeholder: { en: EN[name], pl: PL[name] },
...(extra.description ? { description: extra.description } : {}),
...(extra.width ? { width: extra.width } : {}),
},
label,
localized: true,
})
/**
* Fields for the Notifications global — localized user-facing texts for action
* results (form submission outcomes, and future contexts). Every text is
* localized: true so each language has its own value. Empty fields fall back to
* built-in English defaults (see modules/notifications/defaults).
* the built-in defaults of the page's language (see modules/notifications/defaults).
*
* Grouped per context. `form` holds the outcomes of submitForm; more groups
* (e.g. `newsletter`, `system`) can be added the same way without touching
@@ -18,91 +39,52 @@ export const notificationsFields: Field[] = [
name: 'form',
type: 'group',
admin: {
description:
'Messages shown after a form is submitted. Leave a field empty to use the built-in default.',
description: {
en: 'Shown to visitors after they send a form; leave a field empty to use the default.',
pl: 'Widoczne dla odwiedzających po wysłaniu formularza; zostaw pole puste, aby użyć domyślnej wartości.',
},
},
fields: [
{
name: 'success',
type: 'text',
admin: { placeholder: 'Thank you — your message has been sent.' },
localized: true,
},
{
name: 'error',
type: 'text',
admin: { placeholder: 'Something went wrong. Please try again later.' },
localized: true,
},
{
name: 'rateLimited',
type: 'text',
admin: { placeholder: 'Too many attempts. Please wait a moment and try again.' },
localized: true,
},
{
name: 'turnstile',
type: 'text',
admin: { placeholder: 'Captcha verification failed. Please try again.' },
localized: true,
},
{
name: 'validation',
type: 'text',
admin: {
description:
'Shown on a validation error. Use {field} to insert the offending field name.',
placeholder: 'Please check the {field} field and try again.',
formText('success', { en: 'Sent', pl: 'Wysłano' }),
formText('error', { en: 'Error', pl: 'Błąd' }),
formText('validation', { en: 'Field error', pl: 'Błąd pola' }, {
description: { en: 'Use {field} for the field label.', pl: 'Użyj {field}, aby wstawić etykietę pola.' },
}),
formText('consent', { en: 'Consent missing', pl: 'Brak zgody' }, {
description: {
en: 'Shown when the privacy policy box is not ticked.',
pl: 'Widoczny, gdy pole zgody na politykę prywatności nie jest zaznaczone.',
},
localized: true,
},
{
name: 'consent',
type: 'text',
admin: {
description: 'Shown when the GDPR consent checkbox is left unchecked.',
placeholder: 'Please accept the privacy policy to continue.',
},
localized: true,
},
{
name: 'notFound',
type: 'text',
admin: { placeholder: 'This form is no longer available.' },
localized: true,
},
}),
formText('turnstile', { en: 'Spam check failed', pl: 'Błąd weryfikacji' }),
formText('rateLimited', { en: 'Too many attempts', pl: 'Zbyt wiele prób' }),
formText('notFound', { en: 'Form unavailable', pl: 'Formularz niedostępny' }),
{
type: 'row',
fields: [
{
name: 'next',
type: 'text',
admin: { description: 'Step-by-step forms: button to the next step.', placeholder: 'Next', width: '33%' },
localized: true,
},
{
name: 'back',
type: 'text',
admin: { description: 'Step-by-step forms: button to the previous step.', placeholder: 'Back', width: '33%' },
localized: true,
},
{
name: 'stepOf',
type: 'text',
admin: { description: 'Progress — {current} and {total} are replaced.', placeholder: 'Step {current} of {total}', width: '34%' },
localized: true,
},
formText('next', { en: 'Next button', pl: 'Przycisk „Dalej”' }, { width: '33%' }),
formText('back', { en: 'Back button', pl: 'Przycisk „Wstecz”' }, { width: '33%' }),
formText('stepOf', { en: 'Step counter', pl: 'Licznik kroków' }, {
description: { en: 'Use {current} and {total} for the numbers.', pl: 'Użyj {current} i {total}, aby wstawić liczby.' },
width: '34%',
}),
],
},
],
label: 'Form messages',
label: { en: 'Forms', pl: 'Formularze' },
},
]
const lightboxText = (name: keyof typeof LIGHTBOX_FALLBACK, width: string, description?: string): Field => ({
const lightboxText = (
name: keyof typeof LIGHTBOX_FALLBACK,
label: { en: string; pl: string },
width: string,
description?: { en: string; pl: string },
): Field => ({
name,
type: 'text',
admin: { placeholder: LIGHTBOX_FALLBACK[name], width, ...(description ? { description } : {}) },
admin: { placeholder: { en: LIGHTBOX_FALLBACK[name], pl: LIGHTBOX_FALLBACK_PL[name] }, width, ...(description ? { description } : {}) },
label,
localized: true,
})
@@ -115,25 +97,34 @@ export const lightboxNotificationFields: Field = {
name: 'lightbox',
type: 'group',
admin: {
description: 'Labels of the enlarged-image viewer, read by screen readers. Leave a field empty to use the built-in default.',
description: {
en: 'Read by screen readers in the enlarged image view; leave a field empty to use the default.',
pl: 'Odczytywane przez czytniki ekranu w podglądzie zdjęcia; zostaw pole puste, aby użyć domyślnej wartości.',
},
},
fields: [
{
type: 'row',
fields: [
lightboxText('open', '50%', 'Button around a small image; its alt text follows after ": ".'),
lightboxText('dialog', '50%', 'Name of the viewer window.'),
lightboxText('open', { en: 'Enlarge button', pl: 'Przycisk powiększenia' }, '50%', {
en: 'The image description is added after it.',
pl: 'Po tekście dodawany jest opis zdjęcia.',
}),
lightboxText('dialog', { en: 'Viewer name', pl: 'Nazwa podglądu' }, '50%'),
],
},
{
type: 'row',
fields: [
lightboxText('previous', '25%'),
lightboxText('next', '25%'),
lightboxText('close', '25%'),
lightboxText('counter', '25%', '{current} and {total} are replaced.'),
lightboxText('previous', { en: 'Previous button', pl: 'Przycisk „Poprzednie”' }, '25%'),
lightboxText('next', { en: 'Next button', pl: 'Przycisk „Następne”' }, '25%'),
lightboxText('close', { en: 'Close button', pl: 'Przycisk „Zamknij”' }, '25%'),
lightboxText('counter', { en: 'Image counter', pl: 'Licznik zdjęć' }, '25%', {
en: 'Use {current} and {total} for the numbers.',
pl: 'Użyj {current} i {total}, aby wstawić liczby.',
}),
],
},
],
label: 'Lightbox',
label: { en: 'Image viewer', pl: 'Podgląd zdjęć' },
}
+3 -3
View File
@@ -4,7 +4,7 @@ import { userMeetsRole } from '../../modules/access/index.js'
import { lightboxNotificationFields, notificationsFields } from './fields.js'
/**
* Builds the Notifications global — localized action-result texts. Readable by
* Builds the Notifications global (shown as "Form messages") — localized action-result texts. Readable by
* any authenticated panel user; server-side helpers read it with overrideAccess
* so the frontend can resolve texts without a session. `lightbox` adds the
* image-viewer labels (ipalKit `lightbox: true`).
@@ -16,8 +16,8 @@ export function buildNotifications({ lightbox = false }: { lightbox?: boolean }
read: () => true, // texts are public-facing (shown to end users)
update: ({ req }) => userMeetsRole(req, 'editor'),
},
admin: { group: 'Settings' },
admin: { group: { en: 'Forms', pl: 'Formularze' } },
fields: lightbox ? [...notificationsFields, lightboxNotificationFields] : notificationsFields,
label: 'Notifications',
label: { en: 'Form messages', pl: 'Komunikaty formularzy' },
}
}
@@ -2,9 +2,11 @@
import type { TextFieldClientComponent } from 'payload'
import { FieldDescription, FieldLabel, useField } from '@payloadcms/ui'
import { FieldDescription, FieldLabel, useField, useTranslation } from '@payloadcms/ui'
import { useState } from 'react'
import { ipalT } from '../../../modules/admin-i18n/t.js'
/**
* Masked text input for sensitive values (SMTP password, R2 secret key,
* Turnstile secret key, etc.).
@@ -23,11 +25,12 @@ import { useState } from 'react'
* Assigned via a field's admin.components.Field. Works on any `text` field.
*/
export const MaskedField: TextFieldClientComponent = ({ field, path }) => {
const { t } = useTranslation()
const { setValue, value } = useField<string>({ path })
const [revealed, setRevealed] = useState(false)
const label =
typeof field?.label === 'string' ? field.label : (field?.name ?? path)
// A string or one string per language — FieldLabel / FieldDescription translate it.
const label = field?.label || field?.name || path
const description = field?.admin?.description
return (
@@ -60,11 +63,11 @@ export const MaskedField: TextFieldClientComponent = ({ field, path }) => {
}}
type="button"
>
{revealed ? 'Hide' : 'Reveal'}
{ipalT(t as never, revealed ? 'maskedHide' : 'maskedShow')}
</button>
</div>
{description && typeof description === 'string' ? (
{description && typeof description !== 'function' ? (
<FieldDescription description={description} path={path} />
) : null}
</div>
@@ -1,17 +1,21 @@
'use client'
import { useTranslation } from '@payloadcms/ui'
import { useState } from 'react'
import { ipalT } from '../../../modules/admin-i18n/t.js'
/**
* Admin UI: a small "send test email" tool for the SiteIntegrations email tab.
* Admin UI: a small "send test e-mail" tool for the SiteIntegrations e-mail tab.
* Enter an address, click Send, and it POSTs to /api/ipal/test-email, which
* sends through the currently-selected transport (SMTP or Graph). Shows the
* result inline so you can confirm delivery — or read the exact error — without
* leaving the panel.
* result inline so you can confirm delivery without leaving the panel.
*
* Assigned via a `ui` field's admin.components.Field.
* Assigned via a `ui` field's admin.components.Field. Texts: `testEmail*` keys.
*/
export const TestEmailButton = () => {
const { t } = useTranslation()
const text = (key: Parameters<typeof ipalT>[1], vars?: Record<string, unknown>) => ipalT(t as never, key, vars)
const [to, setTo] = useState('')
const [status, setStatus] = useState<
{ kind: 'error'; msg: string } | { kind: 'idle' } | { kind: 'ok'; msg: string } | { kind: 'sending' }
@@ -19,7 +23,7 @@ export const TestEmailButton = () => {
const send = async () => {
if (!to.trim()) {
setStatus({ kind: 'error', msg: 'Enter a recipient address.' })
setStatus({ kind: 'error', msg: text('testEmailInvalidRecipient') })
return
}
setStatus({ kind: 'sending' })
@@ -32,27 +36,25 @@ export const TestEmailButton = () => {
})
const data = await res.json()
if (data.ok) {
setStatus({ kind: 'ok', msg: data.message ?? 'Test email sent.' })
setStatus({ kind: 'ok', msg: data.message ?? text('testEmailSent', { to: to.trim() }) })
} else {
setStatus({ kind: 'error', msg: data.error ?? 'Send failed.' })
setStatus({ kind: 'error', msg: data.error ?? text('testEmailFailed') })
}
} catch {
setStatus({ kind: 'error', msg: 'Request failed. Is the server running?' })
setStatus({ kind: 'error', msg: text('testEmailNoConnection') })
}
}
return (
<div className="field-type" style={{ marginTop: '1rem' }}>
<label className="field-label" htmlFor="ipal-test-email-to">Send a test email</label>
<p style={{ fontSize: '.85rem', marginTop: 0, opacity: 0.7 }}>
Sends through the transport selected above. Save your changes first.
</p>
<label className="field-label" htmlFor="ipal-test-email-to">{text('testEmailLabel')}</label>
<p style={{ fontSize: '.85rem', marginTop: 0, opacity: 0.7 }}>{text('testEmailHint')}</p>
<div style={{ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '.5rem' }}>
<input
aria-label="Test email recipient"
aria-label={text('testEmailRecipient')}
id="ipal-test-email-to"
onChange={(e) => setTo(e.target.value)}
placeholder="you@example.com"
placeholder="anna@example.com"
style={{ flex: 1, minWidth: '220px' }}
type="email"
value={to}
@@ -64,7 +66,7 @@ export const TestEmailButton = () => {
style={{ whiteSpace: 'nowrap' }}
type="button"
>
{status.kind === 'sending' ? 'Sending…' : 'Send test'}
{status.kind === 'sending' ? text('testEmailSending') : text('testEmailSend')}
</button>
</div>
{status.kind === 'ok' && (
@@ -73,7 +75,7 @@ export const TestEmailButton = () => {
</p>
)}
{status.kind === 'error' && (
<p style={{ color: 'var(--theme-error-500, crimson)', marginTop: '.5rem' }}>
<p role="alert" style={{ color: 'var(--theme-error-500, crimson)', marginTop: '.5rem' }}>
✗ {status.msg}
</p>
)}
@@ -1,5 +1,7 @@
import type { Field } from 'payload'
import type { AdminText } from '../../../modules/admin-i18n/index.js'
import { validateAnalyticsId } from '../../../modules/analytics/idFormats.js'
/**
@@ -7,59 +9,61 @@ import { validateAnalyticsId } from '../../../modules/analytics/idFormats.js'
* read restriction. Google tags (GA4/GTM) use Consent Mode; the rest load only
* after the matching consent category is granted (see modules/analytics).
*/
const GOOGLE: AdminText = {
en: "Follows the visitor's choice in the cookie banner (Google Consent Mode).",
pl: 'Uwzględnia wybór odwiedzającego w banerze cookies (Google Consent Mode).',
}
const AFTER_MARKETING: AdminText = {
en: 'Loads after the visitor accepts marketing cookies.',
pl: 'Wczytuje się po zaakceptowaniu przez odwiedzającego cookies marketingowych.',
}
const AFTER_ANALYTICS: AdminText = {
en: 'Loads after the visitor accepts analytics cookies.',
pl: 'Wczytuje się po zaakceptowaniu przez odwiedzającego cookies analitycznych.',
}
export const analyticsFields: Field[] = [
{
name: 'ga4MeasurementId',
type: 'text',
admin: {
description: 'Google Analytics 4 Measurement ID. (Google — Consent Mode)',
placeholder: 'G-XXXXXXXXXX',
},
admin: { description: GOOGLE, placeholder: 'G-XXXXXXXXXX' },
label: { en: 'Google Analytics 4 ID', pl: 'ID Google Analytics 4' },
validate: validateAnalyticsId('ga4MeasurementId', 'G-XXXXXXXXXX'),
},
{
name: 'gtmContainerId',
type: 'text',
admin: {
description: 'Google Tag Manager container ID. (Google — Consent Mode)',
placeholder: 'GTM-XXXXXXX',
},
admin: { description: GOOGLE, placeholder: 'GTM-XXXXXXX' },
label: { en: 'Google Tag Manager ID', pl: 'ID Google Tag Manager' },
validate: validateAnalyticsId('gtmContainerId', 'GTM-XXXXXXX'),
},
{
name: 'metaPixelId',
type: 'text',
admin: {
description: 'Meta (Facebook) Pixel ID. Loads only after MARKETING consent.',
placeholder: '1234567890123456',
},
admin: { description: AFTER_MARKETING, placeholder: '1234567890123456' },
label: { en: 'Meta Pixel ID', pl: 'ID Meta Pixel' },
validate: validateAnalyticsId('metaPixelId', '1234567890123456'),
},
{
name: 'clarityProjectId',
type: 'text',
admin: {
description: 'Microsoft Clarity project ID (heatmaps). Loads only after ANALYTICS consent.',
placeholder: 'abcdefghij',
},
admin: { description: AFTER_ANALYTICS, placeholder: 'abcdefghij' },
label: { en: 'Microsoft Clarity ID', pl: 'ID Microsoft Clarity' },
validate: validateAnalyticsId('clarityProjectId', 'abcdefghij'),
},
{
name: 'linkedInPartnerId',
type: 'text',
admin: {
description: 'LinkedIn Insight Tag partner ID. Loads only after MARKETING consent.',
placeholder: '1234567',
},
admin: { description: AFTER_MARKETING, placeholder: '1234567' },
label: { en: 'LinkedIn Insight Tag ID', pl: 'ID LinkedIn Insight Tag' },
validate: validateAnalyticsId('linkedInPartnerId', '1234567'),
},
{
name: 'tiktokPixelId',
type: 'text',
admin: {
description: 'TikTok Pixel ID. Loads only after MARKETING consent.',
placeholder: 'CXXXXXXXXXXXXXXXXXXX',
},
admin: { description: AFTER_MARKETING, placeholder: 'CXXXXXXXXXXXXXXXXXXX' },
label: { en: 'TikTok Pixel ID', pl: 'ID TikTok Pixel' },
validate: validateAnalyticsId('tiktokPixelId', 'CXXXXXXXXXXXXXXXXXXX'),
},
]
+59 -30
View File
@@ -1,23 +1,33 @@
import type { Field } from 'payload'
import type { Condition, Field } from 'payload'
import { buildIntegrationStatusBanner, buildIntegrationStatusField } from '../../../modules/integrations/status.js'
/**
* SMTP transport settings for outbound email.
* E-mail sending settings (SMTP, or Microsoft Graph set up on the server).
*
* Protected at the global level (SiteIntegrations requires an authenticated
* user), so all fields — including the password — stay editable in the admin
* panel while remaining inaccessible to anonymous API requests.
*/
// SMTP fields only matter with the SMTP transport — hidden while Graph is selected.
const usesSmtp: Condition = (_, siblingData) => siblingData?.emailTransport !== 'graph'
export const smtpFields: Field[] = [
// Status written by mailAdapter on every send (throttled) — banner on this tab.
buildIntegrationStatusBanner('emailStatus', 'Email'),
buildIntegrationStatusBanner(
'emailStatus',
{ en: 'E-mail sending', pl: 'Wysyłka e-mail' },
{ failing: 'statusEmailFailing', hint: 'statusEmailHint' },
),
{
name: 'emailTransport',
type: 'select',
admin: {
description:
'How outbound email is sent. "Microsoft Graph" is only available when configured by the administrator (Intecion).',
description: {
en: 'Microsoft Graph works only when your administrator has set it up on the server.',
pl: 'Microsoft Graph działa tylko wtedy, gdy administrator skonfiguruje go na serwerze.',
},
// The Graph option only makes sense when agency credentials exist in env.
// We can't read process.env in the admin UI directly, so a client project
// that hasn't set up Graph should filter this option via integrationsFields
@@ -25,62 +35,81 @@ export const smtpFields: Field[] = [
// availability at send time regardless of what's selected here.
},
defaultValue: 'smtp',
label: { en: 'Sending method', pl: 'Sposób wysyłki' },
options: [
{ label: 'SMTP', value: 'smtp' },
{ label: 'Microsoft Graph (Exchange)', value: 'graph' },
{ label: { en: 'SMTP server', pl: 'Serwer SMTP' }, value: 'smtp' },
{ label: { en: 'Microsoft Graph (Exchange)', pl: 'Microsoft Graph (Exchange)' }, value: 'graph' },
],
},
{
type: 'row',
admin: {
// Hide SMTP fields when Graph is selected — they're not used then.
condition: (_, siblingData) => siblingData?.emailTransport !== 'graph',
},
fields: [
{
name: 'smtpFromAddress',
type: 'email',
admin: {
description: {
en: 'E-mails are sent from this address; with Microsoft Graph, replies go to it.',
pl: 'Z tego adresu wychodzą e-maile; przy Microsoft Graph trafiają na niego odpowiedzi.',
},
placeholder: '[email protected]',
width: '50%',
},
label: { en: 'Sender address', pl: 'Adres nadawcy' },
},
{
name: 'smtpFromName',
type: 'text',
admin: {
description: {
en: 'The name recipients see, e.g. the company name.',
pl: 'Nazwa widoczna dla odbiorcy, np. nazwa firmy.',
},
width: '50%',
},
label: { en: 'Sender name', pl: 'Nazwa nadawcy' },
},
],
},
{
type: 'row',
admin: { condition: usesSmtp },
fields: [
{
name: 'smtpHost',
type: 'text',
admin: { placeholder: 'smtp.example.com', width: '70%' },
label: { en: 'Server', pl: 'Serwer' },
},
{
name: 'smtpPort',
type: 'number',
admin: { width: '30%' },
admin: {
description: { en: 'Usually 587, or 465.', pl: 'Zwykle 587 lub 465.' },
width: '30%',
},
defaultValue: 587,
label: { en: 'Port', pl: 'Port' },
},
],
},
{
name: 'smtpUser',
type: 'text',
admin: {
description: 'SMTP account username.',
},
admin: { condition: usesSmtp },
label: { en: 'User name', pl: 'Nazwa użytkownika' },
},
{
name: 'smtpPassword',
type: 'text',
admin: {
description: 'SMTP account password.',
// Masked in the UI (••••) — stored plaintext, readable for SMTP auth.
components: {
Field: '@intecion/ipal-kit/admin#MaskedField',
},
condition: usesSmtp,
},
},
{
name: 'smtpFromAddress',
type: 'email',
admin: {
description: 'Default "from" address for outgoing mail.',
},
},
{
name: 'smtpFromName',
type: 'text',
admin: {
description: 'Default "from" display name.',
},
label: { en: 'Password', pl: 'Hasło' },
},
{
name: 'emailTest',
@@ -3,7 +3,7 @@ import type { Field } from 'payload'
import { buildIntegrationStatusBanner, buildIntegrationStatusField } from '../../../modules/integrations/status.js'
/**
* Cloudflare Turnstile credentials.
* Cloudflare Turnstile credentials (spam protection on forms).
*
* siteKey is public (rendered in the widget); secretKey is used for
* server-side verification. Both are protected at the global level
@@ -12,24 +12,36 @@ import { buildIntegrationStatusBanner, buildIntegrationStatusField } from '../..
*/
export const turnstileFields: Field[] = [
// Status written by the server when it verifies a form (checkTurnstile) — banner on this tab.
buildIntegrationStatusBanner('turnstileStatus', 'Turnstile'),
buildIntegrationStatusBanner(
'turnstileStatus',
{ en: 'Spam protection', pl: 'Ochrona przed spamem' },
{ failing: 'statusTurnstileFailing', hint: 'statusTurnstileHint' },
),
{
name: 'turnstileSiteKey',
type: 'text',
admin: {
description: 'Public site key rendered in the Turnstile widget.',
description: {
en: 'Public key of the Cloudflare Turnstile widget.',
pl: 'Klucz publiczny widżetu Cloudflare Turnstile.',
},
},
label: { en: 'Site key', pl: 'Klucz witryny' },
},
{
name: 'turnstileSecretKey',
type: 'text',
admin: {
description: 'Secret key used for server-side verification.',
// Masked in the UI (••••) — stored plaintext, readable for verification.
components: {
Field: '@intecion/ipal-kit/admin#MaskedField',
},
description: {
en: 'Private key of the same widget; fill in both keys to turn spam protection on.',
pl: 'Klucz prywatny tego samego widżetu; uzupełnij oba klucze, aby włączyć ochronę.',
},
},
label: { en: 'Secret key', pl: 'Klucz tajny' },
},
buildIntegrationStatusField('turnstileStatus'),
]
+14 -7
View File
@@ -36,18 +36,25 @@ export function buildSiteIntegrations({
update: ({ req }) => userMeetsRole(req, 'admin'),
},
admin: {
group: 'Settings',
group: { en: 'Settings', pl: 'Ustawienia' },
},
fields: [
{
type: 'tabs',
tabs: [
{ fields: analyticsFields, label: 'Analytics' },
{ fields: turnstileFields, label: 'Turnstile' },
{ fields: smtpFields, label: 'SMTP' },
{ fields: indexNowFields, label: 'IndexNow' },
{ fields: analyticsFields, label: { en: 'Analytics', pl: 'Analityka' } },
{
description: {
en: 'Cloudflare Turnstile checks that forms are sent by people, not bots.',
pl: 'Cloudflare Turnstile sprawdza, czy formularze wysyłają ludzie, a nie boty.',
},
fields: turnstileFields,
label: { en: 'Spam protection', pl: 'Ochrona przed spamem' },
},
{ fields: smtpFields, label: { en: 'E-mail sending', pl: 'Wysyłka e-mail' } },
{ fields: indexNowFields, label: { en: 'IndexNow', pl: 'IndexNow' } },
...(additionalFields?.length
? [{ fields: additionalFields, label: 'Custom' }]
? [{ fields: additionalFields, label: { en: 'More', pl: 'Więcej' } }]
: []),
],
},
@@ -68,6 +75,6 @@ export function buildSiteIntegrations({
},
],
},
label: 'Site Integrations',
label: { en: 'Site integrations', pl: 'Integracje' },
}
}
+86 -47
View File
@@ -5,14 +5,22 @@ import { validateFaviconField } from '../../../modules/seo/index.js'
/**
* General site identity fields.
* Consumed by SEO/OG (siteName, defaultShareImage) and frontend (logo).
*
* Order (admin-ux §7): what visitors see first (name, description, images),
* then the profiles list, then the title format options in one row. The row is
* presentation only — data stays flat.
*/
export const generalFields: Field[] = [
{
name: 'siteName',
type: 'text',
admin: {
description: 'Used in page titles and Open Graph metadata.',
description: {
en: 'Shown in page titles and when a link is shared.',
pl: 'Widoczna w tytułach stron i przy udostępnianiu linków.',
},
},
label: { en: 'Site name', pl: 'Nazwa witryny' },
localized: true,
required: true,
},
@@ -20,76 +28,107 @@ export const generalFields: Field[] = [
name: 'siteDescription',
type: 'textarea',
admin: {
description:
'Fallback meta description when a page has none. Also used for llms.txt and Open Graph.',
description: {
en: 'Shown in search results for pages without their own description.',
pl: 'Widoczny w wynikach wyszukiwania stron bez własnego opisu.',
},
},
label: { en: 'Site description', pl: 'Opis witryny' },
localized: true,
},
{
name: 'titleOrder',
type: 'select',
admin: {
description: 'Which comes first in browser tabs.',
},
defaultValue: 'page-first',
options: [
{ label: 'Page first — About Us | Acme', value: 'page-first' },
{ label: 'Site first — Acme | About Us', value: 'site-first' },
],
},
{
name: 'titleSeparator',
type: 'select',
admin: {
description: 'Separates the page title from the site name in browser tabs.',
},
defaultValue: '|',
options: [
{ label: 'Pipe — Page | Site', value: '|' },
{ label: 'Dash — Page – Site', value: '–' },
{ label: 'Hyphen — Page - Site', value: '-' },
{ label: 'Bullet — Page · Site', value: '·' },
{ label: 'Slash — Page / Site', value: '/' },
],
},
{
name: 'logo',
type: 'upload',
label: { en: 'Logo', pl: 'Logo' },
relationTo: 'media',
},
{
name: 'favicon',
type: 'upload',
admin: {
description: 'Primary site logo.',
description: {
en: 'Square PNG or SVG, at least 48×48 px, shown in browser tabs and search results.',
pl: 'Kwadratowy plik PNG lub SVG, co najmniej 48×48 px, widoczny na kartach przeglądarki i w wynikach wyszukiwania.',
},
},
hooks: {
// Warn the editor if the favicon is too small / not square for Google.
beforeValidate: [validateFaviconField],
},
label: { en: 'Site icon (favicon)', pl: 'Ikona witryny (favicon)' },
relationTo: 'media',
},
{
name: 'defaultShareImage',
type: 'upload',
admin: {
description: 'Fallback Open Graph image when a page has none.',
description: {
en: 'Shown when a link to a page without its own image is shared.',
pl: 'Widoczny przy udostępnianiu linku do strony bez własnego obrazu.',
},
},
label: { en: 'Share image', pl: 'Obraz udostępniania' },
relationTo: 'media',
},
{
name: 'sameAs',
type: 'array',
admin: {
description:
'Official profiles of this business (Google Business Profile, LinkedIn, Facebook, Wikipedia…). Tells search engines and AI which entity the site belongs to.',
description: {
en: 'Your business on Google, LinkedIn, Facebook and similar, so search engines and AI assistants recognise you.',
pl: 'Profile firmy w Google, LinkedIn, Facebooku itp., dzięki którym wyszukiwarki i asystenci AI rozpoznają firmę.',
},
initCollapsed: true,
},
fields: [{ name: 'url', type: 'text', required: true, validate: (v: unknown) => (typeof v === 'string' && /^https?:\/\/\S+$/.test(v)) || 'Full URL, e.g. https://www.linkedin.com/company/acme' }],
labels: { plural: 'Profiles', singular: 'Profile' },
fields: [
{
name: 'url',
type: 'text',
admin: { placeholder: 'https://www.linkedin.com/company/acme' },
label: { en: 'Address (URL)', pl: 'Adres (URL)' },
required: true,
validate: (v: unknown, { req }: { req?: { i18n?: { language?: string } } } = {}) =>
(typeof v === 'string' && /^https?:\/\/\S+$/.test(v)) ||
(req?.i18n?.language === 'pl'
? 'Wpisz pełny adres, np. https://www.linkedin.com/company/acme'
: 'Enter a full address, e.g. https://www.linkedin.com/company/acme'),
},
],
label: { en: 'Official profiles', pl: 'Oficjalne profile' },
labels: { plural: { en: 'Profiles', pl: 'Profile' }, singular: { en: 'Profile', pl: 'Profil' } },
},
{
name: 'favicon',
type: 'upload',
admin: {
description:
'Square icon, PNG or SVG, min. 48×48px (Google requires this to show it in search). Rendered via buildIconsMetadata.',
},
hooks: {
// Warn the editor if the favicon is too small / not square for Google.
beforeValidate: [validateFaviconField],
},
relationTo: 'media',
type: 'row',
fields: [
{
name: 'titleOrder',
type: 'select',
admin: {
description: {
en: 'Order of the page name and the site name in the browser tab.',
pl: 'Kolejność nazwy strony i nazwy witryny na karcie przeglądarki.',
},
},
defaultValue: 'page-first',
label: { en: 'Title order', pl: 'Kolejność w tytule' },
options: [
{ label: { en: 'Page first — About us | Acme', pl: 'Najpierw strona — O nas | Acme' }, value: 'page-first' },
{ label: { en: 'Site first — Acme | About us', pl: 'Najpierw witryna — Acme | O nas' }, value: 'site-first' },
],
},
{
name: 'titleSeparator',
type: 'select',
defaultValue: '|',
label: { en: 'Title separator', pl: 'Separator w tytule' },
options: [
{ label: { en: 'Pipe — Page | Site', pl: 'Kreska pionowa — Strona | Witryna' }, value: '|' },
{ label: { en: 'Dash — Page – Site', pl: 'Półpauza — Strona – Witryna' }, value: '–' },
{ label: { en: 'Hyphen — Page - Site', pl: 'Dywiz — Strona - Witryna' }, value: '-' },
{ label: { en: 'Bullet — Page · Site', pl: 'Kropka — Strona · Witryna' }, value: '·' },
{ label: { en: 'Slash — Page / Site', pl: 'Ukośnik — Strona / Witryna' }, value: '/' },
],
},
],
},
]
+15 -9
View File
@@ -12,32 +12,38 @@ export const themeFields: Field[] = [
name: 'defaultTheme',
type: 'select',
admin: {
description: 'Theme applied on a visitor’s first visit. System = the visitor’s device setting.',
description: {
en: 'Used on a visitor’s first visit.',
pl: 'Używany przy pierwszej wizycie.',
},
},
defaultValue: 'light',
label: { en: 'Default theme', pl: 'Domyślny motyw' },
options: [
{ label: 'Light', value: 'light' },
{ label: 'Dark', value: 'dark' },
{ label: 'System', value: 'system' },
{ label: { en: 'Light', pl: 'Jasny' }, value: 'light' },
{ label: { en: 'Dark', pl: 'Ciemny' }, value: 'dark' },
{ label: { en: 'Device setting', pl: 'Ustawienie urządzenia' }, value: 'system' },
],
required: true,
},
{
name: 'allowThemeToggle',
type: 'checkbox',
admin: {
description: 'Show a light/dark switch on the site.',
},
defaultValue: true,
label: { en: 'Show theme switch', pl: 'Pokaż przełącznik motywu' },
},
{
name: 'themeToggleLabel',
type: 'text',
admin: {
condition: (data) => Boolean(data?.allowThemeToggle),
description: 'Name of the switch read by screen readers, e.g. "Dark mode".',
description: {
en: 'Read aloud by screen readers.',
pl: 'Odczytywana przez czytniki ekranu.',
},
placeholder: { en: 'Dark mode', pl: 'Tryb ciemny' },
},
label: 'Toggle label',
label: { en: 'Switch label', pl: 'Etykieta przełącznika' },
localized: true,
},
]
+16 -14
View File
@@ -7,14 +7,14 @@ import { themeFields } from './fields/theme.js'
type BuildSiteSettingsArgs = {
/** Extra fields injected by the client project */
additionalFields?: Field[]
/** "Under construction" tab (developer tool) — given when the pages module is on. */
/** "Maintenance" tab (maintenance mode) — given when the pages module is on. */
constructionFields?: Field[]
/** "Emails" tab — given with `forms: { emailLayout: true }`. */
/** "E-mails" tab — given with `forms: { emailLayout: true }`. */
emailFields?: Field[]
/** "Search & AI" tab — search-engine verification, AI crawlers, llms.txt note (seo module). */
/** "Search engines" tab — search-engine verification, AI assistants, llms.txt note (seo module). */
searchFields?: Field[]
/**
* Fields for the "System Pages" tab — page assignments by role (homepage,
* Fields for the "System pages" tab — page assignments by role (homepage,
* privacy policy, collection archives). Assembled by the caller, which is the
* only place that knows which modules are enabled. The tab is omitted when
* this is empty.
@@ -33,7 +33,7 @@ type BuildSiteSettingsArgs = {
*
* Uses unnamed tabs — data stays flat (siteSettings.siteName, not
* siteSettings.general.siteName). Client-provided fields land in their own
* "Custom" tab so core data paths never shift.
* "More" tab so core data paths never shift. Tab labels are presentation only.
*/
export function buildSiteSettings({
additionalFields,
@@ -51,7 +51,7 @@ export function buildSiteSettings({
update: ({ req }) => userMeetsRole(req, 'editor'),
},
admin: {
group: 'Settings',
group: { en: 'Settings', pl: 'Ustawienia' },
},
fields: [
{
@@ -59,22 +59,24 @@ export function buildSiteSettings({
tabs: [
{
fields: generalFields,
label: 'General',
label: { en: 'General', pl: 'Ogólne' },
},
{
fields: themeFields,
label: 'Theme',
label: { en: 'Theme', pl: 'Motyw' },
},
...(systemPageFields?.length
? [{ fields: systemPageFields, label: 'System Pages' }]
? [{ fields: systemPageFields, label: { en: 'System pages', pl: 'Strony systemowe' } }]
: []),
...(searchFields?.length ? [{ fields: searchFields, label: 'Search & AI' }] : []),
...(emailFields?.length ? [{ fields: emailFields, label: 'Emails' }] : []),
...(constructionFields?.length ? [{ fields: constructionFields, label: 'Under construction' }] : []),
...(additionalFields?.length ? [{ fields: additionalFields, label: 'Custom' }] : []),
...(searchFields?.length ? [{ fields: searchFields, label: { en: 'Search engines', pl: 'Wyszukiwarki' } }] : []),
...(emailFields?.length ? [{ fields: emailFields, label: { en: 'E-mails', pl: 'E-maile' } }] : []),
...(constructionFields?.length
? [{ fields: constructionFields, label: { en: 'Maintenance', pl: 'Prace techniczne' } }]
: []),
...(additionalFields?.length ? [{ fields: additionalFields, label: { en: 'More', pl: 'Więcej' } }] : []),
],
},
],
label: 'Site Settings',
label: { en: 'Site settings', pl: 'Ustawienia witryny' },
}
}