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,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',
|
||||
|
||||
Reference in New Issue
Block a user