feat: redesign portal UI with Sakani UI and add release notes
Replace the hand-rolled Tailwind/shadcn look with Sakani UI across the editorial area, the admin area and all signed-out pages. - AppShell (Sakani Sidebar + TopBar) for /redaktion and /admin, with a mobile drawer, theme toggle, sign-out, legal links and a "Was ist neu" button; PublicShell for login, registration, password, 2FA and errors. - Shared primitives (Button, Card, Input, PageHeader) now render Sakani; components/ui/sakani.tsx is the client boundary for Server Components (Sakani ships no "use client") and adds FormSelect (native form value) and DataTable (element cells from the server). - Legacy CSS variables map onto Sakani tokens; globals.css shrinks from ~2200 to ~700 lines. Geist replaces Inter. recharts/lucide-react dropped (charts via Sakani BarChart). - Release notes popup per area, shown once per version (localStorage) and reopenable from the sidebar; native <dialog> for focus trapping. - Fixes found while testing: TOTP field reused the typed password in clear text, modal dialogs sat top-left, invisible unchecked checkboxes in dark mode. - Parallel run: compose.parallel.yaml, AUTO_RULE_SYNC_DISABLED switch and docs/operations.md §8 (start, rollback, cutover). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
453bece72c
commit
9e938e4d07
79 files changed
+2266
-4316
No files matched your search
@@ -0,0 +1,76 @@
|
||||
// @vitest-environment jsdom
|
||||
|
||||
import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
|
||||
import { afterEach, beforeEach, expect, test, vi } from "vitest";
|
||||
|
||||
const { push } = vi.hoisted(() => ({ push: vi.fn() }));
|
||||
|
||||
vi.mock("next/navigation", () => ({
|
||||
usePathname: () => "/redaktion/alben/abc",
|
||||
useRouter: () => ({ push }),
|
||||
}));
|
||||
vi.mock("next-themes", () => ({ useTheme: () => ({ resolvedTheme: "light", setTheme: vi.fn() }) }));
|
||||
vi.mock("@/modules/auth/client", () => ({ authClient: { signOut: vi.fn() } }));
|
||||
|
||||
import { AppShell } from "./app-shell";
|
||||
import { RELEASE } from "./release-notes";
|
||||
|
||||
const legal = {
|
||||
imprint: "https://example.com/impressum",
|
||||
privacy: "https://example.com/datenschutz",
|
||||
terms: "https://example.com/agb",
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
// The release-notes popup is not under test here unless a test clears this.
|
||||
localStorage.setItem("release-notes-seen:redaktion", RELEASE.version);
|
||||
});
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
localStorage.clear();
|
||||
push.mockClear();
|
||||
});
|
||||
|
||||
test("marks the active section and routes sidebar links client-side", () => {
|
||||
render(<AppShell area="redaktion" legal={legal}>Inhalt</AppShell>);
|
||||
|
||||
const albums = screen.getByRole("link", { name: "Alben" });
|
||||
expect(albums.getAttribute("aria-current")).toBe("page");
|
||||
|
||||
const lightbox = screen.getByRole("link", { name: "Merkzettel" });
|
||||
expect(fireEvent.click(lightbox)).toBe(false); // default (full reload) prevented
|
||||
expect(push).toHaveBeenCalledWith("/redaktion/leuchtkasten");
|
||||
|
||||
push.mockClear();
|
||||
fireEvent.click(lightbox, { metaKey: true }); // new-tab clicks stay native
|
||||
expect(push).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("legal links sit in the sidebar and open natively in a new tab", () => {
|
||||
render(<AppShell area="redaktion" legal={legal}>Inhalt</AppShell>);
|
||||
|
||||
const imprint = screen.getByRole("link", { name: "Impressum" });
|
||||
expect(imprint.getAttribute("href")).toBe(legal.imprint);
|
||||
expect(imprint.getAttribute("target")).toBe("_blank");
|
||||
expect(fireEvent.click(imprint)).toBe(true); // not intercepted
|
||||
expect(push).not.toHaveBeenCalled();
|
||||
expect(screen.getByRole("link", { name: "Datenschutz" })).toBeTruthy();
|
||||
expect(screen.getByRole("link", { name: "Nutzungsbedingungen" })).toBeTruthy();
|
||||
});
|
||||
|
||||
test("release notes pop up once per version and reopen from the sidebar", async () => {
|
||||
localStorage.clear();
|
||||
const { unmount } = render(<AppShell area="admin" legal={legal}>Inhalt</AppShell>);
|
||||
|
||||
expect(await screen.findByRole("dialog", { name: "Was ist neu?" })).toBeTruthy();
|
||||
fireEvent.click(screen.getByRole("button", { name: "Verstanden" }));
|
||||
await waitFor(() => expect(screen.queryByRole("dialog")).toBeNull());
|
||||
expect(localStorage.getItem("release-notes-seen:admin")).toBe(RELEASE.version);
|
||||
|
||||
unmount();
|
||||
render(<AppShell area="admin" legal={legal}>Inhalt</AppShell>);
|
||||
expect(screen.queryByRole("dialog")).toBeNull(); // seen: stays closed
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: new RegExp(`Was ist neu · v${RELEASE.version}`) }));
|
||||
expect(await screen.findByRole("dialog", { name: "Was ist neu?" })).toBeTruthy();
|
||||
});
|
||||
Reference in new issue
Block a user