From 9e938e4d076a282b2e027a87fa613a97bf49a457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Tonh=C3=A4user?= Date: Mon, 30 Nov 2026 18:24:05 +0100 Subject: [PATCH] feat: redesign portal UI with Sakani UI and add release notes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 --- .env.example | 6 + compose.parallel.yaml | 40 + docs/operations.md | 63 + package.json | 4 +- pnpm-lock.yaml | 43 +- src/app/(public)/anmelden/page.tsx | 31 +- src/app/(public)/passwort-vergessen/page.tsx | 24 +- .../(public)/passwort-zuruecksetzen/page.tsx | 24 +- .../(public)/registrieren/bestaetigt/page.tsx | 34 +- src/app/(public)/registrieren/page.tsx | 41 +- .../[editorialId]/BillingSelection.tsx | 400 ++-- .../admin/abrechnungen/[editorialId]/page.tsx | 15 +- src/app/admin/abrechnungen/page.tsx | 52 +- src/app/admin/alben/AlbumAccessManager.tsx | 248 +- src/app/admin/alben/page.tsx | 29 +- src/app/admin/audit/page.tsx | 100 +- src/app/admin/downloads-chart-lazy.tsx | 10 - src/app/admin/downloads-chart.tsx | 80 - src/app/admin/hinweise/AnnouncementForm.tsx | 81 +- .../hinweise/DeleteAnnouncementButton.tsx | 6 +- src/app/admin/hinweise/page.tsx | 52 +- src/app/admin/layout.tsx | 20 +- src/app/admin/page.tsx | 164 +- .../redaktionen/[id]/alben/AlbumGrid.tsx | 144 +- src/app/admin/redaktionen/[id]/alben/page.tsx | 60 +- .../redaktionen/[id]/auto-regeln/page.tsx | 59 +- src/app/admin/redaktionen/page.tsx | 120 +- src/app/error.tsx | 38 +- src/app/globals.css | 2001 +---------------- src/app/layout.tsx | 10 +- src/app/page.tsx | 38 +- src/app/redaktion/abrechnungen/page.tsx | 163 +- src/app/redaktion/alben/[albumId]/loading.tsx | 8 +- src/app/redaktion/alben/[albumId]/page.tsx | 74 +- src/app/redaktion/alben/loading.tsx | 8 +- src/app/redaktion/alben/page.tsx | 97 +- src/app/redaktion/layout.tsx | 17 +- .../leuchtkasten/DownloadLightboxForm.tsx | 85 +- .../leuchtkasten/LightboxToggleButton.tsx | 32 +- .../leuchtkasten/RemoveLightboxItemButton.tsx | 30 +- src/app/redaktion/leuchtkasten/page.tsx | 35 +- src/app/redaktion/nutzungen/page.tsx | 10 +- .../nutzungen/usage-history-content.tsx | 88 +- src/app/redaktion/profil/page.tsx | 5 +- src/app/zwei-faktor/page.tsx | 24 +- src/app/zwei-faktor/wizard.tsx | 76 +- src/components/admin/album-grant-form.tsx | 30 - src/components/admin/approve-form.tsx | 38 - src/components/brand/logo.test.tsx | 52 - src/components/brand/logo.tsx | 18 - src/components/download/usage-dialog.tsx | 16 +- src/components/layout/app-shell.test.tsx | 76 + src/components/layout/app-shell.tsx | 191 ++ src/components/layout/logout-button.tsx | 33 - .../layout/mobile-portal-menu.test.tsx | 94 - src/components/layout/mobile-portal-menu.tsx | 104 - src/components/layout/portal-shell.tsx | 62 - src/components/layout/public-shell.tsx | 51 + src/components/layout/release-notes.tsx | 106 + src/components/theme-toggle.tsx | 23 - src/components/ui/button.tsx | 90 +- src/components/ui/card.tsx | 87 +- src/components/ui/input.tsx | 29 +- src/components/ui/page-header.tsx | 23 +- src/components/ui/sakani.test.tsx | 24 + src/components/ui/sakani.tsx | 55 + src/instrumentation.test.ts | 24 + src/instrumentation.ts | 6 + src/modules/albums/catalog-content.tsx | 123 +- src/modules/albums/photo-gallery.tsx | 22 +- .../announcements/announcement-banner.tsx | 24 +- src/modules/auth/public-forms.test.tsx | 18 +- src/modules/auth/public-forms.tsx | 151 +- src/modules/editorials/ApproveForm.tsx | 22 +- src/modules/editorials/DangerZone.tsx | 26 +- src/modules/editorials/ResetUsageCard.tsx | 18 +- src/modules/editorials/admin-detail.tsx | 119 +- src/test/dom-shims.ts | 37 + vitest.config.ts | 1 + 79 files changed, 2266 insertions(+), 4316 deletions(-) create mode 100644 compose.parallel.yaml delete mode 100644 src/app/admin/downloads-chart-lazy.tsx delete mode 100644 src/app/admin/downloads-chart.tsx delete mode 100644 src/components/admin/album-grant-form.tsx delete mode 100644 src/components/admin/approve-form.tsx delete mode 100644 src/components/brand/logo.test.tsx delete mode 100644 src/components/brand/logo.tsx create mode 100644 src/components/layout/app-shell.test.tsx create mode 100644 src/components/layout/app-shell.tsx delete mode 100644 src/components/layout/logout-button.tsx delete mode 100644 src/components/layout/mobile-portal-menu.test.tsx delete mode 100644 src/components/layout/mobile-portal-menu.tsx delete mode 100644 src/components/layout/portal-shell.tsx create mode 100644 src/components/layout/public-shell.tsx create mode 100644 src/components/layout/release-notes.tsx delete mode 100644 src/components/theme-toggle.tsx create mode 100644 src/components/ui/sakani.test.tsx create mode 100644 src/components/ui/sakani.tsx create mode 100644 src/instrumentation.test.ts create mode 100644 src/test/dom-shims.ts diff --git a/.env.example b/.env.example index eee0066..67b3463 100644 --- a/.env.example +++ b/.env.example @@ -26,3 +26,9 @@ LEGAL_TERMS_URL=https://leon-tonhaeuser.de/agb # Optional bearer token to trigger the sync externally via # POST /api/cron/album-sync (Authorization: Bearer ). # CRON_SECRET=replace-with-a-long-random-secret + +# Parallel run of the new UI (see docs/operations.md §8). Only needed while +# compose.parallel.yaml is in use; the parallel container sets +# AUTO_RULE_SYNC_DISABLED=true itself so the sync does not run twice. +# PARALLEL_BASE_URL=https://neu.redaktionen.leon-tonhaeuser.de +# PARALLEL_PORT=3001 diff --git a/compose.parallel.yaml b/compose.parallel.yaml new file mode 100644 index 0000000..c18212b --- /dev/null +++ b/compose.parallel.yaml @@ -0,0 +1,40 @@ +# Parallel run of the new (Sakani) UI next to the live portal: same database, +# same Immich, own subdomain. Run it from the LIVE checkout so the service joins +# the live compose project and its networks — see docs/operations.md §8: +# +# docker compose -f compose.yaml -f ../portal-sakani/compose.parallel.yaml up -d portal-app-next +# +# The image is built beforehand from the Sakani branch checkout: +# docker build -t portal-app:sakani ../portal-sakani +services: + portal-app-next: + image: ${PARALLEL_IMAGE:-portal-app:sakani} + container_name: portal-app-next + restart: unless-stopped + ports: + - "${PARALLEL_PORT:-3001}:3000" + environment: + DATABASE_URL: ${DATABASE_URL:-postgres://portal:change-me@portal-db:5432/portal} + BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET} + # Public URL of the parallel instance (links in e-mails, auth callbacks). + BETTER_AUTH_URL: ${PARALLEL_BASE_URL:?set PARALLEL_BASE_URL in .env, e.g. https://neu.redaktionen.leon-tonhaeuser.de} + IMMICH_BASE_URL: ${IMMICH_BASE_URL} + IMMICH_API_KEY: ${IMMICH_API_KEY} + SMTP_HOST: ${SMTP_HOST} + SMTP_PORT: ${SMTP_PORT:-587} + SMTP_USER: ${SMTP_USER} + SMTP_PASSWORD: ${SMTP_PASSWORD} + SMTP_FROM: ${SMTP_FROM} + LEGAL_IMPRINT_URL: ${LEGAL_IMPRINT_URL:-https://leon-tonhaeuser.de/impressum} + LEGAL_PRIVACY_URL: ${LEGAL_PRIVACY_URL:-https://leon-tonhaeuser.de/datenschutz} + LEGAL_TERMS_URL: ${LEGAL_TERMS_URL:-https://leon-tonhaeuser.de/agb} + # The live instance keeps running the album auto-rule sync and the cron + # endpoint; the parallel one must not do either a second time. + AUTO_RULE_SYNC_DISABLED: "true" + CRON_SECRET: "" + depends_on: + portal-db: + condition: service_healthy + networks: + - portal-internal + - immich_default diff --git a/docs/operations.md b/docs/operations.md index 6996cad..3b20632 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -36,6 +36,7 @@ All production configuration is provided via environment variables (e.g. `.env` | `LEGAL_TERMS_URL` | Public Nutzungsbedingungen link | `https://leon-tonhaeuser.de/agb` | | `AUTO_RULE_SYNC_INTERVAL_SECONDS` | Interval of the album auto-rule sync in seconds (min 30) | `120` (default) | | `CRON_SECRET` | Optional bearer token for `POST /api/cron/album-sync`; unset disables the endpoint | `openssl rand -hex 32` | +| `AUTO_RULE_SYNC_DISABLED` | `true` skips the in-process album auto-rule sync (for a second instance on the same DB, see §8) | unset (sync runs) | --- @@ -139,3 +140,65 @@ docker compose start portal-app - `GET /api/health/live` -> 200 OK (Process liveness). - `GET /api/health/ready` -> 200 OK (Database & Immich connectivity). - **Audit Log Inspection**: Accessible in portal UI under `/admin/audit` (Admin role required). + +--- + +## 8. Parallel Run of the New UI (Sakani) and Cutover + +The Sakani redesign can run next to the live portal on its own subdomain, against +the **same database and Immich**, until it is accepted. The branch contains no +database migrations, so both versions work on the same schema. + +**What "parallel" means in practice** + +- Every action in the new UI is real: approvals, album grants, downloads, usages, + billing reports and announcements land in the production database. +- Sessions are per domain: users log in separately on the new subdomain. +- E-mails sent by the parallel instance (verification, password reset, album + notifications) link to the new subdomain (`PARALLEL_BASE_URL`). +- Only the live instance runs the album auto-rule sync and the cron endpoint; the + parallel one has `AUTO_RULE_SYNC_DISABLED=true` and no `CRON_SECRET`. + +**Start the parallel instance** (on the server, next to the live checkout): + +1. Push the branch, then check it out beside the live checkout: + ```bash + git fetch origin && git worktree add ../portal-sakani origin/ + ``` +2. Build its image: + ```bash + docker build -t portal-app:sakani ../portal-sakani + ``` +3. In the live `.env`, add the public URL of the new subdomain: + ```bash + PARALLEL_BASE_URL=https://neu.redaktionen.leon-tonhaeuser.de + ``` +4. Start it from the **live** checkout (so it joins the live networks and DB): + ```bash + docker compose -f compose.yaml -f ../portal-sakani/compose.parallel.yaml up -d portal-app-next + ``` +5. DNS: point the subdomain at the server. Reverse proxy (Zoraxy): add a rule + `neu.redaktionen…` → `localhost:3001` with the same settings as the live rule + (no buffering for `/api/downloads/`, `X-Forwarded-For` as described in §3). +6. Smoke test: `GET https:///api/health/ready` → 200, then log in as + admin and as an editorial account. + +**Update the parallel instance** after new commits on the branch: +`git -C ../portal-sakani pull`, rebuild the image (step 2), re-run step 4. + +**Roll back** at any time: stop only the parallel container — the live portal is +untouched. +```bash +docker compose -f compose.yaml -f ../portal-sakani/compose.parallel.yaml rm -sf portal-app-next +``` + +**Cutover** (the new UI replaces the old one on the main domain): + +1. Merge the Sakani branch into `main`. +2. In the live checkout: `git pull`, then + `docker compose build portal-app && docker compose up -d portal-app`. + (`BETTER_AUTH_URL` stays the main domain; no other env changes are needed.) +3. Stop the parallel container (rollback command above), remove the Zoraxy rule + or turn it into a redirect to the main domain, delete `PARALLEL_BASE_URL` from + `.env`, and `git worktree remove ../portal-sakani`. + diff --git a/package.json b/package.json index 7f97e3d..b07c4e3 100644 --- a/package.json +++ b/package.json @@ -17,13 +17,14 @@ }, "dependencies": { "@better-auth/drizzle-adapter": "^1.6.26", + "@fontsource-variable/geist": "^5.3.0", "@js-temporal/polyfill": "^0.5.1", "@radix-ui/react-slot": "^1.3.3", + "@sakaniui/react": "^0.23.0", "archiver": "^8.0.0", "better-auth": "^1.6.26", "clsx": "^2.1.1", "drizzle-orm": "^0.45.2", - "lucide-react": "^1.31.0", "next": "^16.3.0", "next-themes": "^0.4.6", "nodemailer": "^9.0.5", @@ -31,7 +32,6 @@ "pg": "^8.22.0", "react": "^19.2.8", "react-dom": "^19.2.8", - "recharts": "^3.10.1", "server-only": "^0.0.1", "sharp": "^0.35.3", "tailwind-merge": "^3.6.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3082bc8..c836bb6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,12 +11,18 @@ importers: '@better-auth/drizzle-adapter': specifier: ^1.6.26 version: 1.6.26(@better-auth/core@1.6.26(@better-auth/utils@0.4.2)(@better-fetch/fetch@1.3.1)(better-call@1.3.7(zod@4.4.3))(jose@6.2.8)(kysely@0.29.4)(nanostores@1.4.2))(@better-auth/utils@0.4.2)(drizzle-orm@0.45.2(@types/pg@8.21.0)(kysely@0.29.4)(pg@8.22.0)) + '@fontsource-variable/geist': + specifier: ^5.3.0 + version: 5.3.0 '@js-temporal/polyfill': specifier: ^0.5.1 version: 0.5.1 '@radix-ui/react-slot': specifier: ^1.3.3 version: 1.3.3(@types/react@19.2.18)(react@19.2.8) + '@sakaniui/react': + specifier: ^0.23.0 + version: 0.23.0(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react-is@17.0.2)(react@19.2.8)(redux@5.0.1) archiver: specifier: ^8.0.0 version: 8.0.0 @@ -29,9 +35,6 @@ importers: drizzle-orm: specifier: ^0.45.2 version: 0.45.2(@types/pg@8.21.0)(kysely@0.29.4)(pg@8.22.0) - lucide-react: - specifier: ^1.31.0 - version: 1.31.0(react@19.2.8) next: specifier: ^16.3.0 version: 16.3.0(@babel/core@7.29.7)(@playwright/test@1.62.1)(@types/node@24.13.3)(react-dom@19.2.8(react@19.2.8))(react@19.2.8) @@ -53,9 +56,6 @@ importers: react-dom: specifier: ^19.2.8 version: 19.2.8(react@19.2.8) - recharts: - specifier: ^3.10.1 - version: 3.10.1(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react-is@17.0.2)(react@19.2.8)(redux@5.0.1) server-only: specifier: ^0.0.1 version: 0.0.1 @@ -875,6 +875,9 @@ packages: '@noble/hashes': optional: true + '@fontsource-variable/geist@5.3.0': + resolution: {integrity: sha512-j0m+vLQuG5XAYoHtGCVu0spvlGreR3EzpECUVzkFmI1mTVnAO38l/NEPDCFgZ177JxzYJCLSmTQibIiYPilGrA==} + '@grpc/grpc-js@1.14.4': resolution: {integrity: sha512-k9Dj3DV/itK9D06Y8f190Qgop7/Ui+D0njFV3LHMPwPT75DpXLQohE9Wmz0QElrJnzsjB7KPWiKJbOl7IPDArQ==} engines: {node: '>=12.10.0'} @@ -1492,6 +1495,13 @@ packages: '@rtsao/scc@1.1.0': resolution: {integrity: sha512-zt6OdqaDoOnJ1ZYsCYGt9YmWzDXl4vQdKTyJev62gFhRGKdx7mcT54V9KIjg+d2wi9EXsPvAPKe7i7WjfVWB8g==} + '@sakaniui/react@0.23.0': + resolution: {integrity: sha512-9BnsvgacsDaERq0lQZNHuqNwfCSNhiPSkQLQMhH0mRSJ9K0I9Jz0Ht4W5HifuMAWnCwb3J6aZUEV6wpn7hk/kw==} + hasBin: true + peerDependencies: + react: ^19.0.0 + react-dom: ^19.0.0 + '@standard-schema/spec@1.1.0': resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} @@ -3462,11 +3472,6 @@ packages: lru-cache@5.1.1: resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} - lucide-react@1.31.0: - resolution: {integrity: sha512-G8u2eEtoHUnUa9f8lbvqDhCiORMnYLdUEo06EEG9MQvHQrInKcX3Pa2TH39MM5qyzRcWETxB0+aOwAPI1g1kEg==} - peerDependencies: - react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0 - lz-string@1.5.0: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} hasBin: true @@ -5090,6 +5095,8 @@ snapshots: optionalDependencies: '@noble/hashes': 2.3.0 + '@fontsource-variable/geist@5.3.0': {} + '@grpc/grpc-js@1.14.4': dependencies: '@grpc/proto-loader': 0.8.1 @@ -5530,6 +5537,16 @@ snapshots: '@rtsao/scc@1.1.0': {} + '@sakaniui/react@0.23.0(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react-is@17.0.2)(react@19.2.8)(redux@5.0.1)': + dependencies: + react: 19.2.8 + react-dom: 19.2.8(react@19.2.8) + recharts: 3.10.1(@types/react@19.2.18)(react-dom@19.2.8(react@19.2.8))(react-is@17.0.2)(react@19.2.8)(redux@5.0.1) + transitivePeerDependencies: + - '@types/react' + - react-is + - redux + '@standard-schema/spec@1.1.0': {} '@standard-schema/utils@0.3.0': {} @@ -7578,10 +7595,6 @@ snapshots: dependencies: yallist: 3.1.1 - lucide-react@1.31.0(react@19.2.8): - dependencies: - react: 19.2.8 - lz-string@1.5.0: {} magic-string@0.30.21: diff --git a/src/app/(public)/anmelden/page.tsx b/src/app/(public)/anmelden/page.tsx index 283ab32..ff0892a 100644 --- a/src/app/(public)/anmelden/page.tsx +++ b/src/app/(public)/anmelden/page.tsx @@ -1,26 +1,21 @@ import Link from "next/link"; +import { PublicShell } from "@/components/layout/public-shell"; import { LoginForm } from "@/modules/auth/public-forms"; export default function LoginPage() { return ( -
-
- - Leon Tonhäuser - - Redaktionsportal -
-
-

