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:
Radosław Smoliński
2026-10-27 16:31:46 +01:00
co-authored by Claude Opus 5.5
parent 6f32ea4cdb
commit 546806fe39
35 changed files with 428 additions and 70 deletions
@@ -5,6 +5,7 @@ import { useCallback, useEffect, useId, useRef, useState } from 'react'
import type { ConstructionMode } from './types.js'
import { isPathAllowed } from './logic.js'
import { constructionCloseLabel } from './texts.js'
import { CONSTRUCTION_NOTICE_PARAM, CONSTRUCTION_NOTICE_VALUE } from './types.js'
export type ConstructionNoticeClassNames = {
@@ -22,12 +23,26 @@ export type ConstructionNoticeClassNames = {
* available — the click is cancelled. Closes with its button or Escape.
* Renders nothing while the mode is off.
*
* Unstyled (classNames, like CookieBanner); texts come from the panel.
* Unstyled (classNames, like CookieBanner); texts come from the panel. With no
* button text set, the button shows "×" and gets a screen-reader name in the
* page language ("Close" / "Zamknij"): `locale`, else `mode.locale`.
*
* // [locale]/layout.tsx
* <ConstructionNotice mode={await getConstructionMode(locale)} classNames={{ overlay: '…', dialog: '…' }} />
*/
export function ConstructionNotice({ classNames: cn = {}, mode }: { classNames?: ConstructionNoticeClassNames; mode: ConstructionMode }) {
export function ConstructionNotice({
classNames: cn = {},
closeLabel,
locale,
mode,
}: {
classNames?: ConstructionNoticeClassNames
/** Screen-reader name of the "×" button. Default: "Close" / "Zamknij" by page language. */
closeLabel?: string
/** Page language. Default: `mode.locale` (set by getConstructionMode). */
locale?: string
mode: ConstructionMode
}) {
const [open, setOpen] = useState(false)
const buttonRef = useRef<HTMLButtonElement>(null)
const titleId = useId()
@@ -76,7 +91,13 @@ export function ConstructionNotice({ classNames: cn = {}, mode }: { classNames?:
<div aria-labelledby={mode.texts.title ? titleId : undefined} aria-modal="true" className={cn.dialog} role="dialog">
{mode.texts.title ? <p className={cn.title} id={titleId}>{mode.texts.title}</p> : null}
{mode.texts.message ? <p className={cn.message}>{mode.texts.message}</p> : null}
<button className={cn.button} onClick={close} ref={buttonRef} type="button">
<button
aria-label={mode.texts.button ? undefined : (closeLabel ?? constructionCloseLabel(locale ?? mode.locale))}
className={cn.button}
onClick={close}
ref={buttonRef}
type="button"
>
{mode.texts.button ?? '×'}
</button>
</div>
+7
View File
@@ -0,0 +1,7 @@
/** Screen-reader name of the notice's close button when the panel sets no button text ("×" is shown). */
export const CONSTRUCTION_CLOSE_LABEL = 'Close'
export const CONSTRUCTION_CLOSE_LABEL_PL = 'Zamknij'
/** Close label for a page language: Polish for 'pl' / 'pl-PL', English for anything else. */
export const constructionCloseLabel = (locale?: string): string =>
locale?.toLowerCase().startsWith('pl') ? CONSTRUCTION_CLOSE_LABEL_PL : CONSTRUCTION_CLOSE_LABEL
+2
View File
@@ -8,6 +8,8 @@ export type ConstructionMode = {
enabled: boolean
/** Homepage in the current language — blocked addresses redirect here (with the notice). */
homePath: string
/** Page language the mode was read for (getConstructionMode(locale)); picks the notice's default texts. */
locale?: string
/** Notice texts from the panel, in the current language. Empty = not set. */
texts: { button?: string; message?: string; title?: string }
}