From 8728308fc6ea6703d2ddd91caa03c9843c7e2a4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Tonh=C3=A4user?= Date: Tue, 11 Aug 2026 03:38:34 +0200 Subject: [PATCH] feat: complete UI design system refactoring and fix TS build errors --- package.json | 5 + pnpm-lock.yaml | 77 ++++++ src/app/admin/page.tsx | 156 +++++++----- .../redaktionen/[id]/alben/page.test.tsx | 8 +- src/app/admin/redaktionen/[id]/alben/page.tsx | 65 ++--- .../api/billing-reports/finalize-handler.ts | 1 + .../preview/preview-handler.ts | 2 +- src/app/globals.css | 51 ++++ src/app/layout.tsx | 22 +- src/app/redaktion/abrechnungen/page.tsx | 156 +++++++----- src/app/redaktion/alben/page.tsx | 65 ++--- src/app/redaktion/leuchtkasten/page.tsx | 53 ++-- src/components/layout/logout-button.tsx | 11 +- src/components/layout/portal-shell.tsx | 44 ++-- src/components/theme-provider.tsx | 9 + src/components/theme-toggle.tsx | 32 +++ src/components/ui/button.tsx | 46 ++++ src/components/ui/card.tsx | 70 +++++ src/components/ui/input.tsx | 25 ++ src/lib/utils.ts | 6 + src/modules/albums/catalog-content.tsx | 1 + src/modules/billing/reports.test.ts | 6 + src/modules/billing/reports.ts | 1 + src/modules/editorials/DangerZone.tsx | 57 +++-- src/modules/editorials/admin-detail.tsx | 240 ++++++++++-------- src/modules/immich/types.ts | 4 + src/modules/lightbox/service.ts | 4 +- 27 files changed, 847 insertions(+), 370 deletions(-) create mode 100644 src/components/theme-provider.tsx create mode 100644 src/components/theme-toggle.tsx create mode 100644 src/components/ui/button.tsx create mode 100644 src/components/ui/card.tsx create mode 100644 src/components/ui/input.tsx create mode 100644 src/lib/utils.ts diff --git a/package.json b/package.json index e2d139c..744c8bc 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,13 @@ "dependencies": { "@better-auth/drizzle-adapter": "^1.6.26", "@js-temporal/polyfill": "^0.5.1", + "@radix-ui/react-slot": "^1.3.3", "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", "pdfmake": "~0.3.11", "pg": "^8.22.0", @@ -28,6 +32,7 @@ "react-dom": "^19.2.8", "server-only": "^0.0.1", "sharp": "^0.35.3", + "tailwind-merge": "^3.6.0", "zod": "^4.4.3" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 164b27f..ce256c2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -14,15 +14,27 @@ importers: '@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) better-auth: specifier: ^1.6.26 version: 1.6.26(drizzle-kit@0.31.10)(drizzle-orm@0.45.2(@types/pg@8.21.0)(kysely@0.29.4)(pg@8.22.0))(next@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))(pg@8.22.0)(react-dom@19.2.8(react@19.2.8))(react@19.2.8)(vitest@4.1.10(@types/node@24.13.3)(jsdom@30.0.1(@noble/hashes@2.3.0))(msw@2.15.0(@types/node@24.13.3)(typescript@5.9.3))(vite@8.2.1(@types/node@24.13.3)(esbuild@0.28.1)(jiti@2.7.0)(tsx@4.23.11)(yaml@2.9.0))) + clsx: + specifier: ^2.1.1 + version: 2.1.1 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) + next-themes: + specifier: ^0.4.6 + version: 0.4.6(react-dom@19.2.8(react@19.2.8))(react@19.2.8) nodemailer: specifier: ^9.0.5 version: 9.0.5 @@ -44,6 +56,9 @@ importers: sharp: specifier: ^0.35.3 version: 0.35.3(@types/node@24.13.3) + tailwind-merge: + specifier: ^3.6.0 + version: 3.6.0 zod: specifier: ^4.4.3 version: 4.4.3 @@ -1343,6 +1358,24 @@ packages: '@protobufjs/utf8@1.1.2': resolution: {integrity: sha512-b1UQwcEZ4yCnMCD8DAL1VlbvBJE9/IX4FTIp7BG1xYpf29SLazLSrqUkj4w7Y5y7cCVP6E5tcqqcI0xemPkHug==} + '@radix-ui/react-compose-refs@1.1.5': + resolution: {integrity: sha512-+48PbAAbq3didjJxa+OaWY2ZwgAKsNiRGyeHKszblZMQ+kcpd9pAaT11cMkGEie0vsOi3QdeTE6d5Fe3Gn61kA==} + peerDependencies: + '@types/react': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + peerDependenciesMeta: + '@types/react': + optional: true + + '@radix-ui/react-slot@1.3.3': + resolution: {integrity: sha512-qx7oqnYbxnK9kYI9m317qmFmEgo6ywqWvbTogdj7cL9p3/yx4M48p7Rnw5z3H890cL/ow/EeWJsuTykeZVXP5Q==} + peerDependencies: + '@types/react': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + peerDependenciesMeta: + '@types/react': + optional: true + '@rolldown/binding-android-arm64@1.2.3': resolution: {integrity: sha512-zrJtHDcaZJ1Fp7xf4hNl+7seH9Cn/N5TwLYkhgXREtBwAd/jaqW3uqeHxpDugJLVICWg4eW44kOQEGJ1r6jCGw==} engines: {node: ^20.19.0 || >=22.12.0} @@ -2207,6 +2240,10 @@ packages: resolution: {integrity: sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==} engines: {node: '>=0.8'} + clsx@2.1.1: + resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==} + engines: {node: '>=6'} + color-convert@2.0.1: resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==} engines: {node: '>=7.0.0'} @@ -3290,6 +3327,11 @@ 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 @@ -3383,6 +3425,12 @@ packages: natural-compare@1.4.0: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + next-themes@0.4.6: + resolution: {integrity: sha512-pZvgD5L0IEvX5/9GWyHMf3m8BKiVQwsCMHfoFosXtXBMnaS0ZnIJ9ST4b4NqLVKDEm8QBxoNNGNaBv2JNF6XNA==} + peerDependencies: + react: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc + react-dom: ^16.8 || ^17 || ^18 || ^19 || ^19.0.0-rc + next@16.3.0: resolution: {integrity: sha512-NEdGOzH+08eTXMUp9UYkA99Nhi5N6Thrhc1jgFOQgfgnGK/dA2hRwBpXep+exdFQrnwlRf/3Wixyp8lLBUpE2A==} engines: {node: '>=20.9.0'} @@ -3972,6 +4020,9 @@ packages: resolution: {integrity: sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng==} engines: {node: '>=20'} + tailwind-merge@3.6.0: + resolution: {integrity: sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w==} + tailwindcss@4.3.3: resolution: {integrity: sha512-gOhV3P7ufE62QDGg1zVaTgCR+EtPv92k2nIhVcVKcLmxT1sUBsQGhnZj175j+MqRt4zLF7ic+sCYjfhxMxj7YQ==} @@ -5223,6 +5274,19 @@ snapshots: '@protobufjs/utf8@1.1.2': {} + '@radix-ui/react-compose-refs@1.1.5(@types/react@19.2.18)(react@19.2.8)': + dependencies: + react: 19.2.8 + optionalDependencies: + '@types/react': 19.2.18 + + '@radix-ui/react-slot@1.3.3(@types/react@19.2.18)(react@19.2.8)': + dependencies: + '@radix-ui/react-compose-refs': 1.1.5(@types/react@19.2.18)(react@19.2.8) + react: 19.2.8 + optionalDependencies: + '@types/react': 19.2.18 + '@rolldown/binding-android-arm64@1.2.3': optional: true @@ -6016,6 +6080,8 @@ snapshots: clone@2.1.2: {} + clsx@2.1.1: {} + color-convert@2.0.1: dependencies: color-name: 1.1.4 @@ -7199,6 +7265,10 @@ 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: @@ -7282,6 +7352,11 @@ snapshots: natural-compare@1.4.0: {} + next-themes@0.4.6(react-dom@19.2.8(react@19.2.8))(react@19.2.8): + dependencies: + react: 19.2.8 + react-dom: 19.2.8(react@19.2.8) + next@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): dependencies: '@next/env': 16.3.0 @@ -7979,6 +8054,8 @@ snapshots: tagged-tag@1.0.0: {} + tailwind-merge@3.6.0: {} + tailwindcss@4.3.3: {} tapable@2.3.3: {} diff --git a/src/app/admin/page.tsx b/src/app/admin/page.tsx index 14a2ab6..45a10c8 100644 --- a/src/app/admin/page.tsx +++ b/src/app/admin/page.tsx @@ -4,6 +4,8 @@ import { usages, editorialAccounts } from "@/db/schema"; import { requireAdmin } from "@/modules/auth/principal"; import { headers } from "next/headers"; import Link from "next/link"; +import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; export default async function AdminDashboardPage() { await requireAdmin(new Headers(await headers())); @@ -48,87 +50,107 @@ export default async function AdminDashboardPage() { const formatter = new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }); return ( -
-

Admin Dashboard

-

Willkommen zurück! Hier ist ein Überblick über die aktuelle Nutzung des Portals.

+
+
+

Admin Dashboard

+

Willkommen zurück! Hier ist ein Überblick über die aktuelle Nutzung des Portals.

+
-
-
-

Umsatz diesen Monat

-

- {formatter.format((revenueStats?.totalCents ?? 0) / 100)} -

-

- {revenueStats?.count ?? 0} lizenzierte Bilder im {now.toLocaleString("de-DE", { month: "long" })} -

-
+
+ + + Umsatz diesen Monat + + +
+ {formatter.format((revenueStats?.totalCents ?? 0) / 100)} +
+

+ {revenueStats?.count ?? 0} lizenzierte Bilder im {now.toLocaleString("de-DE", { month: "long" })} +

+
+
-
- - Redaktionen verwalten - -
+ + + + +
-
-

Aktivste Redaktionen

-
+ + + Aktivste Redaktionen + Die Top 5 Redaktionen nach Downloads. + + {topEditorials.length === 0 ? ( -

Noch keine Daten vorhanden.

+

Noch keine Daten vorhanden.

) : ( - - - - - - - - - - {topEditorials.map(ed => ( - - - - +
+
RedaktionDownloadsUmsatz
- - {ed.name} - - {ed.downloadCount}{formatter.format(ed.revenueCents / 100)}
+ + + + + - ))} - -
RedaktionDownloadsUmsatz
+ + + {topEditorials.map((ed, i) => ( + + + + {ed.name} + + + {ed.downloadCount} + {formatter.format(ed.revenueCents / 100)} + + ))} + + +
)} -
-
+ + -
-

Beliebteste Alben

-
+ + + Beliebteste Alben + Die Top 5 Alben nach Nutzung. + + {topAlbums.length === 0 ? ( -

Noch keine Daten vorhanden.

+

Noch keine Daten vorhanden.

) : ( - - - - - - - - - {topAlbums.map(album => ( - - - +
+
AlbumDownloads
{album.albumName}{album.downloadCount}
+ + + + - ))} - -
AlbumDownloads
+ + + {topAlbums.map((album, i) => ( + + {album.albumName} + {album.downloadCount} + + ))} + + +
)} -
-
+ +
-
+ ); } \ No newline at end of file diff --git a/src/app/admin/redaktionen/[id]/alben/page.test.tsx b/src/app/admin/redaktionen/[id]/alben/page.test.tsx index 97c2381..19b703b 100644 --- a/src/app/admin/redaktionen/[id]/alben/page.test.tsx +++ b/src/app/admin/redaktionen/[id]/alben/page.test.tsx @@ -11,10 +11,14 @@ const editorial = { id: "00000000-0000-4000-8000-000000000001", name: "Neue Redaktion", contactName: "Mara Muster", - loginEmail: "mara@example.com", + loginEmail: "foo@bar.com", status: "pending_approval" as const, emailVerifiedAt: null, - currentPriceCents: null, archivedAt: null, + currentPriceCents: null, + flatrateActive: false, + flatratePriceCents: null, + flatrateAssetLimit: null, + archivedAt: null, }; test("the editorial detail links admins to its album-assignment page", () => { diff --git a/src/app/admin/redaktionen/[id]/alben/page.tsx b/src/app/admin/redaktionen/[id]/alben/page.tsx index 411e926..3a38fb2 100644 --- a/src/app/admin/redaktionen/[id]/alben/page.tsx +++ b/src/app/admin/redaktionen/[id]/alben/page.tsx @@ -28,43 +28,46 @@ export default async function EditorialAlbumsPage({ if (albumResult.unavailable) { return ( -
-

Redaktion · Albumrechte

-

Alben für {editorial.name}

-

- Die Immich-Alben sind momentan nicht erreichbar. Bereits bestehende Zuweisungen bleiben - unverändert. -

-

- Zurück zur Redaktion -

-
+
+
+

Redaktion · Albumrechte

+

Alben für {editorial.name}

+
+
+ Die Immich-Alben sind momentan nicht erreichbar. Bereits bestehende Zuweisungen bleiben unverändert. +
+
+ Zurück zur Redaktion +
+
); } return ( -
-

Redaktion · Albumrechte

-

Alben für {editorial.name}

-

+

+
+

Redaktion · Albumrechte

+

Alben für {editorial.name}

+

Nur Alben, die der technische Immich-Zugang lesen kann, lassen sich zuweisen.

-

- Zurück zur Redaktion - {" · "} - Auto-Zuweisungsregeln verwalten -

+
+ Zurück zur Redaktion + · + Auto-Zuweisungsregeln verwalten +
+
- {albumResult.albums.length === 0 ? ( -

Derzeit sind keine zuweisbaren Alben vorhanden.

- ) : ( - - )} -
+ {albumResult.albums.length === 0 ? ( +

Derzeit sind keine zuweisbaren Alben vorhanden.

+ ) : ( + + )} + ); } diff --git a/src/app/api/billing-reports/finalize-handler.ts b/src/app/api/billing-reports/finalize-handler.ts index f0503a3..f8350e9 100644 --- a/src/app/api/billing-reports/finalize-handler.ts +++ b/src/app/api/billing-reports/finalize-handler.ts @@ -48,6 +48,7 @@ export function createFinalizeHandler(dependencies: FinalizeHandlerDependencies) usageIds, period, adminUserId: principal.userId, + flatrateCentsSnapshot: null, }); // Email dispatch diff --git a/src/app/api/billing-reports/preview/preview-handler.ts b/src/app/api/billing-reports/preview/preview-handler.ts index 341a7e5..81685d5 100644 --- a/src/app/api/billing-reports/preview/preview-handler.ts +++ b/src/app/api/billing-reports/preview/preview-handler.ts @@ -34,7 +34,7 @@ export function createPreviewHandler(dependencies: PreviewHandlerDependencies) { const { editorialId, usageIds, year, month, quarter } = payload.data; const period = month ? monthPeriod(year, month) : quarterPeriod(year, quarter!); - const bytes = await dependencies.previewReport({ editorialId, usageIds, period }); + const bytes = await dependencies.previewReport({ editorialId, usageIds, period, flatrateCentsSnapshot: null }); return new Response(new Uint8Array(bytes), { status: 200, diff --git a/src/app/globals.css b/src/app/globals.css index 79ac422..5393461 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -1,6 +1,28 @@ @import "tailwindcss"; +@theme { + --color-primary-50: #eef2ff; + --color-primary-100: #e0e7ff; + --color-primary-200: #c7d2fe; + --color-primary-300: #a5b4fc; + --color-primary-400: #818cf8; + --color-primary-500: #6366f1; + --color-primary-600: #4f46e5; + --color-primary-700: #4338ca; + --color-primary-800: #3730a3; + --color-primary-900: #312e81; + + --color-background: var(--bg-main); + --color-foreground: var(--text-main); + --color-card: var(--bg-card); + --color-card-foreground: var(--text-card); + --color-border: var(--border-color); + + --font-sans: "Inter", "Helvetica Neue", Arial, sans-serif; +} + :root { + /* Legacy Vars */ --paper: #ffffff; --ink: #050505; --graphite: #242424; @@ -9,9 +31,38 @@ --muted: var(--metadata); --line: #d8d8d8; --soft: #f3f3f3; + + /* New Design System Vars */ + --bg-main: #f8fafc; + --text-main: #0f172a; + --bg-card: #ffffff; + --text-card: #1e293b; + --border-color: #e2e8f0; + color-scheme: light; } +.dark { + /* Legacy Vars - Adjusted for Dark Mode */ + --paper: #09090b; + --ink: #fafafa; + --graphite: #d4d4d8; + --contact-sheet: #18181b; + --metadata: #a1a1aa; + --muted: var(--metadata); + --line: #27272a; + --soft: #27272a; + + /* New Design System Vars */ + --bg-main: #020617; + --text-main: #f8fafc; + --bg-card: #0f172a; + --text-card: #f1f5f9; + --border-color: #1e293b; + + color-scheme: dark; +} + * { box-sizing: border-box; } diff --git a/src/app/layout.tsx b/src/app/layout.tsx index b54236a..dd15f9e 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -4,6 +4,11 @@ import "./globals.css"; import { LegalFooter } from "@/components/layout/legal-footer"; +import { ThemeProvider } from "@/components/theme-provider"; +import { Inter } from "next/font/google"; + +const inter = Inter({ subsets: ["latin"], variable: "--font-sans" }); + export const metadata: Metadata = { title: "Redaktionsportal | Leon Tonhäuser", description: "Ausgewählte Pressefotos sicher finden und nutzen.", @@ -11,10 +16,19 @@ export const metadata: Metadata = { export default function RootLayout({ children }: Readonly<{ children: ReactNode }>) { return ( - - - {children} - + + + +
+ {children} +
+ +
); diff --git a/src/app/redaktion/abrechnungen/page.tsx b/src/app/redaktion/abrechnungen/page.tsx index d57312d..291d056 100644 --- a/src/app/redaktion/abrechnungen/page.tsx +++ b/src/app/redaktion/abrechnungen/page.tsx @@ -5,6 +5,8 @@ import { requireActiveEditorial } from "@/modules/auth/principal"; import { headers } from "next/headers"; import Link from "next/link"; import { formatBerlinDateTime } from "@/modules/downloads/format"; +import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card"; +import { FileText } from "lucide-react"; export default async function AbrechnungenPage() { const principal = await requireActiveEditorial(new Headers(await headers())); @@ -80,88 +82,106 @@ export default async function AbrechnungenPage() { const openTotalCents = (openUsages?.totalCents ?? 0); return ( -
-

