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,5 +1,7 @@
|
||||
import type { Field, GroupField } from 'payload'
|
||||
|
||||
import type { AdminText } from '../admin-i18n/define.js'
|
||||
|
||||
/**
|
||||
* The two field groups every section block shares — same panel, same data
|
||||
* shape in every project, so the shared <Section>/<SectionHeader> components
|
||||
@@ -24,12 +26,13 @@ export function buildSectionHeaderField({ name = 'header', fields = [], interfac
|
||||
name,
|
||||
type: 'group',
|
||||
fields: [
|
||||
{ name: 'eyebrow', type: 'text', admin: { description: 'Small line above the heading. Optional.' }, localized: true },
|
||||
{ name: 'heading', type: 'text', localized: true },
|
||||
{ name: 'intro', type: 'textarea', admin: { rows: 3 }, localized: true },
|
||||
{ name: 'eyebrow', type: 'text', label: { en: 'Line above heading', pl: 'Tekst nad nagłówkiem' }, localized: true },
|
||||
{ name: 'heading', type: 'text', label: { en: 'Heading', pl: 'Nagłówek' }, localized: true },
|
||||
{ name: 'intro', type: 'textarea', admin: { rows: 3 }, label: { en: 'Introduction', pl: 'Wstęp' }, localized: true },
|
||||
...fields,
|
||||
],
|
||||
interfaceName,
|
||||
label: { en: 'Section header', pl: 'Nagłówek sekcji' },
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,9 +41,9 @@ export type SectionSettingsFieldOptions = {
|
||||
anchor?: boolean
|
||||
/**
|
||||
* Background choices — values map to the project's own classes in <Section>.
|
||||
* Default Default / Muted / Inverted (dark). `false` → no background select.
|
||||
* Default Default / Muted / Dark (value `inverted`). `false` → no background select.
|
||||
*/
|
||||
backgrounds?: { label: string; value: string }[] | false
|
||||
backgrounds?: { label: AdminText | string; value: string }[] | false
|
||||
/** Extra settings (e.g. spacing, width). */
|
||||
fields?: Field[]
|
||||
/** Generated TS type name. Default 'SectionSettings'. */
|
||||
@@ -50,9 +53,9 @@ export type SectionSettingsFieldOptions = {
|
||||
}
|
||||
|
||||
const DEFAULT_BACKGROUNDS = [
|
||||
{ label: 'Default', value: 'default' },
|
||||
{ label: 'Muted', value: 'muted' },
|
||||
{ label: 'Inverted (dark)', value: 'inverted' },
|
||||
{ label: { en: 'Default', pl: 'Domyślne' }, value: 'default' },
|
||||
{ label: { en: 'Muted', pl: 'Stonowane' }, value: 'muted' },
|
||||
{ label: { en: 'Dark', pl: 'Ciemne' }, value: 'inverted' },
|
||||
]
|
||||
|
||||
/** Sidebar group: anchor + background (+ your own) — instead of bgColor / sectionId per block. */
|
||||
@@ -69,14 +72,34 @@ export function buildSectionSettingsField({
|
||||
admin: { position: 'sidebar' },
|
||||
fields: [
|
||||
...(anchor
|
||||
? [{ name: 'anchor', type: 'text', admin: { description: 'Section id for #links and section nav, e.g. "pricing".' } } as Field]
|
||||
? [
|
||||
{
|
||||
name: 'anchor',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: {
|
||||
en: 'Lets links jump to this section, e.g. pricing for #pricing.',
|
||||
pl: 'Pozwala linkom przejść do tej sekcji, np. cennik dla #cennik.',
|
||||
},
|
||||
},
|
||||
label: { en: 'Anchor', pl: 'Kotwica' },
|
||||
} as Field,
|
||||
]
|
||||
: []),
|
||||
...(backgrounds && backgrounds.length
|
||||
? [{ name: 'background', type: 'select', defaultValue: backgrounds[0].value, options: backgrounds } as Field]
|
||||
? [
|
||||
{
|
||||
name: 'background',
|
||||
type: 'select',
|
||||
defaultValue: backgrounds[0].value,
|
||||
label: { en: 'Background', pl: 'Tło' },
|
||||
options: backgrounds,
|
||||
} as Field,
|
||||
]
|
||||
: []),
|
||||
...fields,
|
||||
],
|
||||
interfaceName,
|
||||
label: 'Section settings',
|
||||
label: { en: 'Section settings', pl: 'Ustawienia sekcji' },
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user