Zugang

-

Anmelden

-

Melden Sie sich mit der E-Mail-Adresse Ihrer Redaktion an.

- - -
-
+ + + + ); } diff --git a/src/app/(public)/passwort-vergessen/page.tsx b/src/app/(public)/passwort-vergessen/page.tsx index 74da6ac..f5773ee 100644 --- a/src/app/(public)/passwort-vergessen/page.tsx +++ b/src/app/(public)/passwort-vergessen/page.tsx @@ -1,25 +1,15 @@ import Link from "next/link"; +import { PublicShell } from "@/components/layout/public-shell"; import { PasswordResetRequestForm } from "@/modules/auth/public-forms"; export default function ForgotPasswordPage() { return ( -
-
- - Leon Tonhäuser - - Redaktionsportal -
-
-

Zugang

-

Passwort vergessen?

-

Fordern Sie einen Link zum Zurücksetzen Ihres Passworts an.

- - -
-
+ + + + ); } diff --git a/src/app/(public)/passwort-zuruecksetzen/page.tsx b/src/app/(public)/passwort-zuruecksetzen/page.tsx index 70413b8..3c3d0e1 100644 --- a/src/app/(public)/passwort-zuruecksetzen/page.tsx +++ b/src/app/(public)/passwort-zuruecksetzen/page.tsx @@ -1,5 +1,6 @@ import Link from "next/link"; +import { PublicShell } from "@/components/layout/public-shell"; import { PasswordResetForm } from "@/modules/auth/public-forms"; export default async function ResetPasswordPage({ @@ -10,22 +11,11 @@ export default async function ResetPasswordPage({ const { token } = await searchParams; return ( -
-
- - Leon Tonhäuser - - Redaktionsportal -
-
-

Zugang

-

Neues Passwort setzen

-

Wählen Sie ein neues Passwort für den Zugang Ihrer Redaktion.

- - -
-
+ + + + ); } diff --git a/src/app/(public)/registrieren/bestaetigt/page.tsx b/src/app/(public)/registrieren/bestaetigt/page.tsx index 082f879..0c14038 100644 --- a/src/app/(public)/registrieren/bestaetigt/page.tsx +++ b/src/app/(public)/registrieren/bestaetigt/page.tsx @@ -1,25 +1,21 @@ import Link from "next/link"; +import { PublicShell } from "@/components/layout/public-shell"; +import { Button } from "@/components/ui/button"; + export default function RegistrationConfirmedPage() { return ( -
-
- - Leon Tonhäuser - - Redaktionsportal -
-
-

Registrierung

-

Vielen Dank.

-

- Bitte folgen Sie den weiteren Hinweisen, die wir Ihnen gegebenenfalls zusenden. Danach - prüfen wir Ihre Registrierung. -

- - Zur Anmeldung - -
-
+ +
+ +
+
); } diff --git a/src/app/(public)/registrieren/page.tsx b/src/app/(public)/registrieren/page.tsx index 954438e..02936a8 100644 --- a/src/app/(public)/registrieren/page.tsx +++ b/src/app/(public)/registrieren/page.tsx @@ -1,7 +1,7 @@ -import Link from "next/link"; import { redirect } from "next/navigation"; import { headers } from "next/headers"; +import { PublicShell } from "@/components/layout/public-shell"; import { env } from "@/config/env"; import { registerEditorial } from "@/modules/auth/auth"; import { @@ -16,29 +16,22 @@ import { RateLimitExceededError } from "@/modules/security/rate-limit-guard"; export default function RegistrationPage() { return ( -
-
- - Leon Tonhäuser - - Redaktionsportal -
-
-

B2B-Zugang

-

Redaktion registrieren

-

- Das Redaktionsportal steht ausschließlich Unternehmen und Redaktionen zur Verfügung. -

- -
-
+ + + ); } diff --git a/src/app/admin/abrechnungen/[editorialId]/BillingSelection.tsx b/src/app/admin/abrechnungen/[editorialId]/BillingSelection.tsx index 8e0464d..d00e588 100644 --- a/src/app/admin/abrechnungen/[editorialId]/BillingSelection.tsx +++ b/src/app/admin/abrechnungen/[editorialId]/BillingSelection.tsx @@ -2,6 +2,11 @@ import { useMemo, useState } from "react"; import Link from "next/link"; +import { Alert, Badge, Checkbox, EmptyState, Table, Textarea } from "@sakaniui/react"; +import { IconDownload, IconFileText } from "@sakaniui/react/icons"; + +import { Button } from "@/components/ui/button"; +import { Card, FormSelect } from "@/components/ui/sakani"; import type { BillingPosition, RepeatDownloadPosition } from "@/modules/billing/queries"; import { formatCents } from "@/modules/billing/format"; @@ -40,6 +45,12 @@ const STATUS_LABELS: Record = { reopened: "Wiedereröffnet", }; +const STATUS_BADGES: Record = { + open: "warning", + billed: "success", + reopened: "warning", +}; + const REPORT_STATUS_LABELS: Record = { draft: "Entwurf", final: "Erstellt", @@ -172,178 +183,162 @@ export function BillingSelection({ <> -
- - {isQuarter ? ( - - Monatsansicht - - ) : ( - - Ganzes Quartal - - )} - + + + +

+ Zeitraum: {periodLabel} +

-

- Zeitraum: {periodLabel} -

- - {positions.length === 0 ? ( -

Keine abrechenbaren Nutzungen in diesem Zeitraum.

- ) : ( - - - - - - - - - - - - - - - {positions.map((position) => ( - - - - - - - - - - ))} - -
- Abrechenbare Nutzungen -
AuswahlDateiAlbumZweckReferenzPreisStatus
- togglePosition(position.id)} - disabled={!position.selectable} +
+

Abrechenbare Nutzungen

+ {positions.length === 0 ? ( + + ) : ( + + rowKey={(position) => position.id} + rows={positions} + columns={[ + { + key: "id", + header: "Auswahl", + render: (position) => ( + togglePosition(position.id)} /> -
{position.filename}{position.albumName}{position.purpose}{position.reference ?? "—"}{formatCents(position.priceCents)} - - {STATUS_LABELS[position.status]} + ), + }, + { key: "filename", header: "Datei" }, + { key: "albumName", header: "Album" }, + { key: "purpose", header: "Zweck" }, + { key: "reference", header: "Referenz", render: (position) => position.reference ?? "—" }, + { + key: "priceCents", + header: "Preis", + align: "right", + render: (position) => {formatCents(position.priceCents)}, + }, + { + key: "status", + header: "Status", + render: (position) => ( + + {STATUS_LABELS[position.status]} {position.status === "billed" && position.reportNumber !== null && ( - - {" "}· Bericht Nr. {position.reportNumber} + + Bericht Nr. {position.reportNumber} {position.invoiceNumber ? ` · ${position.invoiceNumber}` : ""} )} -
- )} + ), + }, + ]} + /> + )} + {repeatDownloads.length > 0 && ( -
-

Kostenlose Wiederabrufe

-

+

+

Kostenlose Wiederabrufe

+

Wiederholte Downloads rufen bereits abgerechnete Nutzungen erneut ab und sind nicht abrechenbar.

- - - - - - - - - - - - {repeatDownloads.map((download) => ( - - - - - - - ))} - -
Wiederabrufe im Zeitraum
DateiDatumStatusNotiz
{download.assetId} - - {download.status}{download.repeatDownloadNote ?? "—"}
+ + rowKey={(download) => download.id} + rows={repeatDownloads} + columns={[ + { key: "assetId", header: "Datei" }, + { + key: "authorizedAt", + header: "Datum", + render: (download) => ( + + ), + }, + { key: "status", header: "Status" }, + { key: "repeatDownloadNote", header: "Notiz", render: (download) => download.repeatDownloadNote ?? "—" }, + ]} + />
)} -
-

- {selectedCount} {selectedCount === 1 ? "Nutzung" : "Nutzungen"} ausgewählt -

-

- Summe: {formatCents(selectedTotalCents)} -

-
- -
- - -
- - {actionState.message && ( -

- {actionState.message} -

- )} + +
+
+

+ {selectedCount} {selectedCount === 1 ? "Nutzung" : "Nutzungen"} ausgewählt +

+

+ Summe: {formatCents(selectedTotalCents)} +

+
+
+ + +
+
+ {actionState.message && ( +
+ +
+ )} +
{reports.length > 0 && ( -
-

Erstellte Abrechnungen

-
    +
    +

    Erstellte Abrechnungen

    +
      {reports.map((report) => (
    • -
      - Bericht Nr. {report.reportNumber} - {report.invoiceNumber && {report.invoiceNumber}} - Summe: {formatCents(report.netTotalCents)} - Status: {REPORT_STATUS_LABELS[report.status] ?? report.status} - - Erstellt am:{" "} - - -
      - {report.status === "final" && ( - <> + +
      + + + {report.invoiceNumber && {report.invoiceNumber}} + Summe: {formatCents(report.netTotalCents)} + + {REPORT_STATUS_LABELS[report.status] ?? report.status} + + + Erstellt am:{" "} + + + {report.status === "final" && ( + + )} +
      + {report.status === "final" && ( - - PDF herunterladen - - - )} + )} +
    • ))}
    @@ -364,42 +359,33 @@ function PeriodSelector({ year, month, quarter, isQuarter }: PeriodSelectorProps const years = [2025, 2026, 2027]; return ( -
    - - {isQuarter ? ( - - ) : ( - - )} - -
    + +
    +
    + ({ label: String(y), value: String(y) }))} /> +
    + {isQuarter ? ( +
    + ({ label: `Q${q}`, value: String(q) }))} + /> +
    + ) : ( +
    + ({ label: name, value: String(index + 1) }))} + /> +
    + )} + +
    +
    ); } @@ -440,38 +426,28 @@ function CancelReportForm({ reportId, reportNumber }: CancelReportFormProps) { } return ( -
    -