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:
co-authored by
Claude Opus 5.5
parent
eeac33ed2f
commit
6b46bc0c14
@@ -1,26 +1,41 @@
|
||||
import type { Field, RelationshipField } from 'payload'
|
||||
|
||||
import type { AdminText } from '../admin-i18n/index.js'
|
||||
import type { PagesOption, SystemPageRole } from './types.js'
|
||||
|
||||
import { ALL_SYSTEM_PAGE_ROLES } from './types.js'
|
||||
|
||||
/** Admin-facing labels per role. */
|
||||
const ROLE_LABELS: Record<SystemPageRole, string> = {
|
||||
cookiePolicy: 'Cookie Policy',
|
||||
homepage: 'Homepage',
|
||||
notFound: '404 (Not Found)',
|
||||
privacyPolicy: 'Privacy Policy',
|
||||
termsOfService: 'Terms of Service',
|
||||
const ROLE_LABELS: Record<SystemPageRole, AdminText> = {
|
||||
cookiePolicy: { en: 'Cookie policy', pl: 'Polityka cookies' },
|
||||
homepage: { en: 'Homepage', pl: 'Strona główna' },
|
||||
notFound: { en: '404 page', pl: 'Strona 404' },
|
||||
privacyPolicy: { en: 'Privacy policy', pl: 'Polityka prywatności' },
|
||||
termsOfService: { en: 'Terms of service', pl: 'Regulamin' },
|
||||
}
|
||||
|
||||
/** Admin descriptions per role. */
|
||||
const ROLE_DESCRIPTIONS: Record<SystemPageRole, string> = {
|
||||
cookiePolicy: 'Page linked from the cookie consent banner.',
|
||||
homepage: 'Page served at the locale root (e.g. /pl, /en).',
|
||||
notFound:
|
||||
'Page shown for unknown URLs (404). Pick a dedicated "Not found" page, or reuse the homepage. If left empty, the project falls back to its built-in not-found view.',
|
||||
privacyPolicy: 'Page linked as the privacy policy.',
|
||||
termsOfService: 'Page linked as the terms of service / site regulations.',
|
||||
/**
|
||||
* Admin descriptions per role (only where the label needs one). The cookie
|
||||
* banner links the privacy policy (getConsentTexts); the cookie policy and
|
||||
* terms are linked by the project, e.g. with resolveSystemLinks in the footer.
|
||||
*/
|
||||
const ROLE_DESCRIPTIONS: Partial<Record<SystemPageRole, AdminText>> = {
|
||||
cookiePolicy: {
|
||||
en: 'Linked with the other legal pages, e.g. in the footer.',
|
||||
pl: 'Link do niej pojawia się obok innych stron prawnych, np. w stopce.',
|
||||
},
|
||||
homepage: {
|
||||
en: 'Shown at the main address of each language, e.g. /en.',
|
||||
pl: 'Wyświetlana pod głównym adresem każdego języka, np. /pl.',
|
||||
},
|
||||
notFound: {
|
||||
en: 'Shown for addresses that do not exist; leave empty to use the default.',
|
||||
pl: 'Wyświetlana pod nieistniejącymi adresami; zostaw puste, aby użyć domyślnej wartości.',
|
||||
},
|
||||
privacyPolicy: {
|
||||
en: 'Linked from the cookie banner and with the other legal pages.',
|
||||
pl: 'Link do niej pojawia się w banerze cookies i obok innych stron prawnych.',
|
||||
},
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,9 +53,7 @@ export function buildSystemPagesFields(pages: PagesOption): Field[] {
|
||||
return roles.map((role): RelationshipField => ({
|
||||
name: role,
|
||||
type: 'relationship',
|
||||
admin: {
|
||||
description: ROLE_DESCRIPTIONS[role],
|
||||
},
|
||||
...(ROLE_DESCRIPTIONS[role] ? { admin: { description: ROLE_DESCRIPTIONS[role] } } : {}),
|
||||
label: ROLE_LABELS[role],
|
||||
maxDepth: 1,
|
||||
relationTo: pages.slug,
|
||||
|
||||
Reference in New Issue
Block a user