Admin follow-ups: localised stats tab title, scanner names, close label, favicon hint
- Statistics view: the browser-tab title follows the admin language.
Payload's custom-view meta.title is one plain string and its custom-view
metadata ignores i18n, so the view renders <DocumentTitle> (/admin) with the
translated title; it re-applies the title while the view is open because
Next streams the English metadata in after hydration. adminDocumentTitle()
adds admin.meta.titleSuffix the way Payload does.
- Cookie scanner: CookieIntegration.label may be { en, pl, ... }. The built-in
names without a product name come from the shared admin texts
(cookieIntegration*, cookieSourceProject); the scan endpoint answers in the
request's admin language and stored source names use the scanning editor's.
- Maintenance notice: getConstructionMode(locale) returns `locale`; the "x"
close button gets a screen-reader name "Close" / "Zamknij" (locale and
closeLabel props; constructionCloseLabel exported).
- Favicon: FaviconCheck (/admin, afterInput on Site settings -> Site icon)
warns in the admin language when the image is under 48x48 or not square,
without blocking the save; validateFaviconField shares faviconProblems().
- Docs, AGENT.md and skills: the above, plus Next.js 16.4.1 or later as the
minimum safe version (AGENT.md 4.11, ipal-setup, ipal-upgrade).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6f32ea4cdb
commit
546806fe39
+9
-2
@@ -411,6 +411,11 @@ No abbreviations (`HeroSection`, not `HeroSec`). Do not create `lib/pages.ts`,
|
||||
9. **RSC by default.** `'use client'` only for state/interaction, in a separate file;
|
||||
the section stays a server component and passes data to it. Secrets: `import 'server-only'`.
|
||||
10. **Blocks do not import `lib/*`** (cycle). Server-side data → `enhanceProps`.
|
||||
11. **Next.js 16.4.1 or later** (minimum safe version). 16.0.0–16.4.0 have unauthenticated RCE and DoS
|
||||
advisories (GHSA-2464-fhr4-w9xw, GHSA-673q-mjm6-r5xr, GHSA-p3m5-59mp-jv5r); Payload supports no patched
|
||||
15.x line. Pin `next` and `eslint-config-next` to the same 16.4.x (≥ 16.4.1) and make sure `sharp` resolves to
|
||||
0.35.5 or later (`pnpm why sharp`). The plugin's peer range stays open (`next >=15`) — the minimum is yours to keep.
|
||||
**Check:** `pnpm ls next sharp` → next ≥ 16.4.1, sharp ≥ 0.35.5; `pnpm dev` prints no security-upgrade warning.
|
||||
|
||||
---
|
||||
|
||||
@@ -630,8 +635,10 @@ empty fields, without guessing, without numbered slots. You design the schema fo
|
||||
`collectionOverrides`, component texts via `i18n.translations.<lang>.ipal.<key>`
|
||||
(keys: `adminTexts` from `@intecion/ipal-kit`). Building blocks for your own admin
|
||||
components: `ipalT`, `formatNumber`, `formatDateTime`, `defineTexts`, `ADMIN_LANGUAGES`,
|
||||
`applyAdminI18n` (already applied by `ipalKit`), types `AdminText`, `AdminLanguage`, `AdminTextKey`
|
||||
— details in i18n.md "Admin panel languages and texts".
|
||||
`applyAdminI18n` (already applied by `ipalKit`), `adminDocumentTitle` + `<DocumentTitle>` (`/admin`;
|
||||
a custom view's tab title in the admin language — Payload's `meta.title` is one fixed string),
|
||||
types `AdminText`, `AdminLanguage`, `AdminTextKey` — details in i18n.md "Admin panel languages and texts".
|
||||
**Check:** Polish panel → the view's browser tab reads in Polish.
|
||||
4. **No "just in case" fields.** Every field is displayed by the component; an empty
|
||||
optional field = the element does not render (the component handles it). Hide
|
||||
dependent fields: `admin.condition` (video fields only with `mediaType: 'video'`,
|
||||
|
||||
@@ -124,6 +124,7 @@ description: Complete map of everything @intecion/ipal-kit provides — every ip
|
||||
| `MaskedField` | SMTP / Turnstile secrets | always |
|
||||
| `TestEmailButton` | Site integrations → SMTP | always |
|
||||
| `MetaDescriptionCheck` | below `meta.description` | `seo` and `descriptionCheck !== false` |
|
||||
| `FaviconCheck` | below Site settings → Site icon (`afterInput`) | always (with the global); remove with a `globalOverrides['site-settings']` function |
|
||||
| `RowLabel` | array row labels (Cookie banner categories and cookie list; your own `rowLabel(...)`) | always |
|
||||
|
||||
## 3. What the project wires itself
|
||||
|
||||
@@ -177,14 +177,15 @@ Opt-in with `ipalKit({ cookieScanner: true })`; the plugin wires the collection,
|
||||
|
||||
| Export | Import from | What it does / when |
|
||||
|---|---|---|
|
||||
| `ConstructionNotice` | `@intecion/ipal-kit/client` | "Under construction" popup: `{ mode, classNames? }` — opens after a redirect from a blocked address (`?notice=construction`) and on a click on a link to an unavailable page; texts from the panel, renders nothing when the mode is off. In `[locale]/layout.tsx` with `mode={await getConstructionMode(locale)}`. |
|
||||
| `ConstructionNotice` | `@intecion/ipal-kit/client` | "Under construction" popup: `{ mode, classNames?, locale?, closeLabel? }` — with no button text in the panel the button shows `×` and gets a screen-reader name in the page language ("Close" / "Zamknij"; `locale` defaults to `mode.locale`, `closeLabel` overrides the text); opens after a redirect from a blocked address (`?notice=construction`) and on a click on a link to an unavailable page; texts from the panel, renders nothing when the mode is off. In `[locale]/layout.tsx` with `mode={await getConstructionMode(locale)}`. |
|
||||
| `isPathAllowed(pathname, allowedPaths)` | `@intecion/ipal-kit` | Whether the path is allowed in under-construction mode (exact match, no trailing `/`) → `boolean`. `createPageRoute` uses it itself — by hand only in your own routes. |
|
||||
| `isPathVisibleIn(mode, pathname)` | `@intecion/ipal-kit` | `true` when the mode is off or the path is allowed — the rule behind `isPathVisible` from `createContentHelpers`. For your own routes when you already hold the `ConstructionMode`. |
|
||||
| `pathOf(url)` | `@intecion/ipal-kit` | Pathname of an absolute or relative URL — feed a result URL to a `PathVisibility` check. |
|
||||
| `constructionNoticeHref(homePath)` | `@intecion/ipal-kit` | Redirect address for a blocked page: `${homePath}?notice=construction`. `createPageRoute` uses it itself. |
|
||||
| `CONSTRUCTION_NOTICE_PARAM` | `@intecion/ipal-kit` | Name of the query parameter that opens the popup: `'notice'` (value `construction`). |
|
||||
|
||||
**Types:** `ConstructionMode` (root and `/client`) — `{ enabled, allowedPaths, homePath, texts }` from `getConstructionMode(locale)`; `PathVisibility` — `(path, locale) => boolean | Promise<boolean>` (`isPathVisible` from `createContentHelpers`; the `isPathVisible` option of the Markdown, MCP and search routes); `ConstructionNoticeClassNames` (`/client`) — popup classes.
|
||||
**Types:** `ConstructionMode` (root and `/client`) — `{ enabled, allowedPaths, homePath, locale, texts }` from `getConstructionMode(locale)`;
|
||||
`CONSTRUCTION_CLOSE_LABEL`, `CONSTRUCTION_CLOSE_LABEL_PL`, `constructionCloseLabel(locale?)` (root and `/client`) — the close button's screen-reader name; `PathVisibility` — `(path, locale) => boolean | Promise<boolean>` (`isPathVisible` from `createContentHelpers`; the `isPathVisible` option of the Markdown, MCP and search routes); `ConstructionNoticeClassNames` (`/client`) — popup classes.
|
||||
|
||||
## Content and routing (`content`) — details: `node_modules/@intecion/ipal-kit/docs/content.md`
|
||||
|
||||
@@ -592,7 +593,11 @@ Most routes and metadata are already ready in `createContentHelpers` (`generateP
|
||||
| `buildAutoFillMetaHook(mapping?)` | `@intecion/ipal-kit` | `beforeChange` hook that fills empty `meta.title`/`meta.description` from content. The plugin wires it itself on the `seo.collections` collections (option `seo.autoFill`) — do not call. |
|
||||
| `injectAutoFillMeta(config, seo)` | `@intecion/ipal-kit` | Injects the hook above into the SEO collections. The plugin wires it itself — do not call. |
|
||||
| `SKIP_AUTO_FILL` | `@intecion/ipal-kit` | `'ipalSkipAutoFill'` — `context` key (`context: { [SKIP_AUTO_FILL]: true }`) that turns off meta auto-fill and the AI summary on save (migrations, scripts). |
|
||||
| `validateFaviconField` | `@intecion/ipal-kit` | `FieldHook` that warns when the favicon is < 48×48 or not square. The plugin wires it itself on the favicon field in SiteSettings — call it only for your own favicon field. |
|
||||
| `validateFaviconField` | `@intecion/ipal-kit` | `FieldHook` that logs a server warning when the favicon is < 48×48 or not square (never blocks the save). The plugin wires it itself on the favicon field in SiteSettings — call it only for your own favicon field. |
|
||||
| `DocumentTitle` | `@intecion/ipal-kit/admin` | Client component `{ title }`: sets the browser-tab title of a custom admin view after load, so it follows the admin language (Payload's view `meta.title` is one fixed string). Render it in your view with a translated title; the statistics view uses it. |
|
||||
| `adminDocumentTitle(title, titleSuffix?)` | `@intecion/ipal-kit` | `"Title - Suffix"` the way Payload builds a tab title — pass `req.payload.config.admin.meta.titleSuffix`. |
|
||||
| `FaviconCheck` | `@intecion/ipal-kit/admin` | Hint under the site icon in Site settings: the chosen image is under 48×48 px or not square (text in the admin language, saving never blocked). Injected by the plugin; `pnpm generate:importmap`. Props: `fieldPath` (default the field it sits under), `mediaSlug` (`'media'`) — for your own favicon field: `admin.components.afterInput: [{ path: '@intecion/ipal-kit/admin#FaviconCheck', clientProps: { fieldPath: 'icon' } }]`. |
|
||||
| `faviconProblems(media)`, `FAVICON_MIN_SIZE` | `@intecion/ipal-kit` | The check both use: `{ width, height, mimeType }` → `FaviconProblem[]` (`{ key: 'faviconTooSmall' \| 'faviconNotSquare', width, height }`); SVG and unknown sizes pass. Types: `FaviconProblem` (root), `FaviconCheckProps` (`/admin`). |
|
||||
| `MetaDescriptionCheck` | `@intecion/ipal-kit/admin` | Hint below the meta description in the SEO tab (description duplicated from the global or another document). Injected by the plugin; after turning the option on, `pnpm generate:importmap`. |
|
||||
|
||||
**Types:** `PageMetadata`, `OgImage` — `buildMetadata` result and OG image; `SeoMeta`, `SeoOption`, `AutoFillMapping` — the `meta` group, the plugin's `seo` option and the auto-fill mapping; `SiteMetaConfig` — `readSiteMetaConfig` result; `RobotsOptions`, `RobotsRules` — `buildRobots` options and result; `AiBotsPolicy` (`'allow' \| 'block-training' \| 'disallow' \| false`), `AiBotRule` (`{ userAgent, access: 'allow' \| 'disallow' }`, `aiBotRules`, wins over the policy); `VerificationMetadata` — `verificationFrom` result; `SitemapEntry`, `SitemapRouteOptions`, `SitemapStyleOptions` — sitemap entry, handler and style options; `CollectSiteIndexArgs`, `SiteIndexEntry` — `collectSiteIndex` arguments and entry; `NoSnippetProps` (`/client`, `/rsc`) — `NoSnippet` props.
|
||||
|
||||
@@ -39,6 +39,8 @@ legacy-peer-deps=true
|
||||
pnpm add @intecion/ipal-kit @payloadcms/plugin-seo @payloadcms/plugin-form-builder \
|
||||
@payloadcms/storage-s3 @clocklimited/payload-2fa@3.0.0-beta.7 tailwindcss @tailwindcss/postcss
|
||||
```
|
||||
**Next.js 16.4.1 or later** (minimum safe version: 16.0.0–16.4.0 have critical advisories, AGENT.md §4 item 11):
|
||||
`pnpm add next@^16.4.1 eslint-config-next@^16.4.1 sharp@^0.35.5` when create-payload-app gave you an older one.
|
||||
`nodemailer`, `lucide-react`, `slugify`, `server-only` come with the plugin — do not add them (your own
|
||||
`lucide-react` only `~0.400.0`). In `package.json`: pin every `@payloadcms/*` (ui, next, db-*, richtext-lexical,
|
||||
plugin-seo, plugin-form-builder, storage-s3) in `pnpm.overrides` **to the exact `payload` version**, then
|
||||
@@ -46,7 +48,8 @@ plugin-seo, plugin-form-builder, storage-s3) in `pnpm.overrides` **to the exact
|
||||
`"build": "cross-env NODE_OPTIONS=\"--max-old-space-size=3072\" next build --webpack"`.
|
||||
|
||||
**Check.** `ls node_modules/@intecion/ipal-kit/docs/agent/AGENT.md` exists;
|
||||
`pnpm ls payload @payloadcms/ui @payloadcms/plugin-seo` — one, identical version; `ls src/middleware.ts` → not found.
|
||||
`pnpm ls payload @payloadcms/ui @payloadcms/plugin-seo` — one, identical version; `pnpm ls next sharp` → next ≥ 16.4.1,
|
||||
sharp ≥ 0.35.5; `ls src/middleware.ts` → not found.
|
||||
404 on `pnpm add` = missing `@intecion:registry` line; 401 = stale `_authToken` in `~/.npmrc` (PROGRAMISTA §1).
|
||||
|
||||
**Turn off / override.** `@payloadcms/storage-s3` and `@clocklimited/payload-2fa` are optional peers — only unneeded
|
||||
|
||||
@@ -82,6 +82,16 @@ the banner → `<CookieBanner settings="detailed">` and remove the copy. With `d
|
||||
`buildGlobalRevalidateHook({ revalidatePath })`; `consentFieldName` passed only because the option was ignored →
|
||||
`forms.consentFieldName` works now; your own seed guard / upsert code → `@intecion/ipal-kit/seed` (`createSeeder`).
|
||||
|
||||
**Every upgrade — Next.js 16.4.1 or later** (AGENT.md §4 item 11): `pnpm ls next sharp`; below 16.4.1 →
|
||||
`pnpm add next@^16.4.1 eslint-config-next@^16.4.1 sharp@^0.35.5`, `rm -rf .next`, build, redeploy on Coolify
|
||||
(a new image ships the fixed next and sharp). **Check:** `pnpm dev` prints no security-upgrade warning.
|
||||
|
||||
**→ after 1.13.0 (admin follow-ups):** `pnpm payload generate:importmap` — new panel component
|
||||
`@intecion/ipal-kit/admin#FaviconCheck` (hint under Site settings → Site icon). **Check:** pick a 32×32 PNG as the
|
||||
site icon → a warning appears under the field; saving still works. Nothing else to change: the statistics tab title,
|
||||
the cookie scanner's integration names and the maintenance notice's close button now follow the language by themselves
|
||||
(`<ConstructionNotice mode={await getConstructionMode(locale)} />` already passes it).
|
||||
|
||||
## 2. Inventory (no code changes)
|
||||
For **every** item in the PROGRAMISTA §6 table show evidence (grep / file) of whether
|
||||
it applies to the project. Run the **ipal-audit** skill (`--quick`) and attach the result.
|
||||
|
||||
@@ -11,7 +11,7 @@ subpages (e.g. a brief), and everything else is blocked — no code changes, one
|
||||
|---|---|
|
||||
| Site under construction | turns the mode on |
|
||||
| Pages still available | pages that still open; **the home page is always available** |
|
||||
| Notice title / text / Close button label | popup content (per language); empty button → `×` |
|
||||
| Notice title / text / Close button label | popup content (per language); empty button → `×` with a screen-reader name in the page language ("Close" / "Zamknij") |
|
||||
|
||||
Fields in the SiteSettings global: group `construction` → `enabled`, `allowedPages` (relationship to the pages
|
||||
collection, hasMany), `title`, `message`, `buttonLabel` (localized).
|
||||
@@ -77,7 +77,9 @@ New fields in Site settings = a migration in the project (`payload migrate:creat
|
||||
Markdown / MCP without the filter even with the mode on:
|
||||
`createContentHelpers({ markdown: { isPathVisible: () => true }, mcp: { isPathVisible: () => true } })`;
|
||||
sitemap / llms.txt without the filter: `createContentHelpers({ underConstructionSeo: false })`.
|
||||
- **Override:** popup look through `classNames` (`overlay`, `dialog`, `title`, `message`, `button`);
|
||||
- **Override:** the `×` button's screen-reader name through `closeLabel` (default by `locale`, which defaults to
|
||||
`mode.locale` from `getConstructionMode(locale)`; `constructionCloseLabel(locale)` is the default);
|
||||
popup look through `classNames` (`overlay`, `dialog`, `title`, `message`, `button`);
|
||||
texts in the admin panel. Your own rule = your own `isPathVisible` function in the options above or in `createSearchRoute`.
|
||||
Access/hooks of the Site settings global: `ipalKit({ globalOverrides: { 'site-settings': … } })`.
|
||||
- **Extend:** `getConstructionMode(locale)` + `isPathVisibleIn` / `isPathAllowed` / `pathOf` /
|
||||
|
||||
@@ -52,7 +52,12 @@ Status changes work in the list's bulk edit too. Deleting review entries is admi
|
||||
by the plugin.
|
||||
|
||||
Labels are in English and Polish and follow the editor's admin language; `cookieScanner.labels` adds
|
||||
languages or changes text.
|
||||
languages or changes text. The built-in integrations without a product name (Cookie banner, Admin panel
|
||||
login, Language choice, Built-in statistics) take their names from the shared admin texts
|
||||
(`adminTexts`, keys `cookieIntegration*`, and `cookieSourceProject` for your own declarations), so the scan
|
||||
box lists them in the editor's language; the *Source* stored on a review entry is in the language of
|
||||
whoever ran the scan (English for a site check). Rename one through `cookieScanner.integrations`
|
||||
(`label: { en: '…', pl: '…' }`).
|
||||
|
||||
## What the plugin declares
|
||||
|
||||
@@ -120,7 +125,7 @@ run the tests, commit.
|
||||
| Key | Default | What it does |
|
||||
|---|---|---|
|
||||
| `declarations` | `[]` | The project's own cookies (custom embeds, chat, YouTube): `CookieDeclaration[]`, always part of a scan |
|
||||
| `integrations` | built-ins | `(defaults) => integrations` — filter, change or add `CookieIntegration`s (each: `key`, `label`, `declarations`, `isEnabled(ctx)`) |
|
||||
| `integrations` | built-ins | `(defaults) => integrations` — filter, change or add `CookieIntegration`s (each: `key`, `label` — one string or `{ en, pl, … }` per admin language, `declarations`, `isEnabled(ctx)`) |
|
||||
| `database` | `true` | `false` = no Open Cookie Database lookup |
|
||||
| `databaseCategories` | table above | Partial map from database category to consent category |
|
||||
| `access` | editor and up | `({ req }) => boolean` — who may scan, start a crawl and read its status |
|
||||
@@ -169,7 +174,7 @@ ipalKit({ cookieScanner: { integrations: (defaults) => [...defaults, chat] } })
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
| `GET /api/ipal/cookie-scan` | `{ ok, integrations: [{ key, label }] }` — what a scan covers |
|
||||
| `GET /api/ipal/cookie-scan` | `{ ok, integrations: [{ key, label }] }` — what a scan covers; `label` in the admin language of the request |
|
||||
| `POST /api/ipal/cookie-scan` | body `{ names?: string[] \| string }` (newline or comma separated, up to 200, names with spaces, `;`, `,` or `=` dropped) → `{ ok, summary: { created, updated, unchanged, unknown }, integrations }` |
|
||||
| Access | editor and up (`userMeetsRole`; without `access` every logged-in account), or `cookieScanner.access`; otherwise `403` |
|
||||
|
||||
|
||||
@@ -410,6 +410,13 @@ separate. The panel's language is what each user picks in *Account → Language*
|
||||
format in the admin language; `defineTexts({ en, pl })` declares a text set whose Polish keys
|
||||
must match the English ones; `ADMIN_LANGUAGES` lists the plugin's languages;
|
||||
`applyAdminI18n(config)` is the config step itself (already applied by `ipalKit`).
|
||||
- **Browser-tab title of a custom admin view:** Payload takes a view's `meta.title` as one
|
||||
plain string and never translates it (its custom-view metadata ignores `i18n`), so the
|
||||
server-rendered title stays in that one language. Render `<DocumentTitle title={…} />`
|
||||
(`@intecion/ipal-kit/admin`) in the view with the translated title; after the page loads
|
||||
the tab follows the admin language. `adminDocumentTitle(title, config.admin.meta.titleSuffix)`
|
||||
builds the same "Title - Suffix" Payload would. The statistics view does this already:
|
||||
its tab reads *Statystyki* in the Polish panel.
|
||||
- **Wording rules** for every label you add: [dev/admin-ux.md](./dev/admin-ux.md).
|
||||
- **Verify:** switch *Account → Language* to Polski — every plugin global, collection and
|
||||
view reads in Polish; `pnpm test` runs `test/adminUx.test.ts` in the plugin.
|
||||
|
||||
+10
-3
@@ -418,9 +418,16 @@ favicon field. SVG → scales; PNG → should be ≥48×48 (validation warns, se
|
||||
|
||||
### Enforcing the size (validation)
|
||||
|
||||
The favicon field in SiteSettings has the `validateFaviconField` validation — it warns
|
||||
the editor on save if the favicon is <48×48 or not square. The editor
|
||||
sees a warning instead of silently uploading a favicon Google will not show.
|
||||
The favicon field in SiteSettings shows a hint right under it (`FaviconCheck`, `/admin`)
|
||||
as soon as the editor picks an image under 48×48 px or one that is not square — in the
|
||||
admin language, without blocking the save. The same check (`faviconProblems`) runs on
|
||||
save in `validateFaviconField` and goes to the server log.
|
||||
|
||||
- **Wire:** nothing beyond `pnpm payload generate:importmap` (the plugin adds the component).
|
||||
- **Your own favicon field:** `admin.components.afterInput: [{ path: '@intecion/ipal-kit/admin#FaviconCheck', clientProps: { fieldPath: 'icon', mediaSlug: 'media' } }]`.
|
||||
- **Turn off:** a `globalOverrides['site-settings']` function that drops `afterInput` from the field.
|
||||
- **Texts:** `i18n.translations.<lang>.ipal.faviconTooSmall` / `faviconNotSquare` (`{{width}}`, `{{height}}`).
|
||||
- **Verify:** Site settings → Site icon → choose a 32×32 PNG → the warning appears; save still works.
|
||||
|
||||
### Organization JSON-LD (branding)
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ Adds:
|
||||
- `POST /api/ipal/hit`,
|
||||
- the **`<adminRoute>/stats`** view (default `/admin/stats`; it uses `ipalKit({ adminRoute })`, not
|
||||
`routes.admin` set by hand in the config) + a nav link *Statistics overview* (`StatsNavLink`, hidden for users who cannot read `stats-visits`),
|
||||
its browser tab reads *Statistics* / *Statystyki* in the admin language (set after load through
|
||||
`DocumentTitle`, because Payload's view `meta.title` is one fixed string — i18n.md),
|
||||
- a 30-day chart on the dashboard (`StatsWidget`),
|
||||
- `STATS_SLUG` (`'stats-visits'`) from `@intecion/ipal-kit` — for your own queries.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user