Files
ipal-kit/src/globals/Notifications/index.ts
T
Radosław SmolińskiandClaude Opus 5.5 6b46bc0c14 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]>
2026-10-27 15:46:25 +01:00

24 lines
1.0 KiB
TypeScript

import type { GlobalConfig } from 'payload'
import { userMeetsRole } from '../../modules/access/index.js'
import { lightboxNotificationFields, notificationsFields } from './fields.js'
/**
* 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`).
*/
export function buildNotifications({ lightbox = false }: { lightbox?: boolean } = {}): GlobalConfig {
return {
slug: 'notifications',
access: {
read: () => true, // texts are public-facing (shown to end users)
update: ({ req }) => userMeetsRole(req, 'editor'),
},
admin: { group: { en: 'Forms', pl: 'Formularze' } },
fields: lightbox ? [...notificationsFields, lightboxNotificationFields] : notificationsFields,
label: { en: 'Form messages', pl: 'Komunikaty formularzy' },
}
}