feat: complete UI design system refactoring and fix TS build errors
This commit is contained in:
1 parent
0b1ffdfdfc
commit
8728308fc6
27 files changed
+724
-247
No files matched your search
@@ -18,9 +18,13 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@better-auth/drizzle-adapter": "^1.6.26",
|
"@better-auth/drizzle-adapter": "^1.6.26",
|
||||||
"@js-temporal/polyfill": "^0.5.1",
|
"@js-temporal/polyfill": "^0.5.1",
|
||||||
|
"@radix-ui/react-slot": "^1.3.3",
|
||||||
"better-auth": "^1.6.26",
|
"better-auth": "^1.6.26",
|
||||||
|
"clsx": "^2.1.1",
|
||||||
"drizzle-orm": "^0.45.2",
|
"drizzle-orm": "^0.45.2",
|
||||||
|
"lucide-react": "^1.31.0",
|
||||||
"next": "^16.3.0",
|
"next": "^16.3.0",
|
||||||
|
"next-themes": "^0.4.6",
|
||||||
"nodemailer": "^9.0.5",
|
"nodemailer": "^9.0.5",
|
||||||
"pdfmake": "~0.3.11",
|
"pdfmake": "~0.3.11",
|
||||||
"pg": "^8.22.0",
|
"pg": "^8.22.0",
|
||||||
@@ -28,6 +32,7 @@
|
|||||||
"react-dom": "^19.2.8",
|
"react-dom": "^19.2.8",
|
||||||
"server-only": "^0.0.1",
|
"server-only": "^0.0.1",
|
||||||
"sharp": "^0.35.3",
|
"sharp": "^0.35.3",
|
||||||
|
"tailwind-merge": "^3.6.0",
|
||||||
"zod": "^4.4.3"
|
"zod": "^4.4.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
Generated
+77
@@ -14,15 +14,27 @@ importers:
|
|||||||
'@js-temporal/polyfill':
|
'@js-temporal/polyfill':
|
||||||
specifier: ^0.5.1
|
specifier: ^0.5.1
|
||||||
version: 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:
|
better-auth:
|
||||||
specifier: ^1.6.26
|
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)))
|
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:
|
drizzle-orm:
|
||||||
specifier: ^0.45.2
|
specifier: ^0.45.2
|
||||||
version: 0.45.2(@types/pg@8.21.0)(kysely@0.29.4)(pg@8.22.0)
|
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:
|
next:
|
||||||
specifier: ^16.3.0
|
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)
|
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:
|
nodemailer:
|
||||||
specifier: ^9.0.5
|
specifier: ^9.0.5
|
||||||
version: 9.0.5
|
version: 9.0.5
|
||||||
@@ -44,6 +56,9 @@ importers:
|
|||||||
sharp:
|
sharp:
|
||||||
specifier: ^0.35.3
|
specifier: ^0.35.3
|
||||||
version: 0.35.3(@types/node@24.13.3)
|
version: 0.35.3(@types/node@24.13.3)
|
||||||
|
tailwind-merge:
|
||||||
|
specifier: ^3.6.0
|
||||||
|
version: 3.6.0
|
||||||
zod:
|
zod:
|
||||||
specifier: ^4.4.3
|
specifier: ^4.4.3
|
||||||
version: 4.4.3
|
version: 4.4.3
|
||||||
@@ -1343,6 +1358,24 @@ packages:
|
|||||||
'@protobufjs/utf8@1.1.2':
|
'@protobufjs/utf8@1.1.2':
|
||||||
resolution: {integrity: sha512-b1UQwcEZ4yCnMCD8DAL1VlbvBJE9/IX4FTIp7BG1xYpf29SLazLSrqUkj4w7Y5y7cCVP6E5tcqqcI0xemPkHug==}
|
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':
|
'@rolldown/binding-android-arm64@1.2.3':
|
||||||
resolution: {integrity: sha512-zrJtHDcaZJ1Fp7xf4hNl+7seH9Cn/N5TwLYkhgXREtBwAd/jaqW3uqeHxpDugJLVICWg4eW44kOQEGJ1r6jCGw==}
|
resolution: {integrity: sha512-zrJtHDcaZJ1Fp7xf4hNl+7seH9Cn/N5TwLYkhgXREtBwAd/jaqW3uqeHxpDugJLVICWg4eW44kOQEGJ1r6jCGw==}
|
||||||
engines: {node: ^20.19.0 || >=22.12.0}
|
engines: {node: ^20.19.0 || >=22.12.0}
|
||||||
@@ -2207,6 +2240,10 @@ packages:
|
|||||||
resolution: {integrity: sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==}
|
resolution: {integrity: sha512-3Pe/CF1Nn94hyhIYpjtiLhdCoEoz0DqQ+988E9gmeEdQZlojxnOb74wctFyuwWQHzqyf9X7C7MG8juUpqBJT8w==}
|
||||||
engines: {node: '>=0.8'}
|
engines: {node: '>=0.8'}
|
||||||
|
|
||||||
|
clsx@2.1.1:
|
||||||
|
resolution: {integrity: sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA==}
|
||||||
|
engines: {node: '>=6'}
|
||||||
|
|
||||||
color-convert@2.0.1:
|
color-convert@2.0.1:
|
||||||
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
|
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
|
||||||
engines: {node: '>=7.0.0'}
|
engines: {node: '>=7.0.0'}
|
||||||
@@ -3290,6 +3327,11 @@ packages:
|
|||||||
lru-cache@5.1.1:
|
lru-cache@5.1.1:
|
||||||
resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==}
|
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:
|
lz-string@1.5.0:
|
||||||
resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==}
|
resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==}
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@@ -3383,6 +3425,12 @@ packages:
|
|||||||
natural-compare@1.4.0:
|
natural-compare@1.4.0:
|
||||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
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:
|
next@16.3.0:
|
||||||
resolution: {integrity: sha512-NEdGOzH+08eTXMUp9UYkA99Nhi5N6Thrhc1jgFOQgfgnGK/dA2hRwBpXep+exdFQrnwlRf/3Wixyp8lLBUpE2A==}
|
resolution: {integrity: sha512-NEdGOzH+08eTXMUp9UYkA99Nhi5N6Thrhc1jgFOQgfgnGK/dA2hRwBpXep+exdFQrnwlRf/3Wixyp8lLBUpE2A==}
|
||||||
engines: {node: '>=20.9.0'}
|
engines: {node: '>=20.9.0'}
|
||||||
@@ -3972,6 +4020,9 @@ packages:
|
|||||||
resolution: {integrity: sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng==}
|
resolution: {integrity: sha512-yEFYrVhod+hdNyx7g5Bnkkb0G6si8HJurOoOEgC8B/O0uXLHlaey/65KRv6cuWBNhBgHKAROVpc7QyYqE5gFng==}
|
||||||
engines: {node: '>=20'}
|
engines: {node: '>=20'}
|
||||||
|
|
||||||
|
tailwind-merge@3.6.0:
|
||||||
|
resolution: {integrity: sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w==}
|
||||||
|
|
||||||
tailwindcss@4.3.3:
|
tailwindcss@4.3.3:
|
||||||
resolution: {integrity: sha512-gOhV3P7ufE62QDGg1zVaTgCR+EtPv92k2nIhVcVKcLmxT1sUBsQGhnZj175j+MqRt4zLF7ic+sCYjfhxMxj7YQ==}
|
resolution: {integrity: sha512-gOhV3P7ufE62QDGg1zVaTgCR+EtPv92k2nIhVcVKcLmxT1sUBsQGhnZj175j+MqRt4zLF7ic+sCYjfhxMxj7YQ==}
|
||||||
|
|
||||||
@@ -5223,6 +5274,19 @@ snapshots:
|
|||||||
|
|
||||||
'@protobufjs/utf8@1.1.2': {}
|
'@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':
|
'@rolldown/binding-android-arm64@1.2.3':
|
||||||
optional: true
|
optional: true
|
||||||
|
|
||||||
@@ -6016,6 +6080,8 @@ snapshots:
|
|||||||
|
|
||||||
clone@2.1.2: {}
|
clone@2.1.2: {}
|
||||||
|
|
||||||
|
clsx@2.1.1: {}
|
||||||
|
|
||||||
color-convert@2.0.1:
|
color-convert@2.0.1:
|
||||||
dependencies:
|
dependencies:
|
||||||
color-name: 1.1.4
|
color-name: 1.1.4
|
||||||
@@ -7199,6 +7265,10 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
yallist: 3.1.1
|
yallist: 3.1.1
|
||||||
|
|
||||||
|
lucide-react@1.31.0(react@19.2.8):
|
||||||
|
dependencies:
|
||||||
|
react: 19.2.8
|
||||||
|
|
||||||
lz-string@1.5.0: {}
|
lz-string@1.5.0: {}
|
||||||
|
|
||||||
magic-string@0.30.21:
|
magic-string@0.30.21:
|
||||||
@@ -7282,6 +7352,11 @@ snapshots:
|
|||||||
|
|
||||||
natural-compare@1.4.0: {}
|
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):
|
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:
|
dependencies:
|
||||||
'@next/env': 16.3.0
|
'@next/env': 16.3.0
|
||||||
@@ -7979,6 +8054,8 @@ snapshots:
|
|||||||
|
|
||||||
tagged-tag@1.0.0: {}
|
tagged-tag@1.0.0: {}
|
||||||
|
|
||||||
|
tailwind-merge@3.6.0: {}
|
||||||
|
|
||||||
tailwindcss@4.3.3: {}
|
tailwindcss@4.3.3: {}
|
||||||
|
|
||||||
tapable@2.3.3: {}
|
tapable@2.3.3: {}
|
||||||
|
|||||||
+65
-43
@@ -4,6 +4,8 @@ import { usages, editorialAccounts } from "@/db/schema";
|
|||||||
import { requireAdmin } from "@/modules/auth/principal";
|
import { requireAdmin } from "@/modules/auth/principal";
|
||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
import Link from "next/link";
|
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() {
|
export default async function AdminDashboardPage() {
|
||||||
await requireAdmin(new Headers(await headers()));
|
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" });
|
const formatter = new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="content-section">
|
<div className="space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500">
|
||||||
<h1>Admin Dashboard</h1>
|
<div>
|
||||||
<p className="text-gray-600 mb-8">Willkommen zurück! Hier ist ein Überblick über die aktuelle Nutzung des Portals.</p>
|
<h1 className="text-4xl font-bold tracking-tight">Admin Dashboard</h1>
|
||||||
|
<p className="text-muted-foreground mt-2">Willkommen zurück! Hier ist ein Überblick über die aktuelle Nutzung des Portals.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6 mb-12">
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||||
<div className="bg-white p-6 rounded-xl border border-gray-200 shadow-sm">
|
<Card>
|
||||||
<h2 className="text-sm font-semibold text-gray-500 uppercase tracking-wide">Umsatz diesen Monat</h2>
|
<CardHeader className="pb-2">
|
||||||
<p className="text-4xl font-bold text-green-600 mt-2">
|
<CardTitle className="text-sm font-medium uppercase tracking-wide text-muted-foreground">Umsatz diesen Monat</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<div className="text-4xl font-bold text-primary-600 dark:text-primary-500">
|
||||||
{formatter.format((revenueStats?.totalCents ?? 0) / 100)}
|
{formatter.format((revenueStats?.totalCents ?? 0) / 100)}
|
||||||
</p>
|
</div>
|
||||||
<p className="text-sm text-gray-500 mt-2">
|
<p className="text-sm text-muted-foreground mt-1">
|
||||||
{revenueStats?.count ?? 0} lizenzierte Bilder im {now.toLocaleString("de-DE", { month: "long" })}
|
{revenueStats?.count ?? 0} lizenzierte Bilder im {now.toLocaleString("de-DE", { month: "long" })}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
|
||||||
<div className="bg-white p-6 rounded-xl border border-gray-200 shadow-sm flex flex-col justify-center">
|
<Card className="flex flex-col justify-center items-center bg-primary-50/50 dark:bg-primary-900/10 border-primary-100 dark:border-primary-900/30">
|
||||||
<Link href="/admin/redaktionen" className="primary-action text-center m-0">
|
<CardContent className="pt-6">
|
||||||
|
<Button asChild size="lg" className="w-full">
|
||||||
|
<Link href="/admin/redaktionen">
|
||||||
Redaktionen verwalten
|
Redaktionen verwalten
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</Button>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
<div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
||||||
<div>
|
<Card>
|
||||||
<h3 className="text-xl font-bold mb-4">Aktivste Redaktionen</h3>
|
<CardHeader>
|
||||||
<div className="bg-white rounded-xl border border-gray-200 overflow-hidden shadow-sm">
|
<CardTitle>Aktivste Redaktionen</CardTitle>
|
||||||
|
<CardDescription>Die Top 5 Redaktionen nach Downloads.</CardDescription>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
{topEditorials.length === 0 ? (
|
{topEditorials.length === 0 ? (
|
||||||
<p className="p-4 text-gray-500">Noch keine Daten vorhanden.</p>
|
<p className="text-muted-foreground text-sm">Noch keine Daten vorhanden.</p>
|
||||||
) : (
|
) : (
|
||||||
<table className="w-full text-left border-collapse">
|
<div className="overflow-hidden rounded-md border border-border">
|
||||||
<thead className="bg-gray-50">
|
<table className="w-full text-left text-sm">
|
||||||
|
<thead className="bg-muted/50 border-b border-border">
|
||||||
<tr>
|
<tr>
|
||||||
<th className="py-3 px-4 font-semibold text-gray-700">Redaktion</th>
|
<th className="py-3 px-4 font-semibold">Redaktion</th>
|
||||||
<th className="py-3 px-4 font-semibold text-gray-700 text-right">Downloads</th>
|
<th className="py-3 px-4 font-semibold text-right">Downloads</th>
|
||||||
<th className="py-3 px-4 font-semibold text-gray-700 text-right">Umsatz</th>
|
<th className="py-3 px-4 font-semibold text-right">Umsatz</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{topEditorials.map(ed => (
|
{topEditorials.map((ed, i) => (
|
||||||
<tr key={ed.editorialId} className="border-t border-gray-100">
|
<tr key={ed.editorialId} className={i !== topEditorials.length - 1 ? "border-b border-border" : ""}>
|
||||||
<td className="py-3 px-4">
|
<td className="py-3 px-4">
|
||||||
<Link href={`/admin/redaktionen/${ed.editorialId}`} className="text-blue-600 hover:underline">
|
<Link href={`/admin/redaktionen/${ed.editorialId}`} className="text-primary-600 dark:text-primary-400 hover:underline font-medium">
|
||||||
{ed.name}
|
{ed.name}
|
||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
<td className="py-3 px-4 text-right">{ed.downloadCount}</td>
|
<td className="py-3 px-4 text-right tabular-nums">{ed.downloadCount}</td>
|
||||||
<td className="py-3 px-4 text-right">{formatter.format(ed.revenueCents / 100)}</td>
|
<td className="py-3 px-4 text-right tabular-nums">{formatter.format(ed.revenueCents / 100)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</CardContent>
|
||||||
</div>
|
</Card>
|
||||||
|
|
||||||
<div>
|
<Card>
|
||||||
<h3 className="text-xl font-bold mb-4">Beliebteste Alben</h3>
|
<CardHeader>
|
||||||
<div className="bg-white rounded-xl border border-gray-200 overflow-hidden shadow-sm">
|
<CardTitle>Beliebteste Alben</CardTitle>
|
||||||
|
<CardDescription>Die Top 5 Alben nach Nutzung.</CardDescription>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
{topAlbums.length === 0 ? (
|
{topAlbums.length === 0 ? (
|
||||||
<p className="p-4 text-gray-500">Noch keine Daten vorhanden.</p>
|
<p className="text-muted-foreground text-sm">Noch keine Daten vorhanden.</p>
|
||||||
) : (
|
) : (
|
||||||
<table className="w-full text-left border-collapse">
|
<div className="overflow-hidden rounded-md border border-border">
|
||||||
<thead className="bg-gray-50">
|
<table className="w-full text-left text-sm">
|
||||||
|
<thead className="bg-muted/50 border-b border-border">
|
||||||
<tr>
|
<tr>
|
||||||
<th className="py-3 px-4 font-semibold text-gray-700">Album</th>
|
<th className="py-3 px-4 font-semibold">Album</th>
|
||||||
<th className="py-3 px-4 font-semibold text-gray-700 text-right">Downloads</th>
|
<th className="py-3 px-4 font-semibold text-right">Downloads</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{topAlbums.map(album => (
|
{topAlbums.map((album, i) => (
|
||||||
<tr key={album.albumName} className="border-t border-gray-100">
|
<tr key={album.albumName} className={i !== topAlbums.length - 1 ? "border-b border-border" : ""}>
|
||||||
<td className="py-3 px-4 font-medium text-gray-800">{album.albumName}</td>
|
<td className="py-3 px-4 font-medium">{album.albumName}</td>
|
||||||
<td className="py-3 px-4 text-right text-gray-600">{album.downloadCount}</td>
|
<td className="py-3 px-4 text-right tabular-nums">{album.downloadCount}</td>
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -11,10 +11,14 @@ const editorial = {
|
|||||||
id: "00000000-0000-4000-8000-000000000001",
|
id: "00000000-0000-4000-8000-000000000001",
|
||||||
name: "Neue Redaktion",
|
name: "Neue Redaktion",
|
||||||
contactName: "Mara Muster",
|
contactName: "Mara Muster",
|
||||||
loginEmail: "mara@example.com",
|
loginEmail: "foo@bar.com",
|
||||||
status: "pending_approval" as const,
|
status: "pending_approval" as const,
|
||||||
emailVerifiedAt: null,
|
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", () => {
|
test("the editorial detail links admins to its album-assignment page", () => {
|
||||||
|
|||||||
@@ -28,35 +28,38 @@ export default async function EditorialAlbumsPage({
|
|||||||
|
|
||||||
if (albumResult.unavailable) {
|
if (albumResult.unavailable) {
|
||||||
return (
|
return (
|
||||||
<section className="content-section" aria-labelledby="albums-title">
|
<div className="space-y-6 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500">
|
||||||
<p className="eyebrow">Redaktion · Albumrechte</p>
|
<div>
|
||||||
<h1 id="albums-title">Alben für {editorial.name}</h1>
|
<p className="text-sm font-semibold uppercase tracking-widest text-primary-600 dark:text-primary-500 mb-2">Redaktion · Albumrechte</p>
|
||||||
<p role="status">
|
<h1 className="text-4xl font-bold tracking-tight">Alben für {editorial.name}</h1>
|
||||||
Die Immich-Alben sind momentan nicht erreichbar. Bereits bestehende Zuweisungen bleiben
|
</div>
|
||||||
unverändert.
|
<div className="bg-destructive/15 text-destructive p-4 rounded-md border border-destructive/30" role="status">
|
||||||
</p>
|
Die Immich-Alben sind momentan nicht erreichbar. Bereits bestehende Zuweisungen bleiben unverändert.
|
||||||
<p>
|
</div>
|
||||||
<Link href={`/admin/redaktionen/${editorial.id}`}>Zurück zur Redaktion</Link>
|
<div className="flex gap-4">
|
||||||
</p>
|
<Link href={`/admin/redaktionen/${editorial.id}`} className="text-primary-600 hover:underline">Zurück zur Redaktion</Link>
|
||||||
</section>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="content-section" aria-labelledby="albums-title">
|
<div className="space-y-8 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500">
|
||||||
<p className="eyebrow">Redaktion · Albumrechte</p>
|
<div>
|
||||||
<h1 id="albums-title">Alben für {editorial.name}</h1>
|
<p className="text-sm font-semibold uppercase tracking-widest text-primary-600 dark:text-primary-500 mb-2">Redaktion · Albumrechte</p>
|
||||||
<p>
|
<h1 className="text-4xl font-bold tracking-tight">Alben für {editorial.name}</h1>
|
||||||
|
<p className="text-muted-foreground mt-2">
|
||||||
Nur Alben, die der technische Immich-Zugang lesen kann, lassen sich zuweisen.
|
Nur Alben, die der technische Immich-Zugang lesen kann, lassen sich zuweisen.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<div className="flex gap-4 mt-4 text-sm font-medium">
|
||||||
<Link href={`/admin/redaktionen/${editorial.id}`}>Zurück zur Redaktion</Link>
|
<Link href={`/admin/redaktionen/${editorial.id}`} className="text-primary-600 hover:underline">Zurück zur Redaktion</Link>
|
||||||
{" · "}
|
<span className="text-muted-foreground">·</span>
|
||||||
<Link href={`/admin/redaktionen/${editorial.id}/auto-regeln`}>Auto-Zuweisungsregeln verwalten</Link>
|
<Link href={`/admin/redaktionen/${editorial.id}/auto-regeln`} className="text-primary-600 hover:underline">Auto-Zuweisungsregeln verwalten</Link>
|
||||||
</p>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{albumResult.albums.length === 0 ? (
|
{albumResult.albums.length === 0 ? (
|
||||||
<p>Derzeit sind keine zuweisbaren Alben vorhanden.</p>
|
<p className="text-muted-foreground">Derzeit sind keine zuweisbaren Alben vorhanden.</p>
|
||||||
) : (
|
) : (
|
||||||
<AlbumGrid
|
<AlbumGrid
|
||||||
albums={albumResult.albums}
|
albums={albumResult.albums}
|
||||||
@@ -65,6 +68,6 @@ export default async function EditorialAlbumsPage({
|
|||||||
revokeAction={revokeAlbumAction}
|
revokeAction={revokeAlbumAction}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</section>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -48,6 +48,7 @@ export function createFinalizeHandler(dependencies: FinalizeHandlerDependencies)
|
|||||||
usageIds,
|
usageIds,
|
||||||
period,
|
period,
|
||||||
adminUserId: principal.userId,
|
adminUserId: principal.userId,
|
||||||
|
flatrateCentsSnapshot: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Email dispatch
|
// Email dispatch
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export function createPreviewHandler(dependencies: PreviewHandlerDependencies) {
|
|||||||
const { editorialId, usageIds, year, month, quarter } = payload.data;
|
const { editorialId, usageIds, year, month, quarter } = payload.data;
|
||||||
const period = month ? monthPeriod(year, month) : quarterPeriod(year, quarter!);
|
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), {
|
return new Response(new Uint8Array(bytes), {
|
||||||
status: 200,
|
status: 200,
|
||||||
|
|||||||
@@ -1,6 +1,28 @@
|
|||||||
@import "tailwindcss";
|
@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 {
|
:root {
|
||||||
|
/* Legacy Vars */
|
||||||
--paper: #ffffff;
|
--paper: #ffffff;
|
||||||
--ink: #050505;
|
--ink: #050505;
|
||||||
--graphite: #242424;
|
--graphite: #242424;
|
||||||
@@ -9,9 +31,38 @@
|
|||||||
--muted: var(--metadata);
|
--muted: var(--metadata);
|
||||||
--line: #d8d8d8;
|
--line: #d8d8d8;
|
||||||
--soft: #f3f3f3;
|
--soft: #f3f3f3;
|
||||||
|
|
||||||
|
/* New Design System Vars */
|
||||||
|
--bg-main: #f8fafc;
|
||||||
|
--text-main: #0f172a;
|
||||||
|
--bg-card: #ffffff;
|
||||||
|
--text-card: #1e293b;
|
||||||
|
--border-color: #e2e8f0;
|
||||||
|
|
||||||
color-scheme: light;
|
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;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|||||||
+16
-2
@@ -4,6 +4,11 @@ import "./globals.css";
|
|||||||
|
|
||||||
import { LegalFooter } from "@/components/layout/legal-footer";
|
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 = {
|
export const metadata: Metadata = {
|
||||||
title: "Redaktionsportal | Leon Tonhäuser",
|
title: "Redaktionsportal | Leon Tonhäuser",
|
||||||
description: "Ausgewählte Pressefotos sicher finden und nutzen.",
|
description: "Ausgewählte Pressefotos sicher finden und nutzen.",
|
||||||
@@ -11,10 +16,19 @@ export const metadata: Metadata = {
|
|||||||
|
|
||||||
export default function RootLayout({ children }: Readonly<{ children: ReactNode }>) {
|
export default function RootLayout({ children }: Readonly<{ children: ReactNode }>) {
|
||||||
return (
|
return (
|
||||||
<html lang="de">
|
<html lang="de" suppressHydrationWarning>
|
||||||
<body>
|
<body className={`${inter.variable} font-sans antialiased bg-background text-foreground transition-colors duration-300 min-h-screen flex flex-col`}>
|
||||||
|
<ThemeProvider
|
||||||
|
attribute="class"
|
||||||
|
defaultTheme="system"
|
||||||
|
enableSystem
|
||||||
|
disableTransitionOnChange
|
||||||
|
>
|
||||||
|
<div className="flex-1 flex flex-col">
|
||||||
{children}
|
{children}
|
||||||
|
</div>
|
||||||
<LegalFooter />
|
<LegalFooter />
|
||||||
|
</ThemeProvider>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import { requireActiveEditorial } from "@/modules/auth/principal";
|
|||||||
import { headers } from "next/headers";
|
import { headers } from "next/headers";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { formatBerlinDateTime } from "@/modules/downloads/format";
|
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() {
|
export default async function AbrechnungenPage() {
|
||||||
const principal = await requireActiveEditorial(new Headers(await headers()));
|
const principal = await requireActiveEditorial(new Headers(await headers()));
|
||||||
@@ -80,80 +82,96 @@ export default async function AbrechnungenPage() {
|
|||||||
const openTotalCents = (openUsages?.totalCents ?? 0);
|
const openTotalCents = (openUsages?.totalCents ?? 0);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="editorial-section">
|
<div className="space-y-8 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500">
|
||||||
<p className="editorial-kicker">Finanzen</p>
|
<div>
|
||||||
<h1>Meine Abrechnungen</h1>
|
<p className="text-sm font-semibold uppercase tracking-widest text-primary-600 dark:text-primary-500 mb-2">Finanzen</p>
|
||||||
|
<h1 className="text-4xl font-bold tracking-tight">Meine Abrechnungen</h1>
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-8 my-8">
|
|
||||||
<div className="bg-blue-50 p-6 rounded-xl border border-blue-100">
|
|
||||||
<h2 className="text-xl font-semibold text-blue-900 mb-2">Offener Betrag (Einzelabrufe)</h2>
|
|
||||||
<p className="text-3xl font-bold text-blue-900">
|
|
||||||
{new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(openTotalCents / 100)}
|
|
||||||
</p>
|
|
||||||
<p className="text-sm text-blue-700 mt-2">
|
|
||||||
Für {openUsages?.count ?? 0} kostenpflichtige Bilder (noch nicht in Rechnung gestellt)
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-8 my-8">
|
||||||
|
<Card className="bg-primary-50/50 dark:bg-primary-900/10 border-primary-100 dark:border-primary-900/30">
|
||||||
|
<CardHeader className="pb-2">
|
||||||
|
<CardTitle className="text-primary-900 dark:text-primary-100">Offener Betrag (Einzelabrufe)</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<p className="text-4xl font-bold text-primary-700 dark:text-primary-400">
|
||||||
|
{new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(openTotalCents / 100)}
|
||||||
|
</p>
|
||||||
|
<p className="text-sm text-primary-600/80 dark:text-primary-300/80 mt-2">
|
||||||
|
Für {openUsages?.count ?? 0} kostenpflichtige Bilder (noch nicht in Rechnung gestellt)
|
||||||
|
</p>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
|
||||||
{editorial?.flatrateActive && editorial.flatratePriceCents !== null && (
|
{editorial?.flatrateActive && editorial.flatratePriceCents !== null && (
|
||||||
<div className="bg-green-50 p-6 rounded-xl border border-green-100">
|
<Card className="bg-emerald-50/50 dark:bg-emerald-900/10 border-emerald-100 dark:border-emerald-900/30">
|
||||||
<h2 className="text-xl font-semibold text-green-900 mb-2">Aktiver Tarif: Flatrate</h2>
|
<CardHeader className="pb-2">
|
||||||
<p className="text-3xl font-bold text-green-900">
|
<CardTitle className="text-emerald-900 dark:text-emerald-100">Aktiver Tarif: Flatrate</CardTitle>
|
||||||
{new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(editorial.flatratePriceCents / 100)} <span className="text-lg font-normal">/ Monat</span>
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
|
<p className="text-4xl font-bold text-emerald-700 dark:text-emerald-400 flex items-baseline gap-2">
|
||||||
|
{new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(editorial.flatratePriceCents / 100)}
|
||||||
|
<span className="text-lg font-normal text-emerald-600/70 dark:text-emerald-400/70">/ Monat</span>
|
||||||
</p>
|
</p>
|
||||||
{editorial.flatrateAssetLimit === null ? (
|
{editorial.flatrateAssetLimit === null ? (
|
||||||
<p className="text-sm text-green-700 mt-2">
|
<p className="text-sm text-emerald-700/80 dark:text-emerald-300/80 mt-2 font-medium">
|
||||||
Unbegrenzte Downloads inklusive
|
Unbegrenzte Downloads inklusive
|
||||||
</p>
|
</p>
|
||||||
) : (
|
) : (
|
||||||
<div className="mt-2">
|
<div className="mt-4">
|
||||||
<p className="text-sm text-green-700 font-semibold mb-1">
|
<div className="flex justify-between text-sm text-emerald-700 dark:text-emerald-300 font-medium mb-1.5">
|
||||||
Inklusiv-Bilder diesen Monat: {usedFlatrateImages} / {editorial.flatrateAssetLimit}
|
<span>Inklusiv-Bilder diesen Monat</span>
|
||||||
</p>
|
<span>{usedFlatrateImages} / {editorial.flatrateAssetLimit}</span>
|
||||||
<div className="w-full bg-green-200 rounded-full h-2.5">
|
</div>
|
||||||
<div className="bg-green-600 h-2.5 rounded-full" style={{ width: `${Math.min(100, (usedFlatrateImages / editorial.flatrateAssetLimit) * 100)}%` }}></div>
|
<div className="w-full bg-emerald-200/50 dark:bg-emerald-800/50 rounded-full h-2.5 overflow-hidden">
|
||||||
|
<div className="bg-emerald-500 dark:bg-emerald-400 h-full rounded-full transition-all duration-500" style={{ width: `${Math.min(100, (usedFlatrateImages / editorial.flatrateAssetLimit) * 100)}%` }} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</CardContent>
|
||||||
|
</Card>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h2 className="text-2xl font-bold mb-4 mt-12">Bisherige Rechnungen</h2>
|
<div className="pt-4">
|
||||||
|
<h2 className="text-2xl font-bold mb-6">Bisherige Rechnungen</h2>
|
||||||
|
|
||||||
{reports.length === 0 ? (
|
{reports.length === 0 ? (
|
||||||
<p className="text-gray-500">Es liegen noch keine abgerechneten Zeiträume vor.</p>
|
<Card>
|
||||||
|
<CardContent className="pt-6">
|
||||||
|
<p className="text-muted-foreground text-center py-8">Es liegen noch keine abgerechneten Zeiträume vor.</p>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
) : (
|
) : (
|
||||||
|
<Card>
|
||||||
<div className="overflow-x-auto">
|
<div className="overflow-x-auto">
|
||||||
<table className="w-full text-left border-collapse">
|
<table className="w-full text-left text-sm">
|
||||||
<thead>
|
<thead className="bg-muted/50 border-b border-border">
|
||||||
<tr className="border-b-2 border-gray-200">
|
<tr>
|
||||||
<th className="py-3 px-4 font-semibold text-gray-700">Rechnungsnummer</th>
|
<th className="py-3 px-4 font-semibold">Rechnungsnummer</th>
|
||||||
<th className="py-3 px-4 font-semibold text-gray-700">Zeitraum</th>
|
<th className="py-3 px-4 font-semibold">Zeitraum</th>
|
||||||
<th className="py-3 px-4 font-semibold text-gray-700">Betrag (Netto)</th>
|
<th className="py-3 px-4 font-semibold text-right">Betrag (Netto)</th>
|
||||||
<th className="py-3 px-4 font-semibold text-gray-700">Download</th>
|
<th className="py-3 px-4 font-semibold text-center">Download</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{reports.map((report) => (
|
{reports.map((report, i) => (
|
||||||
<tr key={report.id} className="border-b border-gray-100 hover:bg-gray-50">
|
<tr key={report.id} className={i !== reports.length - 1 ? "border-b border-border hover:bg-muted/30 transition-colors" : "hover:bg-muted/30 transition-colors"}>
|
||||||
<td className="py-4 px-4 font-medium">{report.invoiceNumber}</td>
|
<td className="py-4 px-4 font-medium">{report.invoiceNumber}</td>
|
||||||
<td className="py-4 px-4 text-gray-600">
|
<td className="py-4 px-4 text-muted-foreground">
|
||||||
{new Intl.DateTimeFormat("de-DE", { month: "long", year: "numeric" }).format(report.periodStartsAt)}
|
{new Intl.DateTimeFormat("de-DE", { month: "long", year: "numeric" }).format(report.periodStartsAt)}
|
||||||
</td>
|
</td>
|
||||||
<td className="py-4 px-4 font-medium">
|
<td className="py-4 px-4 font-medium text-right tabular-nums">
|
||||||
{new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(report.netTotalCents / 100)}
|
{new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(report.netTotalCents / 100)}
|
||||||
</td>
|
</td>
|
||||||
<td className="py-4 px-4">
|
<td className="py-4 px-4 text-center">
|
||||||
<Link
|
<Link
|
||||||
href={`/api/editorials/reports/${report.id}/pdf`}
|
href={`/api/editorials/reports/${report.id}/pdf`}
|
||||||
target="_blank"
|
target="_blank"
|
||||||
className="inline-flex items-center gap-2 text-blue-600 hover:text-blue-800 transition-colors"
|
className="inline-flex items-center gap-2 text-primary-600 hover:text-primary-800 dark:text-primary-400 dark:hover:text-primary-300 font-medium transition-colors"
|
||||||
>
|
>
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={2} stroke="currentColor" className="w-5 h-5">
|
<FileText className="w-4 h-4" />
|
||||||
<path strokeLinecap="round" strokeLinejoin="round" d="M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z" />
|
<span>PDF</span>
|
||||||
</svg>
|
|
||||||
PDF anzeigen
|
|
||||||
</Link>
|
</Link>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -161,7 +179,9 @@ export default async function AbrechnungenPage() {
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
</Card>
|
||||||
)}
|
)}
|
||||||
</section>
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,8 @@ import { loadEditorialDownloadOptions } from "@/modules/downloads/stream";
|
|||||||
import { lightboxService } from "@/modules/lightbox/service";
|
import { lightboxService } from "@/modules/lightbox/service";
|
||||||
import type { ImmichSearchPage } from "@/modules/immich/types";
|
import type { ImmichSearchPage } from "@/modules/immich/types";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
import { Input } from "@/components/ui/input";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
|
||||||
import { requireEditorial } from "../access";
|
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));
|
const lightboxAssetIds = new Set(lightboxItems.map(i => i.assetId));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="editorial-section" aria-labelledby="albums-title">
|
<div className="space-y-6 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500" aria-labelledby="albums-title">
|
||||||
<p className="editorial-kicker">Bildarchiv · Suche</p>
|
<div>
|
||||||
<div className="editorial-title-row">
|
<p className="text-sm font-semibold uppercase tracking-widest text-primary-600 dark:text-primary-500 mb-2">Bildarchiv · Suche</p>
|
||||||
<h1 id="albums-title">Suchergebnisse</h1>
|
<h1 id="albums-title" className="text-4xl font-bold tracking-tight">Suchergebnisse</h1>
|
||||||
</div>
|
</div>
|
||||||
<GlobalSearchForm query={query} format={format} jahr={jahr} />
|
<GlobalSearchForm query={query} format={format} jahr={jahr} />
|
||||||
<PhotoContactSheet
|
<PhotoContactSheet
|
||||||
@@ -68,7 +70,7 @@ export default async function AlbumsPage({ searchParams }: { searchParams: Promi
|
|||||||
lightboxAssetIds={lightboxAssetIds}
|
lightboxAssetIds={lightboxAssetIds}
|
||||||
/>
|
/>
|
||||||
<GlobalSearchPagination page={results} query={query} />
|
<GlobalSearchPagination page={results} query={query} />
|
||||||
</section>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,19 +81,19 @@ export default async function AlbumsPage({ searchParams }: { searchParams: Promi
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="editorial-section" aria-labelledby="albums-title">
|
<div className="space-y-8 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500" aria-labelledby="albums-title">
|
||||||
<p className="editorial-kicker">Bildarchiv · Freigaben</p>
|
<div>
|
||||||
<div className="editorial-title-row">
|
<p className="text-sm font-semibold uppercase tracking-widest text-primary-600 dark:text-primary-500 mb-2">Bildarchiv · Freigaben</p>
|
||||||
<h1 id="albums-title">Ihre Alben</h1>
|
<h1 id="albums-title" className="text-4xl font-bold tracking-tight">Ihre Alben</h1>
|
||||||
<p>Wählen Sie ein Spiel oder eine Serie, um die freigegebenen Fotos zu durchsuchen.</p>
|
<p className="text-muted-foreground mt-2">Wählen Sie ein Spiel oder eine Serie, um die freigegebenen Fotos zu durchsuchen.</p>
|
||||||
</div>
|
</div>
|
||||||
<GlobalSearchForm query={query} format={format} jahr={jahr} />
|
<GlobalSearchForm query={query} format={format} jahr={jahr} />
|
||||||
{result.albums.length === 0 ? (
|
{result.albums.length === 0 ? (
|
||||||
<p className="catalog-empty">Für Ihre Redaktion sind noch keine Fotoalben freigegeben.</p>
|
<p className="text-muted-foreground text-center py-12">Für Ihre Redaktion sind noch keine Fotoalben freigegeben.</p>
|
||||||
) : (
|
) : (
|
||||||
<AlbumContactSheet albums={result.albums} />
|
<AlbumContactSheet albums={result.albums} />
|
||||||
)}
|
)}
|
||||||
</section>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,30 +102,29 @@ function GlobalSearchForm({ query, format, jahr }: { query: string; format?: str
|
|||||||
const years = Array.from({ length: 10 }, (_, i) => currentYear - i);
|
const years = Array.from({ length: 10 }, (_, i) => currentYear - i);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form action="/redaktion/alben" className="global-search-form flex flex-wrap gap-4 items-center mb-8 bg-gray-50 p-4 rounded-xl border border-gray-200" role="search">
|
<form action="/redaktion/alben" className="flex flex-col sm:flex-row gap-4 items-center bg-card p-4 rounded-xl border border-border shadow-sm w-full" role="search">
|
||||||
<div className="flex-grow">
|
<div className="flex-grow w-full sm:w-auto">
|
||||||
<input
|
<Input
|
||||||
type="search"
|
type="search"
|
||||||
name="suche"
|
name="suche"
|
||||||
defaultValue={query}
|
defaultValue={query}
|
||||||
placeholder="Alle Alben durchsuchen..."
|
placeholder="Alle Alben durchsuchen..."
|
||||||
aria-label="Alle Alben durchsuchen"
|
aria-label="Alle Alben durchsuchen"
|
||||||
className="w-full"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex gap-4">
|
<div className="flex gap-3 w-full sm:w-auto">
|
||||||
<select name="format" defaultValue={format || ""} className="px-3 py-2 border border-gray-300 rounded-md">
|
<select name="format" defaultValue={format || ""} className="flex h-10 w-full items-center justify-between rounded-md border border-border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-50">
|
||||||
<option value="">Alle Formate</option>
|
<option value="">Alle Formate</option>
|
||||||
<option value="quer">Querformat</option>
|
<option value="quer">Querformat</option>
|
||||||
<option value="hoch">Hochformat</option>
|
<option value="hoch">Hochformat</option>
|
||||||
</select>
|
</select>
|
||||||
<select name="jahr" defaultValue={jahr || ""} className="px-3 py-2 border border-gray-300 rounded-md">
|
<select name="jahr" defaultValue={jahr || ""} className="flex h-10 w-full items-center justify-between rounded-md border border-border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-50">
|
||||||
<option value="">Alle Jahre</option>
|
<option value="">Alle Jahre</option>
|
||||||
{years.map(y => (
|
{years.map(y => (
|
||||||
<option key={y} value={y.toString()}>{y}</option>
|
<option key={y} value={y.toString()}>{y}</option>
|
||||||
))}
|
))}
|
||||||
</select>
|
</select>
|
||||||
<button type="submit">Suchen</button>
|
<Button type="submit" variant="default">Suchen</Button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
@@ -135,12 +136,12 @@ function GlobalSearchPagination({ page, query }: { page: ImmichSearchPage; query
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<nav aria-label="Suchergebnisseiten" className="photo-pagination">
|
<nav aria-label="Suchergebnisseiten" className="flex justify-between items-center mt-8 pt-4 border-t border-border text-sm font-medium">
|
||||||
{page.previousPage === null ? null : (
|
{page.previousPage === null ? <div /> : (
|
||||||
<Link href={`/redaktion/alben?suche=${encodeURIComponent(query)}&page=${page.previousPage}`}>Vorherige Seite</Link>
|
<Link className="text-primary-600 hover:underline" href={`/redaktion/alben?suche=${encodeURIComponent(query)}&page=${page.previousPage}`}>Vorherige Seite</Link>
|
||||||
)}
|
)}
|
||||||
{page.nextPage === null ? null : (
|
{page.nextPage === null ? <div /> : (
|
||||||
<Link href={`/redaktion/alben?suche=${encodeURIComponent(query)}&page=${page.nextPage}`}>Nächste Seite</Link>
|
<Link className="text-primary-600 hover:underline" href={`/redaktion/alben?suche=${encodeURIComponent(query)}&page=${page.nextPage}`}>Nächste Seite</Link>
|
||||||
)}
|
)}
|
||||||
</nav>
|
</nav>
|
||||||
);
|
);
|
||||||
@@ -167,10 +168,14 @@ async function loadAlbums(editorialId: string) {
|
|||||||
|
|
||||||
function ImmichUnavailable() {
|
function ImmichUnavailable() {
|
||||||
return (
|
return (
|
||||||
<section className="editorial-section editorial-state" aria-labelledby="albums-title">
|
<div className="space-y-6 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500" aria-labelledby="albums-title">
|
||||||
<p className="editorial-kicker">Bildarchiv</p>
|
<div>
|
||||||
<h1 id="albums-title">Alben momentan nicht erreichbar</h1>
|
<p className="text-sm font-semibold uppercase tracking-widest text-primary-600 dark:text-primary-500 mb-2">Bildarchiv</p>
|
||||||
<p role="status">Bitte laden Sie diese Seite in wenigen Minuten erneut. Ihre Freigaben bleiben unverändert.</p>
|
<h1 id="albums-title" className="text-4xl font-bold tracking-tight">Alben momentan nicht erreichbar</h1>
|
||||||
</section>
|
</div>
|
||||||
|
<div className="bg-destructive/15 text-destructive p-4 rounded-md border border-destructive/30" role="status">
|
||||||
|
Bitte laden Sie diese Seite in wenigen Minuten erneut. Ihre Freigaben bleiben unverändert.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -13,47 +13,50 @@ export default async function LightboxPage() {
|
|||||||
|
|
||||||
// Fetch asset details for all items in the lightbox
|
// Fetch asset details for all items in the lightbox
|
||||||
const assets = items.length > 0
|
const assets = items.length > 0
|
||||||
? await immichClient.searchAssets({
|
? await Promise.all(items.map(i => immichClient.getAsset(i.assetId).catch(() => null)))
|
||||||
assetIds: items.map(i => i.assetId)
|
|
||||||
})
|
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const assetMap = new Map(assets.map(a => [a.id, a]));
|
const validAssets = assets.filter((a): a is NonNullable<typeof a> => a !== null);
|
||||||
|
const assetMap = new Map(validAssets.map(a => [a.id, a]));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="editorial-section">
|
<div className="space-y-8 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500">
|
||||||
<p className="editorial-kicker">Merkzettel</p>
|
<div>
|
||||||
<h1>Dein Leuchtkasten</h1>
|
<p className="text-sm font-semibold uppercase tracking-widest text-primary-600 dark:text-primary-500 mb-2">Merkzettel</p>
|
||||||
|
<h1 className="text-4xl font-bold tracking-tight">Dein Leuchtkasten</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
{items.length === 0 ? (
|
{items.length === 0 ? (
|
||||||
<p className="mt-8 text-gray-500">Dein Leuchtkasten ist leer.</p>
|
<p className="text-muted-foreground text-center py-12">Dein Leuchtkasten ist leer.</p>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<div className="flex justify-between items-center mb-8">
|
<div className="flex justify-between items-center bg-card p-4 rounded-xl border border-border shadow-sm">
|
||||||
<p className="text-sm text-gray-600">
|
<p className="text-sm font-medium text-muted-foreground">
|
||||||
{items.length} {items.length === 1 ? 'Bild' : 'Bilder'} gemerkt
|
{items.length} {items.length === 1 ? 'Bild' : 'Bilder'} gemerkt
|
||||||
</p>
|
</p>
|
||||||
<DownloadLightboxForm assetIds={items.map(i => i.assetId)} />
|
<DownloadLightboxForm assetIds={items.map(i => i.assetId)} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul className="photo-contact-sheet">
|
<ul className="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
|
||||||
{items.map((item) => {
|
{items.map((item) => {
|
||||||
const asset = assetMap.get(item.assetId);
|
const asset = assetMap.get(item.assetId);
|
||||||
if (!asset) return null;
|
if (!asset) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<li key={item.assetId} className="photo-contact-frame relative group">
|
<li key={item.assetId} className="relative group rounded-xl overflow-hidden border border-border bg-card shadow-sm transition-all hover:shadow-md hover:-translate-y-1">
|
||||||
<Link href={`/redaktion/nutzungen/neu?assetId=${item.assetId}`} className="contact-sheet-link">
|
<Link href={`/redaktion/nutzungen/neu?assetId=${item.assetId}`} className="block">
|
||||||
|
<div className="aspect-[3/2] w-full overflow-hidden bg-muted">
|
||||||
<Image
|
<Image
|
||||||
alt={asset.originalFileName}
|
alt={asset.originalFileName ?? "Bild"}
|
||||||
className="contact-sheet-image"
|
className="w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"
|
||||||
height={200}
|
height={200}
|
||||||
src={`/api/assets/${encodeURIComponent(item.assetId)}/thumbnail`}
|
src={`/api/assets/${encodeURIComponent(item.assetId)}/thumbnail`}
|
||||||
width={300}
|
width={300}
|
||||||
/>
|
/>
|
||||||
<div className="contact-strip">
|
</div>
|
||||||
<span className="contact-strip-name" title={asset.originalFileName}>
|
<div className="p-3 border-t border-border bg-card">
|
||||||
{asset.originalFileName}
|
<span className="block truncate text-xs font-medium text-muted-foreground" title={asset.originalFileName}>
|
||||||
|
{asset.originalFileName ?? "Unbekannt"}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
@@ -66,6 +69,6 @@ export default async function LightboxPage() {
|
|||||||
</ul>
|
</ul>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
</section>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
import { authClient } from "@/modules/auth/client";
|
import { authClient } from "@/modules/auth/client";
|
||||||
|
import { Button } from "@/components/ui/button";
|
||||||
|
|
||||||
// Renders into the portal masthead. Better Auth's signOut clears the session
|
// 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
|
// cookie server-side; we then hard-navigate to the login page so no stale
|
||||||
@@ -20,8 +21,14 @@ export function LogoutButton() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button className="portal-signout" disabled={pending} onClick={signOut} type="button">
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
size="sm"
|
||||||
|
disabled={pending}
|
||||||
|
onClick={signOut}
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
{pending ? "…" : "Abmelden"}
|
{pending ? "…" : "Abmelden"}
|
||||||
</button>
|
</Button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import Link from "next/link";
|
|||||||
|
|
||||||
import { BrandLogo } from "@/components/brand/logo";
|
import { BrandLogo } from "@/components/brand/logo";
|
||||||
import { LogoutButton } from "@/components/layout/logout-button";
|
import { LogoutButton } from "@/components/layout/logout-button";
|
||||||
|
import { ThemeToggle } from "@/components/theme-toggle";
|
||||||
|
|
||||||
export type NavItem = { href: string; label: string };
|
export type NavItem = { href: string; label: string };
|
||||||
|
|
||||||
@@ -27,24 +28,35 @@ export function PortalShell({
|
|||||||
children,
|
children,
|
||||||
}: Readonly<PortalShellProps>) {
|
}: Readonly<PortalShellProps>) {
|
||||||
return (
|
return (
|
||||||
<div className="editorial-shell">
|
<div className="min-h-screen bg-background flex flex-col">
|
||||||
<header className="portal-masthead">
|
<header className="sticky top-0 z-50 w-full border-b border-border/40 bg-background/80 backdrop-blur-md transition-colors duration-300">
|
||||||
<Link aria-label={sectionLabel} className="portal-brand" href={brandHref}>
|
<div className="flex h-16 items-center justify-between px-6 lg:px-12">
|
||||||
<BrandLogo variant="white" />
|
<Link aria-label={sectionLabel} className="flex items-center gap-2 transition-opacity hover:opacity-80" href={brandHref}>
|
||||||
|
{/* The BrandLogo might need to be theme-aware or we just use white/black depending on theme */}
|
||||||
|
<div className="dark:hidden flex items-center"><BrandLogo variant="black" /></div>
|
||||||
|
<div className="hidden dark:flex items-center"><BrandLogo variant="white" /></div>
|
||||||
</Link>
|
</Link>
|
||||||
<div className="portal-masthead-meta">
|
<div className="flex items-center gap-6 text-sm font-medium">
|
||||||
<span>{sectionLabel}</span>
|
<span className="hidden md:inline-block text-muted-foreground uppercase tracking-widest text-xs font-bold">{sectionLabel}</span>
|
||||||
<nav aria-label={sectionLabel}>
|
<nav aria-label={sectionLabel} className="hidden sm:flex items-center gap-6">
|
||||||
{nav.map((item) => (
|
{nav.map((item) => (
|
||||||
<Link key={item.href} href={item.href}>
|
<Link
|
||||||
|
key={item.href}
|
||||||
|
href={item.href}
|
||||||
|
className="transition-colors hover:text-primary-500 text-foreground"
|
||||||
|
>
|
||||||
{item.label}
|
{item.label}
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
|
<div className="flex items-center gap-4">
|
||||||
|
<ThemeToggle />
|
||||||
<LogoutButton />
|
<LogoutButton />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<main className={mainClassName}>{children}</main>
|
<main className="flex-1 w-full max-w-7xl mx-auto px-6 py-12 lg:px-12 lg:py-16">{children}</main>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -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 <NextThemesProvider {...props}>{children}</NextThemesProvider>;
|
||||||
|
}
|
||||||
@@ -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 <div className="w-9 h-9" /> // Placeholder to prevent layout shift
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
variant="ghost"
|
||||||
|
size="icon"
|
||||||
|
onClick={() => setTheme(theme === "light" ? "dark" : "light")}
|
||||||
|
title="Design umschalten"
|
||||||
|
>
|
||||||
|
{theme === "light" ? (
|
||||||
|
<Sun className="h-[1.2rem] w-[1.2rem] transition-all" />
|
||||||
|
) : (
|
||||||
|
<Moon className="h-[1.2rem] w-[1.2rem] transition-all" />
|
||||||
|
)}
|
||||||
|
<span className="sr-only">Design umschalten</span>
|
||||||
|
</Button>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -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<HTMLButtonElement> {
|
||||||
|
asChild?: boolean
|
||||||
|
variant?: "default" | "destructive" | "outline" | "secondary" | "ghost" | "link"
|
||||||
|
size?: "default" | "sm" | "lg" | "icon"
|
||||||
|
}
|
||||||
|
|
||||||
|
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
||||||
|
({ 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 (
|
||||||
|
<Comp
|
||||||
|
className={cn(baseClasses, variantClasses[variant], sizeClasses[size], className)}
|
||||||
|
ref={ref}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
Button.displayName = "Button"
|
||||||
|
|
||||||
|
export { Button }
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
const Card = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
||||||
|
({ className, ...props }, ref) => (
|
||||||
|
<div
|
||||||
|
ref={ref}
|
||||||
|
className={cn(
|
||||||
|
"rounded-xl border border-border bg-card text-card-foreground shadow-sm overflow-hidden",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
)
|
||||||
|
Card.displayName = "Card"
|
||||||
|
|
||||||
|
const CardHeader = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
||||||
|
({ className, ...props }, ref) => (
|
||||||
|
<div
|
||||||
|
ref={ref}
|
||||||
|
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
)
|
||||||
|
CardHeader.displayName = "CardHeader"
|
||||||
|
|
||||||
|
const CardTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
|
||||||
|
({ className, ...props }, ref) => (
|
||||||
|
<h3
|
||||||
|
ref={ref}
|
||||||
|
className={cn("text-2xl font-semibold leading-none tracking-tight", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
)
|
||||||
|
CardTitle.displayName = "CardTitle"
|
||||||
|
|
||||||
|
const CardDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
|
||||||
|
({ className, ...props }, ref) => (
|
||||||
|
<p
|
||||||
|
ref={ref}
|
||||||
|
className={cn("text-sm text-gray-500 dark:text-gray-400", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
)
|
||||||
|
CardDescription.displayName = "CardDescription"
|
||||||
|
|
||||||
|
const CardContent = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
||||||
|
({ className, ...props }, ref) => (
|
||||||
|
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
||||||
|
)
|
||||||
|
)
|
||||||
|
CardContent.displayName = "CardContent"
|
||||||
|
|
||||||
|
const CardFooter = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(
|
||||||
|
({ className, ...props }, ref) => (
|
||||||
|
<div
|
||||||
|
ref={ref}
|
||||||
|
className={cn("flex items-center p-6 pt-0", className)}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
)
|
||||||
|
CardFooter.displayName = "CardFooter"
|
||||||
|
|
||||||
|
export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import * as React from "react"
|
||||||
|
|
||||||
|
import { cn } from "@/lib/utils"
|
||||||
|
|
||||||
|
export interface InputProps
|
||||||
|
extends React.InputHTMLAttributes<HTMLInputElement> {}
|
||||||
|
|
||||||
|
const Input = React.forwardRef<HTMLInputElement, InputProps>(
|
||||||
|
({ className, type, ...props }, ref) => {
|
||||||
|
return (
|
||||||
|
<input
|
||||||
|
type={type}
|
||||||
|
className={cn(
|
||||||
|
"flex h-10 w-full rounded-md border border-border bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-gray-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 dark:placeholder:text-gray-400",
|
||||||
|
className
|
||||||
|
)}
|
||||||
|
ref={ref}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
Input.displayName = "Input"
|
||||||
|
|
||||||
|
export { Input }
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import { type ClassValue, clsx } from "clsx";
|
||||||
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
|
export function cn(...inputs: ClassValue[]) {
|
||||||
|
return twMerge(clsx(inputs));
|
||||||
|
}
|
||||||
@@ -49,6 +49,7 @@ export function PhotoContactSheet({
|
|||||||
page,
|
page,
|
||||||
query,
|
query,
|
||||||
showAlbumName = false,
|
showAlbumName = false,
|
||||||
|
lightboxAssetIds,
|
||||||
}: Readonly<{
|
}: Readonly<{
|
||||||
albumId?: string;
|
albumId?: string;
|
||||||
albumName: string;
|
albumName: string;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ const validSelection = {
|
|||||||
usageIds: ["u1", "u2"],
|
usageIds: ["u1", "u2"],
|
||||||
period,
|
period,
|
||||||
adminUserId: "a1",
|
adminUserId: "a1",
|
||||||
|
flatrateCentsSnapshot: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
const address: BillingReportAddress = {
|
const address: BillingReportAddress = {
|
||||||
@@ -69,6 +70,10 @@ function createMockRepo() {
|
|||||||
return address;
|
return address;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
async getEditorialFlatrate() {
|
||||||
|
return { flatrateActive: false, flatratePriceCents: null, flatrateAssetLimit: null };
|
||||||
|
},
|
||||||
|
|
||||||
async getSelectedUsages(_editorialId, usageIds) {
|
async getSelectedUsages(_editorialId, usageIds) {
|
||||||
return usageIds.map((id) => selectedUsage(id, usageStatuses.get(id) as "open" | "reopened"));
|
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,
|
editorialId: validSelection.editorialId,
|
||||||
usageIds: validSelection.usageIds,
|
usageIds: validSelection.usageIds,
|
||||||
period: validSelection.period,
|
period: validSelection.period,
|
||||||
|
flatrateCentsSnapshot: null,
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(bytes).toBeInstanceOf(Buffer);
|
expect(bytes).toBeInstanceOf(Buffer);
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ export type ReportSelection = {
|
|||||||
editorialId: string;
|
editorialId: string;
|
||||||
usageIds: string[];
|
usageIds: string[];
|
||||||
period: BillingPeriod;
|
period: BillingPeriod;
|
||||||
|
flatrateCentsSnapshot: number | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type FinalizeReportInput = ReportSelection & {
|
export type FinalizeReportInput = ReportSelection & {
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
import { useState, useTransition } from "react";
|
import { useState, useTransition } from "react";
|
||||||
|
|
||||||
import { archiveEditorialAction } from "@/app/admin/redaktionen/[id]/actions";
|
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 = {
|
type DangerZoneProps = {
|
||||||
editorialId: string;
|
editorialId: string;
|
||||||
@@ -22,28 +25,36 @@ export function DangerZone({ editorialId, editorialName }: DangerZoneProps) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="danger-zone" aria-labelledby="danger-title">
|
<Card className="border-destructive/50 bg-destructive/5 dark:bg-destructive/10">
|
||||||
<h2 id="danger-title">Gefahrenzone</h2>
|
<CardHeader>
|
||||||
<p>Alle Albumrechte werden widerrufen und der Login wird deaktiviert. Abrechnungsdaten bleiben erhalten.</p>
|
<CardTitle className="text-destructive">Gefahrenzone</CardTitle>
|
||||||
<label>
|
<CardDescription>
|
||||||
<span>Redaktionsname zur Bestätigung eingeben:</span>
|
Alle Albumrechte werden widerrufen und der Login wird deaktiviert. Abrechnungsdaten bleiben erhalten.
|
||||||
<input
|
</CardDescription>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent className="space-y-4">
|
||||||
|
<div className="space-y-2">
|
||||||
|
<label className="text-sm font-medium">
|
||||||
|
Redaktionsname zur Bestätigung eingeben:
|
||||||
|
</label>
|
||||||
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
value={confirmText}
|
value={confirmText}
|
||||||
onChange={(e) => setConfirmText(e.target.value)}
|
onChange={(e) => setConfirmText(e.target.value)}
|
||||||
placeholder={editorialName}
|
placeholder={editorialName}
|
||||||
className="danger-zone-input"
|
|
||||||
disabled={isPending}
|
disabled={isPending}
|
||||||
|
className="border-destructive/30 focus-visible:ring-destructive"
|
||||||
/>
|
/>
|
||||||
</label>
|
</div>
|
||||||
<button
|
<Button
|
||||||
type="button"
|
type="button"
|
||||||
className="action-button action-button--danger"
|
variant="destructive"
|
||||||
disabled={!isConfirmed || isPending}
|
disabled={!isConfirmed || isPending}
|
||||||
onClick={handleArchive}
|
onClick={handleArchive}
|
||||||
>
|
>
|
||||||
{isPending ? "Wird archiviert…" : "Redaktion archivieren"}
|
{isPending ? "Wird archiviert…" : "Redaktion archivieren"}
|
||||||
</button>
|
</Button>
|
||||||
</section>
|
</CardContent>
|
||||||
|
</Card>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,7 @@
|
|||||||
import Link from "next/link";
|
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 { archiveEditorialAction, suspendEditorialAction, reactivateEditorialAction, updateFlatrateAction } from "@/app/admin/redaktionen/[id]/actions";
|
||||||
import { DangerZone } from "./DangerZone";
|
import { DangerZone } from "./DangerZone";
|
||||||
|
|
||||||
@@ -21,121 +24,160 @@ export function EditorialDetailContent({
|
|||||||
hasActiveGrant,
|
hasActiveGrant,
|
||||||
}: Readonly<{ editorial: EditorialDetail; hasActiveGrant: boolean }>) {
|
}: Readonly<{ editorial: EditorialDetail; hasActiveGrant: boolean }>) {
|
||||||
return (
|
return (
|
||||||
<section className="content-section" aria-labelledby="editorial-title">
|
<div className="space-y-8 max-w-4xl animate-in fade-in slide-in-from-bottom-4 duration-500">
|
||||||
<p className="eyebrow">Redaktion</p>
|
<div>
|
||||||
<h1 id="editorial-title">{editorial.name}</h1>
|
<p className="text-sm font-semibold uppercase tracking-widest text-primary-600 dark:text-primary-500 mb-2">Redaktion</p>
|
||||||
|
<h1 className="text-4xl font-bold tracking-tight">{editorial.name}</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
{editorial.archivedAt && (
|
{editorial.archivedAt && (
|
||||||
<p className="danger-banner" role="status">
|
<div className="bg-destructive/15 text-destructive p-4 rounded-md border border-destructive/30" role="status">
|
||||||
Diese Redaktion wurde am {editorial.archivedAt.toLocaleDateString('de-DE')} archiviert.
|
Diese Redaktion wurde am {editorial.archivedAt.toLocaleDateString('de-DE')} archiviert.
|
||||||
</p>
|
</div>
|
||||||
)}
|
)}
|
||||||
<dl>
|
|
||||||
<dt>Ansprechperson</dt>
|
<Card>
|
||||||
<dd>{editorial.contactName}</dd>
|
<CardHeader>
|
||||||
<dt>Anmelde-E-Mail</dt>
|
<CardTitle>Stammdaten</CardTitle>
|
||||||
<dd>{editorial.loginEmail}</dd>
|
</CardHeader>
|
||||||
<dt>Status</dt>
|
<CardContent>
|
||||||
<dd>{editorial.status}</dd>
|
<dl className="grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-4">
|
||||||
<dt>E-Mail bestätigt</dt>
|
<div>
|
||||||
<dd>{editorial.emailVerifiedAt ? "Ja" : "Nein"}</dd>
|
<dt className="text-sm font-medium text-muted-foreground">Ansprechperson</dt>
|
||||||
<dt>Individueller Nettopreis</dt>
|
<dd className="mt-1 font-medium">{editorial.contactName}</dd>
|
||||||
<dd>
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt className="text-sm font-medium text-muted-foreground">Anmelde-E-Mail</dt>
|
||||||
|
<dd className="mt-1 font-medium">{editorial.loginEmail}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt className="text-sm font-medium text-muted-foreground">Status</dt>
|
||||||
|
<dd className="mt-1 font-medium capitalize">{editorial.status}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt className="text-sm font-medium text-muted-foreground">E-Mail bestätigt</dt>
|
||||||
|
<dd className="mt-1 font-medium">{editorial.emailVerifiedAt ? "Ja" : "Nein"}</dd>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<dt className="text-sm font-medium text-muted-foreground">Individueller Nettopreis</dt>
|
||||||
|
<dd className="mt-1 font-medium">
|
||||||
{editorial.currentPriceCents === null
|
{editorial.currentPriceCents === null
|
||||||
? "Noch nicht festgelegt"
|
? "Noch nicht festgelegt"
|
||||||
: formatCents(editorial.currentPriceCents)}
|
: formatCents(editorial.currentPriceCents)}
|
||||||
</dd>
|
</dd>
|
||||||
|
</div>
|
||||||
</dl>
|
</dl>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
|
||||||
<section aria-labelledby="approval-title">
|
<Card>
|
||||||
<h2 id="approval-title">Freigabe</h2>
|
<CardHeader>
|
||||||
<button type="button" disabled aria-describedby="approval-help">
|
<CardTitle>Freigabe & Rechte</CardTitle>
|
||||||
Redaktion freigeben
|
<CardDescription>
|
||||||
</button>
|
|
||||||
<p id="approval-help">
|
|
||||||
{hasActiveGrant
|
{hasActiveGrant
|
||||||
? "Mindestens ein Albumrecht ist zugewiesen. Die Freigabe bleibt bis zur weiteren Verwaltungsoberfläche deaktiviert."
|
? "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."}
|
: "Eine Freigabe ist erst möglich, wenn mindestens ein aktives Albumrecht zugewiesen wurde."}
|
||||||
</p>
|
</CardDescription>
|
||||||
<Link href={`/admin/redaktionen/${editorial.id}/alben`}>Albumrechte verwalten</Link>
|
</CardHeader>
|
||||||
{" · "}
|
<CardContent className="flex flex-col sm:flex-row gap-4 items-start sm:items-center">
|
||||||
<Link href={`/admin/redaktionen/${editorial.id}/auto-regeln`}>Auto-Zuweisungsregeln</Link>
|
<Button disabled variant="outline">
|
||||||
</section>
|
Redaktion freigeben
|
||||||
|
</Button>
|
||||||
|
<div className="flex gap-4 text-sm font-medium">
|
||||||
|
<Link href={`/admin/redaktionen/${editorial.id}/alben`} className="text-primary-600 hover:underline">
|
||||||
|
Albumrechte verwalten
|
||||||
|
</Link>
|
||||||
|
<span className="text-muted-foreground">·</span>
|
||||||
|
<Link href={`/admin/redaktionen/${editorial.id}/auto-regeln`} className="text-primary-600 hover:underline">
|
||||||
|
Auto-Zuweisungsregeln
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
|
||||||
{/* Flatrate Settings */}
|
|
||||||
{!editorial.archivedAt && (
|
{!editorial.archivedAt && (
|
||||||
<section aria-labelledby="flatrate-title" className="mt-8">
|
<Card>
|
||||||
<h2 id="flatrate-title">Flatrate-Einstellungen</h2>
|
<CardHeader>
|
||||||
<form action={updateFlatrateAction.bind(null, editorial.id)} className="space-y-4 max-w-lg mt-4">
|
<CardTitle>Flatrate-Einstellungen</CardTitle>
|
||||||
<div>
|
<CardDescription>Pauschalpreis für Downloads aktivieren.</CardDescription>
|
||||||
<label className="flex items-center gap-2 font-semibold">
|
</CardHeader>
|
||||||
<input type="checkbox" name="flatrateActive" defaultChecked={editorial.flatrateActive} />
|
<CardContent>
|
||||||
|
<form action={updateFlatrateAction.bind(null, editorial.id)} className="space-y-6">
|
||||||
|
<div className="flex items-center space-x-2">
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
name="flatrateActive"
|
||||||
|
id="flatrateActive"
|
||||||
|
defaultChecked={editorial.flatrateActive}
|
||||||
|
className="w-4 h-4 rounded border-border text-primary-600 focus:ring-primary-500"
|
||||||
|
/>
|
||||||
|
<label htmlFor="flatrateActive" className="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70">
|
||||||
Flatrate aktivieren
|
Flatrate aktivieren
|
||||||
</label>
|
</label>
|
||||||
<p className="text-sm text-gray-500 mt-1">Wenn aktiviert, werden Downloads nach einem Pauschalpreis abgerechnet.</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="flex gap-4">
|
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||||
<div className="flex-1">
|
<div className="space-y-2">
|
||||||
<label className="block font-semibold mb-1" htmlFor="flatratePriceEuros">Flatrate-Preis (Netto €)</label>
|
<label className="text-sm font-medium" htmlFor="flatratePriceEuros">Flatrate-Preis (Netto €)</label>
|
||||||
<input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
id="flatratePriceEuros"
|
id="flatratePriceEuros"
|
||||||
name="flatratePriceEuros"
|
name="flatratePriceEuros"
|
||||||
step="0.01"
|
step="0.01"
|
||||||
min="0"
|
min="0"
|
||||||
className="border p-2 rounded w-full"
|
|
||||||
defaultValue={editorial.flatratePriceCents ? (editorial.flatratePriceCents / 100).toFixed(2) : ""}
|
defaultValue={editorial.flatratePriceCents ? (editorial.flatratePriceCents / 100).toFixed(2) : ""}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex-1">
|
<div className="space-y-2">
|
||||||
<label className="block font-semibold mb-1" htmlFor="flatrateAssetLimit">Bild-Limit (pro Monat)</label>
|
<label className="text-sm font-medium" htmlFor="flatrateAssetLimit">Bild-Limit (pro Monat)</label>
|
||||||
<input
|
<Input
|
||||||
type="number"
|
type="number"
|
||||||
id="flatrateAssetLimit"
|
id="flatrateAssetLimit"
|
||||||
name="flatrateAssetLimit"
|
name="flatrateAssetLimit"
|
||||||
min="1"
|
min="1"
|
||||||
placeholder="Unbegrenzt"
|
placeholder="Unbegrenzt"
|
||||||
className="border p-2 rounded w-full"
|
|
||||||
defaultValue={editorial.flatrateAssetLimit ?? ""}
|
defaultValue={editorial.flatrateAssetLimit ?? ""}
|
||||||
/>
|
/>
|
||||||
<p className="text-xs text-gray-500 mt-1">Leer lassen für unbegrenzte Flatrate.</p>
|
<p className="text-xs text-muted-foreground">Leer lassen für unbegrenzte Flatrate.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button type="submit" className="px-4 py-2 bg-black text-white font-semibold rounded hover:bg-gray-800 transition">
|
<Button type="submit">
|
||||||
Speichern
|
Speichern
|
||||||
</button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</CardContent>
|
||||||
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Status Actions */}
|
|
||||||
{!editorial.archivedAt && (
|
{!editorial.archivedAt && (
|
||||||
<section aria-labelledby="status-actions-title">
|
<Card className="border-border">
|
||||||
<h2 id="status-actions-title">Status-Aktionen</h2>
|
<CardHeader>
|
||||||
|
<CardTitle>Status-Aktionen</CardTitle>
|
||||||
|
</CardHeader>
|
||||||
|
<CardContent>
|
||||||
{editorial.status === 'active' && (
|
{editorial.status === 'active' && (
|
||||||
<form action={suspendEditorialAction.bind(null, editorial.id)}>
|
<form action={suspendEditorialAction.bind(null, editorial.id)}>
|
||||||
<button type="submit" className="action-button action-button--warning">
|
<Button type="submit" variant="destructive">
|
||||||
Zugang sperren
|
Zugang sperren
|
||||||
</button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
)}
|
)}
|
||||||
{editorial.status === 'suspended' && (
|
{editorial.status === 'suspended' && (
|
||||||
<form action={reactivateEditorialAction.bind(null, editorial.id)}>
|
<form action={reactivateEditorialAction.bind(null, editorial.id)}>
|
||||||
<button type="submit" className="action-button">
|
<Button type="submit" variant="secondary">
|
||||||
Zugang reaktivieren
|
Zugang reaktivieren
|
||||||
</button>
|
</Button>
|
||||||
</form>
|
</form>
|
||||||
)}
|
)}
|
||||||
</section>
|
</CardContent>
|
||||||
|
</Card>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* Danger Zone */}
|
|
||||||
{!editorial.archivedAt && (
|
{!editorial.archivedAt && (
|
||||||
<DangerZone editorialId={editorial.id} editorialName={editorial.name} />
|
<DangerZone editorialId={editorial.id} editorialName={editorial.name} />
|
||||||
)}
|
)}
|
||||||
</section>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ export type ImmichAsset = {
|
|||||||
originalMimeType: string;
|
originalMimeType: string;
|
||||||
localDateTime: string | null;
|
localDateTime: string | null;
|
||||||
fileCreatedAt: string | null;
|
fileCreatedAt: string | null;
|
||||||
|
exifInfo?: {
|
||||||
|
exifImageWidth?: number | null;
|
||||||
|
exifImageHeight?: number | null;
|
||||||
|
} | null;
|
||||||
albums: Array<{ id: string }>;
|
albums: Array<{ id: string }>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,12 @@ import { and, eq } from "drizzle-orm";
|
|||||||
import { db } from "@/db/client";
|
import { db } from "@/db/client";
|
||||||
import { lightboxItems } from "@/db/schema";
|
import { lightboxItems } from "@/db/schema";
|
||||||
import { immichClient } from "@/modules/immich/client";
|
import { immichClient } from "@/modules/immich/client";
|
||||||
import type { PhotoAsset } from "@/modules/immich/types";
|
import type { ImmichAsset } from "@/modules/immich/types";
|
||||||
|
|
||||||
export type LightboxItem = {
|
export type LightboxItem = {
|
||||||
assetId: string;
|
assetId: string;
|
||||||
addedAt: Date;
|
addedAt: Date;
|
||||||
asset?: PhotoAsset; // populated if joined
|
asset?: ImmichAsset; // populated if joined
|
||||||
};
|
};
|
||||||
|
|
||||||
export const lightboxService = {
|
export const lightboxService = {
|
||||||
|
|||||||
Reference in new issue
Block a user