Files
poli0981andClaude Opus 5.5 71e6c11de3 Glacier Teal UI, theme that follows the OS, a11y fixes and a redesigned admin (#99)
* refactor(pages): share vi/en page components

Eleven pages existed as two near-identical copies, one per locale. Each now
has one component under src/components/pages/ that takes `locale`, and the
vi and en routes are thin wrappers (the pattern DevPage already used; it and
GamingPage, NowPage and UsesPage move into the same folder). The legal routes
share a `legalPaths()` builder.

The built HTML of all 64 pages is unchanged apart from build noise (scope
ids, asset and CSP hashes). The one visible difference: the vi stories and
projects pages now use the boxed empty state the en pages had, which only
shows when a section has no entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(ui): Glacier Teal palette, theme that follows the OS

The warm "midnight ink / old paper" palette gives way to a cool one: navy and
teal in dark, frost white and deep teal in light. src/lib/palette.ts holds the
values for code outside CSS (theme-color, OG images, the console egg) and
tests/palette.test.ts fails if it and global.css drift, or if any text or
control colour drops below WCAG AA on bg, surface or elevated.

New tokens: --line-strong for control edges (3:1), --accent-contrast for text
on an accent fill, --overlay for modal backdrops, --shadow-color. The
undefined --text-small becomes --text-meta, native controls take accent-color.

The theme now defaults to the OS setting and keeps following it. The toggle
cycles system → light → dark, picks its icon in CSS before hydrating, and
points both theme-color metas at a pinned choice. The bootstrap moves to
src/lib/theme.ts and tests run the exact string that ships. The admin gets the
same toggle.

Hard-coded colours go: the reader's paper and dark backgrounds reuse the site
palettes (sepia stays its own, now with a 3:1 edge), the lightbox pins the dark
palette for photos, backdrops use --overlay, and the favicon, mini-game, OG
cards and easter egg read the palette. The service worker cache is bumped for
the new favicon and game.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ui): language switch, one-shot stories, reader bar, a11y and i18n

- The header's language switch goes to a page's real translation, or to the
  same section in the other language when there is none, instead of 404ing
  on every post whose slugs differ (sectionFallbackPath).
- Stories outside a series folder get a reader route (/truyen/[slug]); their
  cards linked to a 404. All four story routes share StoryChapterPage.
- The story reader bar docks under the sticky header (--header-h) instead of
  sliding behind it; in-page anchors stop below the header too.
- The header keeps the menu button below 960px: the full nav needs ~900px in
  English and overflowed between 768 and 900.
- The 500 page shows the Cloudflare Ray ID, stamped by the Worker, instead of
  a random code nobody could look up; bug reports carry it.
- Gallery thumbnails are links to the full image, so albums work without JS;
  the lightbox still takes plain clicks and leaves modified clicks alone.
- Contact lines on /qa and the 403 page are real mailto/Discord/links links.
- A11y: the search is an ARIA combobox (activedescendant, labelled groups,
  status outside the listbox, a visible focus ring) and reports index
  failures; the mobile menu is a modal dialog with a focus trap that returns
  focus to its trigger; the lightbox trap skips disabled arrows and keeps
  focus at either end; the report dialog and its textarea are labelled and the
  copy button says "copied" (or why not) instead of "sent"; Esc acknowledges
  the legal notice only from inside it; reading options expose aria-pressed.
- Landmark names, project "repo/site" links (with their project and a
  new-tab note) and the legal-notice labels come from the i18n dictionaries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ui): centre modal dialogs, bring back list markers in posts

Two old bugs that Tailwind's preflight caused, found while testing the admin:

- It zeroes every margin, which also removes the browser's `margin: auto` on
  modal dialogs, so the public "report a bug" dialog opened stuck in the
  top-left corner. Dialogs get their auto margins back.
- It strips list-style everywhere, so bulleted and numbered lists in blog
  posts and stories rendered without markers. .prose restores them.

The prose rules move from Prose.astro into src/styles/prose.css so the admin
editor's preview can use the same stylesheet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(admin): audit log, dashboard, activity and denylist APIs; stricter Access

Security:
- Access tokens older than 24 hours are refused (jose maxTokenAge), and
  ADMIN_EMAILS is now required: without an allowlist nobody gets in, so an
  Access policy widened by mistake no longer opens the admin. (The secret is
  already set in production.)
- Every admin action — content save/delete, media upload/alt/delete, album
  save/delete, publish, denylist changes — lands in a KV audit log
  (audit:*, 90 days, newest first via inverted keys, one list() to read).

New endpoints:
- /api/admin/overview: content counts per collection and language, drafts,
  library size, the widgets cron's last run, and the deployment's
  configuration (secret names only, gate state, version, single-token mode).
- /api/admin/activity: the audit log next to the content repo's commits.
- /api/admin/security: read, add (with reason and expiry) and remove denylist
  entries; refuses a range that contains the admin's own address.
- /api/admin/media?usage: which content files use each image.
- /api/admin/gallery: albums report their cover and how many repo photos come
  first; PUT can move the cover (rewriting coverIndex in both language entries
  in the same commit); DELETE removes an album's list and entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(admin): redesigned admin with dashboard, activity, security pages

Layout: a two-row header (brand, publish status, theme toggle, account menu;
then a tab row that scrolls sideways on a phone), a skip link, and one
AdminChrome island that renders toasts (polite for confirmations, alert for
failures), a <dialog> confirm in place of window.confirm, and a "sign in
again" banner. The API client detects a lapsed Access session (Access's
redirect, seen through redirect: "manual", or a 403) instead of failing with
a JSON parse error.

Pages: /admin/ is now an overview (content per collection, drafts, publish
state, library, widgets cron, gate and secrets); the list moves to
/admin/content/ with collection/language/draft filters, sorting, an empty
state and a slug check before creating; /admin/activity/ shows the audit log
and content commits; /admin/security/ manages the IP denylist and shows the
configuration.

Editor: local draft autosave with a restore prompt, Ctrl/⌘+S, field errors
from the same validator the server uses, a preview in a sandboxed frame (no
scripts can run, the site's prose styles apply), a retry instead of an empty
form when loading fails, and edit mode after the first save.

Media: search, an "unused only" filter, where each image is used, up to three
uploads at once with a status per file, and clipboard failures reported.
The picker reuses the loaded library, searches, and can pick several images.

Gallery: unsaved-change tracking with a prompt before leaving, drag-and-drop
or arrow reordering, a cover picker, deleting an album, adding several
photos at once.

Publish bar: polls every 5 s while a run or build is moving, 30 s with
unpublished changes, 60 s when in sync, never in a hidden tab; links a
failed run, and flags single-token mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-24 11:23:15 +07:00
..