Finanzen

-

Meine Abrechnungen

+
+
+

Finanzen

+

Meine Abrechnungen

+
-
-

Offener Betrag (Einzelabrufe)

-

- {new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(openTotalCents / 100)} -

-

- Für {openUsages?.count ?? 0} kostenpflichtige Bilder (noch nicht in Rechnung gestellt) -

-
+ + + Offener Betrag (Einzelabrufe) + + +

+ {new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(openTotalCents / 100)} +

+

+ Für {openUsages?.count ?? 0} kostenpflichtige Bilder (noch nicht in Rechnung gestellt) +

+
+
{editorial?.flatrateActive && editorial.flatratePriceCents !== null && ( -
-

Aktiver Tarif: Flatrate

-

- {new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(editorial.flatratePriceCents / 100)} / Monat -

- {editorial.flatrateAssetLimit === null ? ( -

- Unbegrenzte Downloads inklusive + + + Aktiver Tarif: Flatrate + + +

+ {new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(editorial.flatratePriceCents / 100)} + / Monat

- ) : ( -
-

- Inklusiv-Bilder diesen Monat: {usedFlatrateImages} / {editorial.flatrateAssetLimit} + {editorial.flatrateAssetLimit === null ? ( +

+ Unbegrenzte Downloads inklusive

-
-
+ ) : ( +
+
+ Inklusiv-Bilder diesen Monat + {usedFlatrateImages} / {editorial.flatrateAssetLimit} +
+
+
+
-
- )} -
+ )} + + )}
-

