diff --git a/dev/helpers/credentials.ts b/dev/helpers/credentials.ts index b3a6c73..c4c45fd 100644 --- a/dev/helpers/credentials.ts +++ b/dev/helpers/credentials.ts @@ -2,3 +2,9 @@ export const devUser = { email: 'it@intecion.com', password: 'it@intecion.com', } + +/** Second dev login with the editor role — for checking what editors see. */ +export const devEditor = { + email: 'editor@intecion.com', + password: 'editor@intecion.com', +} diff --git a/dev/seed.ts b/dev/seed.ts index ca79a9a..b3664ec 100644 --- a/dev/seed.ts +++ b/dev/seed.ts @@ -1,6 +1,6 @@ import type { Payload } from 'payload' -import { devUser } from './helpers/credentials.js' +import { devEditor, devUser } from './helpers/credentials.js' export const seed = async (payload: Payload) => { const { totalDocs } = await payload.count({ @@ -23,6 +23,11 @@ export const seed = async (payload: Payload) => { }) } + const editors = await payload.count({ collection: 'users', where: { email: { equals: devEditor.email } } }) + if (!editors.totalDocs) { + await payload.create({ collection: 'users', data: { ...devEditor, roles: ['editor'] } }) + } + await seedContactPage(payload) } diff --git a/docs/dev/admin-ux.md b/docs/dev/admin-ux.md new file mode 100644 index 0000000..4da02be --- /dev/null +++ b/docs/dev/admin-ux.md @@ -0,0 +1,180 @@ +# admin-ux.md — wording and layout of the admin panel + +> **Who it is for:** anyone (person or agent) who adds or changes a collection, +> global, field, admin view, button or default text in ipal-kit — or in a project +> built on it. Projects can override every label and description the plugin ships; +> this guide is what the defaults follow, and what new fields in projects should follow. + +The reader is an **editor**: a marketing or office person who knows the business, +not the code. Every screen must be clear to them without a developer at hand. + +--- + +## 1. Tone + +- **Professional and plain.** Write as a careful colleague would: calm, neutral, polite. + No jokes, no exclamation marks, no "Oops". +- **Say what it does for the site, not how it works.** "Shown in search results" — not + "Rendered via buildIconsMetadata". +- **No developer words** in labels, descriptions, placeholders, toasts or errors: + no function, component, hook, file, skill or env-var names (``, + `buildIconsMetadata`, `ipal-consent-check`, `SMTP_HOST`), no `camelCase`, no + `settings="detailed"`, no arrows like `Empty →`. + Developer notes belong in code comments and `docs/`. +- **Product names stay** when the editor must find that product: Google Analytics, + Google Tag Manager, Meta Pixel, Microsoft Clarity, Cloudflare Turnstile, Bing Webmaster Tools. +- **Address the editor directly**, in the imperative: "Add your LinkedIn profile", "Leave empty to…". +- **Errors say what to do:** "Enter a full address, e.g. https://example.com" — not "Invalid URL". + Errors an editor can see never name env vars, config files or packages; the developer + detail goes to the server log. +- **No package or vendor names** (ipal-kit, Intecion) in labels, descriptions, test e-mails + or messages. "Ask your administrator" instead of "configured by Intecion". + +## 2. Length + +| Element | Limit | Example | +|---|---|---| +| Collection / global name | 1–2 words | Site settings, Consent log | +| Tab, group, collapsible | 1–2 words | General, Search engines | +| Field label | 1–3 words, max **30 characters** | Site name, Share image | +| Select option | 1–4 words | Page first | +| Button | 1–3 words, a verb | Send test e-mail | +| Description | **one short sentence**, max **120 characters**; only where it helps | Shown when a page has no image of its own. | +| Placeholder | an example value, not an instruction | `e.g. G-XXXXXXX` | +| Toast / inline message | one sentence | Test e-mail sent to anna@example.com. | +| Empty state | one sentence + what to do next | No submissions yet. They appear here when someone sends a form. | + +- **Skip the description** when the label says it all (Title, Logo, Phone). + A description that repeats the label is noise. +- **One sentence, one idea.** If a field needs a paragraph, the field is too + complex: split it, give it a good default, or move the explanation to `docs/`. +- Description text ends with a full stop. Labels, tabs and buttons don't. + +## 3. Language and translations + +- The plugin ships every admin string in **every language it supports: English (`en`) and + Polish (`pl`)**. A label or description is `{ en: '…', pl: '…' }`, never a bare string. +- **Every field gets an explicit `label`.** Never rely on Payload's auto-label from the + field name (`Ga4 Measurement Id`, `Linked In Partner Id`, `Same As`). +- Custom admin components (views, widgets, buttons) take their strings from the plugin's + translations (`config.i18n.translations`, merged with the project's), not hardcoded JSX. +- Visitor-facing defaults (cookie banner, form messages, step buttons, 404) ship in `en` + and `pl`, and pick the language of the page being viewed. An empty field in the + CMS falls back to the default **for that language**, never to English on a Polish page. +- Polish follows the same rules: short, neutral, formal (`Wpisz…`, `Zostaw puste…`; + no `Ty`/`Pan` forms — impersonal or imperative). +- A project overrides any of it through the plugin's override options; the project's + value wins (CLAUDE.md main rule). + +## 4. Glossary — one word per concept + +Use these terms everywhere: labels, descriptions, docs, toasts. Never a synonym. + +| Concept | English | Polish | Not | +|---|---|---|---| +| The admin panel | admin panel | panel administracyjny | CMS, backend, dashboard (for the whole panel) | +| A web page in the CMS | page | strona | site (for one page), document | +| The whole website | site | witryna | website, page, domain | +| A blog/news entry | post | wpis | article (unless the project calls it so) | +| Electronic mail | e-mail | e-mail | email, mail | +| Cookie consent | consent | zgoda | permission, opt-in | +| Cookie consent banner | cookie banner | baner cookies | popup, consent bar, CookieBanner | +| Form entry sent by a visitor | submission | zgłoszenie | entry, response, lead | +| Built-in visit counting | statistics | statystyki | analytics (= Google Analytics etc.), stats | +| Third-party tracking tools | analytics | analityka | tracking, pixels (in labels) | +| Anti-spam check on forms | spam protection (Cloudflare Turnstile) | ochrona przed spamem | captcha, Turnstile (alone) | +| Image shown when a link is shared | share image | obraz udostępniania | Open Graph image, OG image, meta image | +| Text shown under a result in Google | description (search result) | opis (w wynikach wyszukiwania) | meta description | +| Title in the browser tab / Google | page title | tytuł strony | meta title, SEO title | +| Web address part after the domain | address (URL) | adres (URL) | slug, path, route | +| The visible name of a field in a form | label | etykieta | name (= technical key) | +| Technical key of a form field | field key | klucz pola | name | +| Search engines and AI | search engines, AI assistants | wyszukiwarki, asystenci AI | crawlers, bots (except the advanced bot rules) | +| Outgoing e-mail server | e-mail sending | wysyłka e-mail | transport, SMTP (as a tab name) | +| Under-construction mode | maintenance mode | tryb prac technicznych | under construction, coming soon | +| Role | role: admin, editor, user | rola: administrator, redaktor, użytkownik | | + +Product names that stay as they are: Google Analytics 4, Google Tag Manager, +Meta Pixel, Microsoft Clarity, LinkedIn Insight Tag, TikTok Pixel, Cloudflare Turnstile, +IndexNow, Google Search Console, Bing Webmaster Tools, Yandex Webmaster, llms.txt (only +in parentheses after a plain name). + +## 5. Capitalisation and punctuation + +- **Sentence case** everywhere: "Site settings", "Share image", "Send test e-mail" — not + "Site Settings". Only product names keep their capitals. +- Polish: sentence case as well ("Ustawienia witryny"). +- No full stop in labels, tabs, buttons, option labels. Full stop at the end of descriptions, + toasts and empty states. +- Examples go in descriptions as `e.g. "Privacy policy"` (pl: `np. „Polityka prywatności"`), + in placeholders as the bare example value. +- Variables in editable texts use `{name}` and are named in the description: + "Use {field} for the field name." + +## 6. Describing options + +- **Select / radio:** the option label is the result, short: `Page first`, `Site first`. + Put a live example in the description or after a dash only when it decides the choice: + `Page first — About us | Acme`. +- **Checkbox:** label states the "on" state as a positive: "Show theme switch", not + "Disable theme switch" / "Allow Theme Toggle". +- **Empty-means-default fields:** say it once, the same way everywhere: + "Leave empty to use the default." (pl: „Zostaw puste, aby użyć domyślnej wartości."). + The default itself goes in the placeholder. +- **Number fields** state the unit in the label: "Session length (minutes)". +- **Danger** (consent reset, secret rotation): say the consequence, plainly: + "Changing it asks every visitor for consent again." + +## 7. Field order and grouping + +Order inside a document, top to bottom: + +1. **What the visitor sees first**: title, main text, image. +2. **Content details**: sections, lists, links. +3. **Behaviour and options**: switches, selects, conditions. +4. **Technical and rare**: keys, IDs, versions, advanced rules — last, collapsed. + +Rules: + +- **Required fields first** within their group. +- **Related fields together**: a `row` for 2–3 short fields that belong together + (host + port, name + provider + category); never more than 3 in a row. +- **Sidebar** (`position: 'sidebar'`) for metadata the editor sets once and rarely + touches: address (URL), publish date, status, version, role. Never for content. +- **Tabs** when a document has 2+ clearly separate areas the editor visits on their own + (Content / SEO; General / Theme / Search engines). Max ~6 tabs. One-field tabs are not + allowed — merge them. Tab names are nouns, 1–2 words. +- **Collapsible** for an optional or advanced block inside a tab ("Advanced", "Bot rules"), + collapsed by default. +- **Group** (named data group) only when the data is a group; its label is a short + noun ("Buttons"), with no description unless it adds something. +- **Arrays** get a singular/plural `labels` and a row label that shows the item's name. +- Fields that only work with another setting (`admin.condition`) hide until they apply, + rather than explaining in a description when they apply. +- Admin navigation: collections and globals sit in a few fixed groups — + **Content**, **Forms**, **Settings**, **Statistics** (pl: Treści, Formularze, + Ustawienia, Statystyki). A nav link or view the user cannot open is hidden, never shown + with "You do not have access". + +## 8. Custom views, widgets, buttons + +- Every view has a page title (browser tab) and a heading that match its nav link. +- Buttons: verb first ("Send test e-mail", "Scan cookies"); a busy state + ("Sending…"); a result toast; a clear error with the next step. +- Empty states: what is missing + when it will appear or what to do. +- Numbers come with a unit or a short label under them ("Visits", "Page views"). +- Numbers, dates and plurals follow the admin language (`Intl` with the user's language), + never a fixed `en-US`; plurals use `Intl.PluralRules`, not `visit(s)`. +- A status message names the right thing: a shared banner component takes its wording + from the integration it reports on. +- Explanations of how a feature works (privacy model, data kept) go in one sentence + under the heading — not in each card. + +## 9. Checklist for a new field (projects too) + +- [ ] Explicit `label`, 1–3 words, sentence case, `{ en, pl }` (or the project's languages). +- [ ] Description only if it helps; one sentence, ≤ 120 characters, no developer words. +- [ ] Terms from the glossary. +- [ ] Placeholder is an example value. +- [ ] Placed by the order rules; sidebar / tab / collapsible chosen by §7. +- [ ] Visitor-facing default exists in every language the site has.