Add dark mode, i18n, messenger/moderation/verify, admin CRUD parity

Web-tier features completing the AtomCMS→Next.js conversion (slice 2):

UI/UX:
- Dark mode: html.dark CSS-var overrides + ThemeSwitcher (localStorage,
  no-flash boot script) wired into the nav.
- i18n (next-intl, cookie-based / no URL routing): en + it catalogs,
  request.ts, provider in root layout, LanguageSwitcher; shell (nav,
  header, footer) fully translated. URLs + access-guard unchanged.
- globals.css: --muted/--border aliases used across admin pages.

User features:
- /messages: offline messages + friend-request accept (server action
  re-reads session, two directional rows, idempotent).
- Email verification: signed-token /verify route + sendVerification wired
  into register (best-effort, never blocks signup).
- Article reactions: toggle UI on news/[slug] + server action.
- Content moderation service (website_wordfilter + optional OpenAI
  moderations, fail-open) wired into article comments + guestbook.

Admin CRUD parity (Filament replacement):
- /admin/shop (+ new/[id]) packages CRUD + read-only orders.
- /admin/transactions read-only PayPal log.
- /admin/permissions, /admin/tags, /admin/ads (+ new/[id]),
  /admin/help-questions (+ new/[id]), /admin/radio/history,
  /admin/users/[id]/edit. All gated by requireStaff + logStaffActivity.

Verified: tsc 0, vitest 48/48, next build 0 (all routes incl. new
admin CRUD + /messages + /verify).
This commit is contained in:
Simo committed 2026-06-28 16:06:42 +02:00
1 parent 22d53d0e9c
commit 7daeccb832
45 files changed
+3312 -84

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
"use client";
import { useLocale } from "next-intl";
import { useRouter } from "next/navigation";
import { useTransition } from "react";
const LOCALES: { code: string; label: string }[] = [
{ code: "en", label: "EN" },
{ code: "it", label: "IT" },
];
/**
* Locale picker. Writes the chosen locale to the `NEXT_LOCALE` cookie (read by
* src/i18n/request.ts on the server) and refreshes the route so server
* components re-render with the new messages. No URL change — matches the
* cookie-based, routing-free i18n setup.
*/
export function LanguageSwitcher() {
const locale = useLocale();
const router = useRouter();
const [pending, startTransition] = useTransition();
function onChange(e: React.ChangeEvent<HTMLSelectElement>) {
const next = e.target.value;
document.cookie = `NEXT_LOCALE=${next};path=/;max-age=31536000;samesite=lax`;
startTransition(() => router.refresh());
}
return (
<select
value={locale}
onChange={onChange}
disabled={pending}
aria-label="Language"
className="nav-item cursor-pointer bg-transparent text-[13px]"
style={{ border: "none", padding: "0 0.25rem" }}
>
{LOCALES.map((l) => (
<option key={l.code} value={l.code}>
{l.label}
</option>
))}
</select>
);
}