Bisherige Rechnungen

+
+

Bisherige Rechnungen

{reports.length === 0 ? ( -

Es liegen noch keine abgerechneten Zeiträume vor.

+ + +

Es liegen noch keine abgerechneten Zeiträume vor.

+
+
) : ( -
- - - - - - - - - - - {reports.map((report) => ( - - - - - + +
+
RechnungsnummerZeitraumBetrag (Netto)Download
{report.invoiceNumber} - {new Intl.DateTimeFormat("de-DE", { month: "long", year: "numeric" }).format(report.periodStartsAt)} - - {new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(report.netTotalCents / 100)} - - - - - - PDF anzeigen - -
+ + + + + + - ))} - -
RechnungsnummerZeitraumBetrag (Netto)Download
-
+ + + {reports.map((report, i) => ( + + {report.invoiceNumber} + + {new Intl.DateTimeFormat("de-DE", { month: "long", year: "numeric" }).format(report.periodStartsAt)} + + + {new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(report.netTotalCents / 100)} + + + + + PDF + + + + ))} + + +
+ )} -
+ + ); } diff --git a/src/app/redaktion/alben/page.tsx b/src/app/redaktion/alben/page.tsx index d6caf1d..55cc635 100644 --- a/src/app/redaktion/alben/page.tsx +++ b/src/app/redaktion/alben/page.tsx @@ -4,6 +4,8 @@ import { loadEditorialDownloadOptions } from "@/modules/downloads/stream"; import { lightboxService } from "@/modules/lightbox/service"; import type { ImmichSearchPage } from "@/modules/immich/types"; import Link from "next/link"; +import { Input } from "@/components/ui/input"; +import { Button } from "@/components/ui/button"; import { requireEditorial } from "../access"; @@ -53,10 +55,10 @@ export default async function AlbumsPage({ searchParams }: { searchParams: Promi const lightboxAssetIds = new Set(lightboxItems.map(i => i.assetId)); return ( -
-

Bildarchiv · Suche

-
-

Suchergebnisse

+
+
+

Bildarchiv · Suche

+

Suchergebnisse

-
+ ); } @@ -79,19 +81,19 @@ export default async function AlbumsPage({ searchParams }: { searchParams: Promi } return ( -
-

Bildarchiv · Freigaben

-
-

Ihre Alben

-

Wählen Sie ein Spiel oder eine Serie, um die freigegebenen Fotos zu durchsuchen.

+
+
+

Bildarchiv · Freigaben

+

Ihre Alben

+

Wählen Sie ein Spiel oder eine Serie, um die freigegebenen Fotos zu durchsuchen.

{result.albums.length === 0 ? ( -

Für Ihre Redaktion sind noch keine Fotoalben freigegeben.

+

Für Ihre Redaktion sind noch keine Fotoalben freigegeben.

) : ( )} -
+ ); } @@ -100,30 +102,29 @@ function GlobalSearchForm({ query, format, jahr }: { query: string; format?: str const years = Array.from({ length: 10 }, (_, i) => currentYear - i); return ( -
-
- +
+
-
- - {years.map(y => ( ))} - +
); @@ -135,12 +136,12 @@ function GlobalSearchPagination({ page, query }: { page: ImmichSearchPage; query } return ( -
); } diff --git a/src/components/layout/logout-button.tsx b/src/components/layout/logout-button.tsx index 2f68d5c..ed2447a 100644 --- a/src/components/layout/logout-button.tsx +++ b/src/components/layout/logout-button.tsx @@ -3,6 +3,7 @@ import { useState } from "react"; import { authClient } from "@/modules/auth/client"; +import { Button } from "@/components/ui/button"; // Renders into the portal masthead. Better Auth's signOut clears the session // cookie server-side; we then hard-navigate to the login page so no stale @@ -20,8 +21,14 @@ export function LogoutButton() { } return ( - + ); } \ No newline at end of file diff --git a/src/components/layout/portal-shell.tsx b/src/components/layout/portal-shell.tsx index f3f7114..e773382 100644 --- a/src/components/layout/portal-shell.tsx +++ b/src/components/layout/portal-shell.tsx @@ -4,6 +4,7 @@ import Link from "next/link"; import { BrandLogo } from "@/components/brand/logo"; import { LogoutButton } from "@/components/layout/logout-button"; +import { ThemeToggle } from "@/components/theme-toggle"; export type NavItem = { href: string; label: string }; @@ -27,24 +28,35 @@ export function PortalShell({ children, }: Readonly) { return ( -
-
- - - -
- {sectionLabel} - - +
+
+
+ + {/* The BrandLogo might need to be theme-aware or we just use white/black depending on theme */} +
+
+ +
+ {sectionLabel} + +
+ + +
+
-
{children}
+
{children}
); } \ No newline at end of file diff --git a/src/components/theme-provider.tsx b/src/components/theme-provider.tsx new file mode 100644 index 0000000..0b818ea --- /dev/null +++ b/src/components/theme-provider.tsx @@ -0,0 +1,9 @@ +"use client"; + +import * as React from "react"; +import { ThemeProvider as NextThemesProvider } from "next-themes"; +import type { ThemeProviderProps } from "next-themes"; + +export function ThemeProvider({ children, ...props }: ThemeProviderProps) { + return {children}; +} diff --git a/src/components/theme-toggle.tsx b/src/components/theme-toggle.tsx new file mode 100644 index 0000000..cda81dc --- /dev/null +++ b/src/components/theme-toggle.tsx @@ -0,0 +1,32 @@ +"use client" + +import * as React from "react" +import { Moon, Sun } from "lucide-react" +import { useTheme } from "next-themes" + +import { Button } from "@/components/ui/button" + +export function ThemeToggle() { + const { theme, setTheme } = useTheme() + const [mounted, setMounted] = React.useState(false) + + // Avoid hydration mismatch + React.useEffect(() => setMounted(true), []) + if (!mounted) return
// Placeholder to prevent layout shift + + return ( + + ) +} diff --git a/src/components/ui/button.tsx b/src/components/ui/button.tsx new file mode 100644 index 0000000..d372c6e --- /dev/null +++ b/src/components/ui/button.tsx @@ -0,0 +1,46 @@ +import * as React from "react" +import { Slot } from "@radix-ui/react-slot" +import { cn } from "@/lib/utils" + +export interface ButtonProps + extends React.ButtonHTMLAttributes { + asChild?: boolean + variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" + size?: "default" | "sm" | "lg" | "icon" +} + +const Button = React.forwardRef( + ({ className, variant = "default", size = "default", asChild = false, ...props }, ref) => { + const Comp = asChild ? Slot : "button" + + // Wir nutzen hier klassische Tailwind-Klassen kombiniert mit unseren CSS Variablen + const baseClasses = "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-primary-500 disabled:pointer-events-none disabled:opacity-50" + + const variantClasses = { + default: "bg-primary-600 text-white hover:bg-primary-700 shadow-sm", + destructive: "bg-red-500 text-white hover:bg-red-600 shadow-sm", + outline: "border border-border bg-background hover:bg-accent hover:text-accent-foreground shadow-sm", + secondary: "bg-gray-100 text-gray-900 hover:bg-gray-200 dark:bg-gray-800 dark:text-gray-100 dark:hover:bg-gray-700", + ghost: "hover:bg-gray-100 hover:text-gray-900 dark:hover:bg-gray-800 dark:hover:text-gray-100", + link: "text-primary-600 underline-offset-4 hover:underline", + } + + const sizeClasses = { + default: "h-9 px-4 py-2", + sm: "h-8 rounded-md px-3 text-xs", + lg: "h-10 rounded-md px-8", + icon: "h-9 w-9", + } + + return ( + + ) + } +) +Button.displayName = "Button" + +export { Button } diff --git a/src/components/ui/card.tsx b/src/components/ui/card.tsx new file mode 100644 index 0000000..32fdcaf --- /dev/null +++ b/src/components/ui/card.tsx @@ -0,0 +1,70 @@ +import * as React from "react" + +import { cn } from "@/lib/utils" + +const Card = React.forwardRef>( + ({ className, ...props }, ref) => ( +
+ ) +) +Card.displayName = "Card" + +const CardHeader = React.forwardRef>( + ({ className, ...props }, ref) => ( +
+ ) +) +CardHeader.displayName = "CardHeader" + +const CardTitle = React.forwardRef>( + ({ className, ...props }, ref) => ( +

+ ) +) +CardTitle.displayName = "CardTitle" + +const CardDescription = React.forwardRef>( + ({ className, ...props }, ref) => ( +

+ ) +) +CardDescription.displayName = "CardDescription" + +const CardContent = React.forwardRef>( + ({ className, ...props }, ref) => ( +

+ ) +) +CardContent.displayName = "CardContent" + +const CardFooter = React.forwardRef>( + ({ className, ...props }, ref) => ( +
+ ) +) +CardFooter.displayName = "CardFooter" + +export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } diff --git a/src/components/ui/input.tsx b/src/components/ui/input.tsx new file mode 100644 index 0000000..de36581 --- /dev/null +++ b/src/components/ui/input.tsx @@ -0,0 +1,25 @@ +import * as React from "react" + +import { cn } from "@/lib/utils" + +export interface InputProps + extends React.InputHTMLAttributes {} + +const Input = React.forwardRef( + ({ className, type, ...props }, ref) => { + return ( + + ) + } +) +Input.displayName = "Input" + +export { Input } diff --git a/src/lib/utils.ts b/src/lib/utils.ts new file mode 100644 index 0000000..365058c --- /dev/null +++ b/src/lib/utils.ts @@ -0,0 +1,6 @@ +import { type ClassValue, clsx } from "clsx"; +import { twMerge } from "tailwind-merge"; + +export function cn(...inputs: ClassValue[]) { + return twMerge(clsx(inputs)); +} diff --git a/src/modules/albums/catalog-content.tsx b/src/modules/albums/catalog-content.tsx index 98efe9b..fe249aa 100644 --- a/src/modules/albums/catalog-content.tsx +++ b/src/modules/albums/catalog-content.tsx @@ -49,6 +49,7 @@ export function PhotoContactSheet({ page, query, showAlbumName = false, + lightboxAssetIds, }: Readonly<{ albumId?: string; albumName: string; diff --git a/src/modules/billing/reports.test.ts b/src/modules/billing/reports.test.ts index c6859bb..7e088c8 100644 --- a/src/modules/billing/reports.test.ts +++ b/src/modules/billing/reports.test.ts @@ -24,6 +24,7 @@ const validSelection = { usageIds: ["u1", "u2"], period, adminUserId: "a1", + flatrateCentsSnapshot: null, }; const address: BillingReportAddress = { @@ -69,6 +70,10 @@ function createMockRepo() { return address; }, + async getEditorialFlatrate() { + return { flatrateActive: false, flatratePriceCents: null, flatrateAssetLimit: null }; + }, + async getSelectedUsages(_editorialId, usageIds) { return usageIds.map((id) => selectedUsage(id, usageStatuses.get(id) as "open" | "reopened")); }, @@ -233,6 +238,7 @@ test("previewReport returns PDF bytes without persisting or billing", async () = editorialId: validSelection.editorialId, usageIds: validSelection.usageIds, period: validSelection.period, + flatrateCentsSnapshot: null, }); expect(bytes).toBeInstanceOf(Buffer); diff --git a/src/modules/billing/reports.ts b/src/modules/billing/reports.ts index 65f58ac..aed6b81 100644 --- a/src/modules/billing/reports.ts +++ b/src/modules/billing/reports.ts @@ -55,6 +55,7 @@ export type ReportSelection = { editorialId: string; usageIds: string[]; period: BillingPeriod; + flatrateCentsSnapshot: number | null; }; export type FinalizeReportInput = ReportSelection & { diff --git a/src/modules/editorials/DangerZone.tsx b/src/modules/editorials/DangerZone.tsx index 6f0ef32..ab17aff 100644 --- a/src/modules/editorials/DangerZone.tsx +++ b/src/modules/editorials/DangerZone.tsx @@ -3,6 +3,9 @@ import { useState, useTransition } from "react"; import { archiveEditorialAction } from "@/app/admin/redaktionen/[id]/actions"; +import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "@/components/ui/card"; +import { Input } from "@/components/ui/input"; +import { Button } from "@/components/ui/button"; type DangerZoneProps = { editorialId: string; @@ -22,28 +25,36 @@ export function DangerZone({ editorialId, editorialName }: DangerZoneProps) { } return ( -
-

Gefahrenzone

-

Alle Albumrechte werden widerrufen und der Login wird deaktiviert. Abrechnungsdaten bleiben erhalten.

- - -
+ + + Gefahrenzone + + Alle Albumrechte werden widerrufen und der Login wird deaktiviert. Abrechnungsdaten bleiben erhalten. + + + +
+ + setConfirmText(e.target.value)} + placeholder={editorialName} + disabled={isPending} + className="border-destructive/30 focus-visible:ring-destructive" + /> +
+ +
+
); } diff --git a/src/modules/editorials/admin-detail.tsx b/src/modules/editorials/admin-detail.tsx index 00b9aca..ec1a9c2 100644 --- a/src/modules/editorials/admin-detail.tsx +++ b/src/modules/editorials/admin-detail.tsx @@ -1,4 +1,7 @@ import Link from "next/link"; +import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from "@/components/ui/card"; +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; import { archiveEditorialAction, suspendEditorialAction, reactivateEditorialAction, updateFlatrateAction } from "@/app/admin/redaktionen/[id]/actions"; import { DangerZone } from "./DangerZone"; @@ -21,121 +24,160 @@ export function EditorialDetailContent({ hasActiveGrant, }: Readonly<{ editorial: EditorialDetail; hasActiveGrant: boolean }>) { return ( -
-

Redaktion

-

{editorial.name}

+
+
+

Redaktion

+

{editorial.name}

+
{editorial.archivedAt && ( -

+

Diese Redaktion wurde am {editorial.archivedAt.toLocaleDateString('de-DE')} archiviert. -

+
)} -
-
Ansprechperson
-
{editorial.contactName}
-
Anmelde-E-Mail
-
{editorial.loginEmail}
-
Status
-
{editorial.status}
-
E-Mail bestätigt
-
{editorial.emailVerifiedAt ? "Ja" : "Nein"}
-
Individueller Nettopreis
-
- {editorial.currentPriceCents === null - ? "Noch nicht festgelegt" - : formatCents(editorial.currentPriceCents)} -
-
-
-

Freigabe

- -

- {hasActiveGrant - ? "Mindestens ein Albumrecht ist zugewiesen. Die Freigabe bleibt bis zur weiteren Verwaltungsoberfläche deaktiviert." - : "Eine Freigabe ist erst möglich, wenn mindestens ein aktives Albumrecht zugewiesen wurde."} -

- Albumrechte verwalten - {" · "} - Auto-Zuweisungsregeln -
- - {/* Flatrate Settings */} - {!editorial.archivedAt && ( -
-

Flatrate-Einstellungen

-
+ + + Stammdaten + + +
- -

Wenn aktiviert, werden Downloads nach einem Pauschalpreis abgerechnet.

+
Ansprechperson
+
{editorial.contactName}
- -
-
- - -
-
- - -

Leer lassen für unbegrenzte Flatrate.

-
+
+
Anmelde-E-Mail
+
{editorial.loginEmail}
- - - -
- )} +
+
Status
+
{editorial.status}
+
+
+
E-Mail bestätigt
+
{editorial.emailVerifiedAt ? "Ja" : "Nein"}
+
+
+
Individueller Nettopreis
+
+ {editorial.currentPriceCents === null + ? "Noch nicht festgelegt" + : formatCents(editorial.currentPriceCents)} +
+
+ + + + + + + Freigabe & Rechte + + {hasActiveGrant + ? "Mindestens ein Albumrecht ist zugewiesen. Die Freigabe bleibt bis zur weiteren Verwaltungsoberfläche deaktiviert." + : "Eine Freigabe ist erst möglich, wenn mindestens ein aktives Albumrecht zugewiesen wurde."} + + + + +
+ + Albumrechte verwalten + + · + + Auto-Zuweisungsregeln + +
+
+
- {/* Status Actions */} {!editorial.archivedAt && ( -
-

Status-Aktionen

- {editorial.status === 'active' && ( -
- + + + Flatrate-Einstellungen + Pauschalpreis für Downloads aktivieren. + + + +
+ + +
+ +
+
+ + +
+
+ + +

Leer lassen für unbegrenzte Flatrate.

+
+
+ + - )} - {editorial.status === 'suspended' && ( -
- -
- )} -
+ + + )} + + {!editorial.archivedAt && ( + + + Status-Aktionen + + + {editorial.status === 'active' && ( +
+ +
+ )} + {editorial.status === 'suspended' && ( +
+ +
+ )} +
+
)} - {/* Danger Zone */} {!editorial.archivedAt && ( )} -
+
); } diff --git a/src/modules/immich/types.ts b/src/modules/immich/types.ts index c396749..4418bfb 100644 --- a/src/modules/immich/types.ts +++ b/src/modules/immich/types.ts @@ -13,6 +13,10 @@ export type ImmichAsset = { originalMimeType: string; localDateTime: string | null; fileCreatedAt: string | null; + exifInfo?: { + exifImageWidth?: number | null; + exifImageHeight?: number | null; + } | null; albums: Array<{ id: string }>; }; diff --git a/src/modules/lightbox/service.ts b/src/modules/lightbox/service.ts index f3b1d9a..1915bb1 100644 --- a/src/modules/lightbox/service.ts +++ b/src/modules/lightbox/service.ts @@ -2,12 +2,12 @@ import { and, eq } from "drizzle-orm"; import { db } from "@/db/client"; import { lightboxItems } from "@/db/schema"; import { immichClient } from "@/modules/immich/client"; -import type { PhotoAsset } from "@/modules/immich/types"; +import type { ImmichAsset } from "@/modules/immich/types"; export type LightboxItem = { assetId: string; addedAt: Date; - asset?: PhotoAsset; // populated if joined + asset?: ImmichAsset; // populated if joined }; export const lightboxService = {