feat: complete UI design system refactoring and fix TS build errors
This commit is contained in:
1 parent
0b1ffdfdfc
commit
8728308fc6
27 files changed
+847
-370
No files matched your search
+89
-67
@@ -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 (
|
||||
<section className="content-section">
|
||||
<h1>Admin Dashboard</h1>
|
||||
<p className="text-gray-600 mb-8">Willkommen zurück! Hier ist ein Überblick über die aktuelle Nutzung des Portals.</p>
|
||||
<div className="space-y-8 animate-in fade-in slide-in-from-bottom-4 duration-500">
|
||||
<div>
|
||||
<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="bg-white p-6 rounded-xl border border-gray-200 shadow-sm">
|
||||
<h2 className="text-sm font-semibold text-gray-500 uppercase tracking-wide">Umsatz diesen Monat</h2>
|
||||
<p className="text-4xl font-bold text-green-600 mt-2">
|
||||
{formatter.format((revenueStats?.totalCents ?? 0) / 100)}
|
||||
</p>
|
||||
<p className="text-sm text-gray-500 mt-2">
|
||||
{revenueStats?.count ?? 0} lizenzierte Bilder im {now.toLocaleString("de-DE", { month: "long" })}
|
||||
</p>
|
||||
</div>
|
||||
<div className="grid grid-cols-1 md:grid-cols-3 gap-6">
|
||||
<Card>
|
||||
<CardHeader className="pb-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)}
|
||||
</div>
|
||||
<p className="text-sm text-muted-foreground mt-1">
|
||||
{revenueStats?.count ?? 0} lizenzierte Bilder im {now.toLocaleString("de-DE", { month: "long" })}
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<div className="bg-white p-6 rounded-xl border border-gray-200 shadow-sm flex flex-col justify-center">
|
||||
<Link href="/admin/redaktionen" className="primary-action text-center m-0">
|
||||
Redaktionen verwalten
|
||||
</Link>
|
||||
</div>
|
||||
<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">
|
||||
<CardContent className="pt-6">
|
||||
<Button asChild size="lg" className="w-full">
|
||||
<Link href="/admin/redaktionen">
|
||||
Redaktionen verwalten
|
||||
</Link>
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 lg:grid-cols-2 gap-8">
|
||||
<div>
|
||||
<h3 className="text-xl font-bold mb-4">Aktivste Redaktionen</h3>
|
||||
<div className="bg-white rounded-xl border border-gray-200 overflow-hidden shadow-sm">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Aktivste Redaktionen</CardTitle>
|
||||
<CardDescription>Die Top 5 Redaktionen nach Downloads.</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{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">
|
||||
<thead className="bg-gray-50">
|
||||
<tr>
|
||||
<th className="py-3 px-4 font-semibold text-gray-700">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-gray-700 text-right">Umsatz</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{topEditorials.map(ed => (
|
||||
<tr key={ed.editorialId} className="border-t border-gray-100">
|
||||
<td className="py-3 px-4">
|
||||
<Link href={`/admin/redaktionen/${ed.editorialId}`} className="text-blue-600 hover:underline">
|
||||
{ed.name}
|
||||
</Link>
|
||||
</td>
|
||||
<td className="py-3 px-4 text-right">{ed.downloadCount}</td>
|
||||
<td className="py-3 px-4 text-right">{formatter.format(ed.revenueCents / 100)}</td>
|
||||
<div className="overflow-hidden rounded-md border border-border">
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="bg-muted/50 border-b border-border">
|
||||
<tr>
|
||||
<th className="py-3 px-4 font-semibold">Redaktion</th>
|
||||
<th className="py-3 px-4 font-semibold text-right">Downloads</th>
|
||||
<th className="py-3 px-4 font-semibold text-right">Umsatz</th>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>
|
||||
{topEditorials.map((ed, i) => (
|
||||
<tr key={ed.editorialId} className={i !== topEditorials.length - 1 ? "border-b border-border" : ""}>
|
||||
<td className="py-3 px-4">
|
||||
<Link href={`/admin/redaktionen/${ed.editorialId}`} className="text-primary-600 dark:text-primary-400 hover:underline font-medium">
|
||||
{ed.name}
|
||||
</Link>
|
||||
</td>
|
||||
<td className="py-3 px-4 text-right tabular-nums">{ed.downloadCount}</td>
|
||||
<td className="py-3 px-4 text-right tabular-nums">{formatter.format(ed.revenueCents / 100)}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<div>
|
||||
<h3 className="text-xl font-bold mb-4">Beliebteste Alben</h3>
|
||||
<div className="bg-white rounded-xl border border-gray-200 overflow-hidden shadow-sm">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Beliebteste Alben</CardTitle>
|
||||
<CardDescription>Die Top 5 Alben nach Nutzung.</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{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">
|
||||
<thead className="bg-gray-50">
|
||||
<tr>
|
||||
<th className="py-3 px-4 font-semibold text-gray-700">Album</th>
|
||||
<th className="py-3 px-4 font-semibold text-gray-700 text-right">Downloads</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{topAlbums.map(album => (
|
||||
<tr key={album.albumName} className="border-t border-gray-100">
|
||||
<td className="py-3 px-4 font-medium text-gray-800">{album.albumName}</td>
|
||||
<td className="py-3 px-4 text-right text-gray-600">{album.downloadCount}</td>
|
||||
<div className="overflow-hidden rounded-md border border-border">
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="bg-muted/50 border-b border-border">
|
||||
<tr>
|
||||
<th className="py-3 px-4 font-semibold">Album</th>
|
||||
<th className="py-3 px-4 font-semibold text-right">Downloads</th>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>
|
||||
{topAlbums.map((album, i) => (
|
||||
<tr key={album.albumName} className={i !== topAlbums.length - 1 ? "border-b border-border" : ""}>
|
||||
<td className="py-3 px-4 font-medium">{album.albumName}</td>
|
||||
<td className="py-3 px-4 text-right tabular-nums">{album.downloadCount}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -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", () => {
|
||||
|
||||
@@ -28,43 +28,46 @@ export default async function EditorialAlbumsPage({
|
||||
|
||||
if (albumResult.unavailable) {
|
||||
return (
|
||||
<section className="content-section" aria-labelledby="albums-title">
|
||||
<p className="eyebrow">Redaktion · Albumrechte</p>
|
||||
<h1 id="albums-title">Alben für {editorial.name}</h1>
|
||||
<p role="status">
|
||||
Die Immich-Alben sind momentan nicht erreichbar. Bereits bestehende Zuweisungen bleiben
|
||||
unverändert.
|
||||
</p>
|
||||
<p>
|
||||
<Link href={`/admin/redaktionen/${editorial.id}`}>Zurück zur Redaktion</Link>
|
||||
</p>
|
||||
</section>
|
||||
<div className="space-y-6 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500">
|
||||
<div>
|
||||
<p className="text-sm font-semibold uppercase tracking-widest text-primary-600 dark:text-primary-500 mb-2">Redaktion · Albumrechte</p>
|
||||
<h1 className="text-4xl font-bold tracking-tight">Alben für {editorial.name}</h1>
|
||||
</div>
|
||||
<div className="bg-destructive/15 text-destructive p-4 rounded-md border border-destructive/30" role="status">
|
||||
Die Immich-Alben sind momentan nicht erreichbar. Bereits bestehende Zuweisungen bleiben unverändert.
|
||||
</div>
|
||||
<div className="flex gap-4">
|
||||
<Link href={`/admin/redaktionen/${editorial.id}`} className="text-primary-600 hover:underline">Zurück zur Redaktion</Link>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="content-section" aria-labelledby="albums-title">
|
||||
<p className="eyebrow">Redaktion · Albumrechte</p>
|
||||
<h1 id="albums-title">Alben für {editorial.name}</h1>
|
||||
<p>
|
||||
<div className="space-y-8 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500">
|
||||
<div>
|
||||
<p className="text-sm font-semibold uppercase tracking-widest text-primary-600 dark:text-primary-500 mb-2">Redaktion · Albumrechte</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.
|
||||
</p>
|
||||
<p>
|
||||
<Link href={`/admin/redaktionen/${editorial.id}`}>Zurück zur Redaktion</Link>
|
||||
{" · "}
|
||||
<Link href={`/admin/redaktionen/${editorial.id}/auto-regeln`}>Auto-Zuweisungsregeln verwalten</Link>
|
||||
</p>
|
||||
<div className="flex gap-4 mt-4 text-sm font-medium">
|
||||
<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`} className="text-primary-600 hover:underline">Auto-Zuweisungsregeln verwalten</Link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{albumResult.albums.length === 0 ? (
|
||||
<p>Derzeit sind keine zuweisbaren Alben vorhanden.</p>
|
||||
) : (
|
||||
<AlbumGrid
|
||||
albums={albumResult.albums}
|
||||
editorialId={editorial.id}
|
||||
grantAction={grantAlbumAction}
|
||||
revokeAction={revokeAlbumAction}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
{albumResult.albums.length === 0 ? (
|
||||
<p className="text-muted-foreground">Derzeit sind keine zuweisbaren Alben vorhanden.</p>
|
||||
) : (
|
||||
<AlbumGrid
|
||||
albums={albumResult.albums}
|
||||
editorialId={editorial.id}
|
||||
grantAction={grantAlbumAction}
|
||||
revokeAction={revokeAlbumAction}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -48,6 +48,7 @@ export function createFinalizeHandler(dependencies: FinalizeHandlerDependencies)
|
||||
usageIds,
|
||||
period,
|
||||
adminUserId: principal.userId,
|
||||
flatrateCentsSnapshot: null,
|
||||
});
|
||||
|
||||
// Email dispatch
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
+18
-4
@@ -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 (
|
||||
<html lang="de">
|
||||
<body>
|
||||
{children}
|
||||
<LegalFooter />
|
||||
<html lang="de" suppressHydrationWarning>
|
||||
<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}
|
||||
</div>
|
||||
<LegalFooter />
|
||||
</ThemeProvider>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
@@ -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 (
|
||||
<section className="editorial-section">
|
||||
<p className="editorial-kicker">Finanzen</p>
|
||||
<h1>Meine Abrechnungen</h1>
|
||||
<div className="space-y-8 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500">
|
||||
<div>
|
||||
<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>
|
||||
|
||||
<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>
|
||||
<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 && (
|
||||
<div className="bg-green-50 p-6 rounded-xl border border-green-100">
|
||||
<h2 className="text-xl font-semibold text-green-900 mb-2">Aktiver Tarif: Flatrate</h2>
|
||||
<p className="text-3xl font-bold text-green-900">
|
||||
{new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(editorial.flatratePriceCents / 100)} <span className="text-lg font-normal">/ Monat</span>
|
||||
</p>
|
||||
{editorial.flatrateAssetLimit === null ? (
|
||||
<p className="text-sm text-green-700 mt-2">
|
||||
Unbegrenzte Downloads inklusive
|
||||
<Card className="bg-emerald-50/50 dark:bg-emerald-900/10 border-emerald-100 dark:border-emerald-900/30">
|
||||
<CardHeader className="pb-2">
|
||||
<CardTitle className="text-emerald-900 dark:text-emerald-100">Aktiver Tarif: Flatrate</CardTitle>
|
||||
</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>
|
||||
) : (
|
||||
<div className="mt-2">
|
||||
<p className="text-sm text-green-700 font-semibold mb-1">
|
||||
Inklusiv-Bilder diesen Monat: {usedFlatrateImages} / {editorial.flatrateAssetLimit}
|
||||
{editorial.flatrateAssetLimit === null ? (
|
||||
<p className="text-sm text-emerald-700/80 dark:text-emerald-300/80 mt-2 font-medium">
|
||||
Unbegrenzte Downloads inklusive
|
||||
</p>
|
||||
<div className="w-full bg-green-200 rounded-full h-2.5">
|
||||
<div className="bg-green-600 h-2.5 rounded-full" style={{ width: `${Math.min(100, (usedFlatrateImages / editorial.flatrateAssetLimit) * 100)}%` }}></div>
|
||||
) : (
|
||||
<div className="mt-4">
|
||||
<div className="flex justify-between text-sm text-emerald-700 dark:text-emerald-300 font-medium mb-1.5">
|
||||
<span>Inklusiv-Bilder diesen Monat</span>
|
||||
<span>{usedFlatrateImages} / {editorial.flatrateAssetLimit}</span>
|
||||
</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>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
</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 ? (
|
||||
<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>
|
||||
) : (
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-left border-collapse">
|
||||
<thead>
|
||||
<tr className="border-b-2 border-gray-200">
|
||||
<th className="py-3 px-4 font-semibold text-gray-700">Rechnungsnummer</th>
|
||||
<th className="py-3 px-4 font-semibold text-gray-700">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-gray-700">Download</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{reports.map((report) => (
|
||||
<tr key={report.id} className="border-b border-gray-100 hover:bg-gray-50">
|
||||
<td className="py-4 px-4 font-medium">{report.invoiceNumber}</td>
|
||||
<td className="py-4 px-4 text-gray-600">
|
||||
{new Intl.DateTimeFormat("de-DE", { month: "long", year: "numeric" }).format(report.periodStartsAt)}
|
||||
</td>
|
||||
<td className="py-4 px-4 font-medium">
|
||||
{new Intl.NumberFormat("de-DE", { style: "currency", currency: "EUR" }).format(report.netTotalCents / 100)}
|
||||
</td>
|
||||
<td className="py-4 px-4">
|
||||
<Link
|
||||
href={`/api/editorials/reports/${report.id}/pdf`}
|
||||
target="_blank"
|
||||
className="inline-flex items-center gap-2 text-blue-600 hover:text-blue-800 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">
|
||||
<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" />
|
||||
</svg>
|
||||
PDF anzeigen
|
||||
</Link>
|
||||
</td>
|
||||
<Card>
|
||||
<div className="overflow-x-auto">
|
||||
<table className="w-full text-left text-sm">
|
||||
<thead className="bg-muted/50 border-b border-border">
|
||||
<tr>
|
||||
<th className="py-3 px-4 font-semibold">Rechnungsnummer</th>
|
||||
<th className="py-3 px-4 font-semibold">Zeitraum</th>
|
||||
<th className="py-3 px-4 font-semibold text-right">Betrag (Netto)</th>
|
||||
<th className="py-3 px-4 font-semibold text-center">Download</th>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</thead>
|
||||
<tbody>
|
||||
{reports.map((report, i) => (
|
||||
<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 text-muted-foreground">
|
||||
{new Intl.DateTimeFormat("de-DE", { month: "long", year: "numeric" }).format(report.periodStartsAt)}
|
||||
</td>
|
||||
<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)}
|
||||
</td>
|
||||
<td className="py-4 px-4 text-center">
|
||||
<Link
|
||||
href={`/api/editorials/reports/${report.id}/pdf`}
|
||||
target="_blank"
|
||||
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"
|
||||
>
|
||||
<FileText className="w-4 h-4" />
|
||||
<span>PDF</span>
|
||||
</Link>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</Card>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -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 (
|
||||
<section className="editorial-section" aria-labelledby="albums-title">
|
||||
<p className="editorial-kicker">Bildarchiv · Suche</p>
|
||||
<div className="editorial-title-row">
|
||||
<h1 id="albums-title">Suchergebnisse</h1>
|
||||
<div className="space-y-6 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500" aria-labelledby="albums-title">
|
||||
<div>
|
||||
<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" className="text-4xl font-bold tracking-tight">Suchergebnisse</h1>
|
||||
</div>
|
||||
<GlobalSearchForm query={query} format={format} jahr={jahr} />
|
||||
<PhotoContactSheet
|
||||
@@ -68,7 +70,7 @@ export default async function AlbumsPage({ searchParams }: { searchParams: Promi
|
||||
lightboxAssetIds={lightboxAssetIds}
|
||||
/>
|
||||
<GlobalSearchPagination page={results} query={query} />
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -79,19 +81,19 @@ export default async function AlbumsPage({ searchParams }: { searchParams: Promi
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="editorial-section" aria-labelledby="albums-title">
|
||||
<p className="editorial-kicker">Bildarchiv · Freigaben</p>
|
||||
<div className="editorial-title-row">
|
||||
<h1 id="albums-title">Ihre Alben</h1>
|
||||
<p>Wählen Sie ein Spiel oder eine Serie, um die freigegebenen Fotos zu durchsuchen.</p>
|
||||
<div className="space-y-8 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500" aria-labelledby="albums-title">
|
||||
<div>
|
||||
<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" className="text-4xl font-bold tracking-tight">Ihre Alben</h1>
|
||||
<p className="text-muted-foreground mt-2">Wählen Sie ein Spiel oder eine Serie, um die freigegebenen Fotos zu durchsuchen.</p>
|
||||
</div>
|
||||
<GlobalSearchForm query={query} format={format} jahr={jahr} />
|
||||
{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} />
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -100,30 +102,29 @@ function GlobalSearchForm({ query, format, jahr }: { query: string; format?: str
|
||||
const years = Array.from({ length: 10 }, (_, i) => currentYear - i);
|
||||
|
||||
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">
|
||||
<div className="flex-grow">
|
||||
<input
|
||||
<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 w-full sm:w-auto">
|
||||
<Input
|
||||
type="search"
|
||||
name="suche"
|
||||
defaultValue={query}
|
||||
placeholder="Alle Alben durchsuchen..."
|
||||
aria-label="Alle Alben durchsuchen"
|
||||
className="w-full"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex gap-4">
|
||||
<select name="format" defaultValue={format || ""} className="px-3 py-2 border border-gray-300 rounded-md">
|
||||
<div className="flex gap-3 w-full sm:w-auto">
|
||||
<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="quer">Querformat</option>
|
||||
<option value="hoch">Hochformat</option>
|
||||
</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>
|
||||
{years.map(y => (
|
||||
<option key={y} value={y.toString()}>{y}</option>
|
||||
))}
|
||||
</select>
|
||||
<button type="submit">Suchen</button>
|
||||
<Button type="submit" variant="default">Suchen</Button>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
@@ -135,12 +136,12 @@ function GlobalSearchPagination({ page, query }: { page: ImmichSearchPage; query
|
||||
}
|
||||
|
||||
return (
|
||||
<nav aria-label="Suchergebnisseiten" className="photo-pagination">
|
||||
{page.previousPage === null ? null : (
|
||||
<Link href={`/redaktion/alben?suche=${encodeURIComponent(query)}&page=${page.previousPage}`}>Vorherige Seite</Link>
|
||||
<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 ? <div /> : (
|
||||
<Link className="text-primary-600 hover:underline" href={`/redaktion/alben?suche=${encodeURIComponent(query)}&page=${page.previousPage}`}>Vorherige Seite</Link>
|
||||
)}
|
||||
{page.nextPage === null ? null : (
|
||||
<Link href={`/redaktion/alben?suche=${encodeURIComponent(query)}&page=${page.nextPage}`}>Nächste Seite</Link>
|
||||
{page.nextPage === null ? <div /> : (
|
||||
<Link className="text-primary-600 hover:underline" href={`/redaktion/alben?suche=${encodeURIComponent(query)}&page=${page.nextPage}`}>Nächste Seite</Link>
|
||||
)}
|
||||
</nav>
|
||||
);
|
||||
@@ -167,10 +168,14 @@ async function loadAlbums(editorialId: string) {
|
||||
|
||||
function ImmichUnavailable() {
|
||||
return (
|
||||
<section className="editorial-section editorial-state" aria-labelledby="albums-title">
|
||||
<p className="editorial-kicker">Bildarchiv</p>
|
||||
<h1 id="albums-title">Alben momentan nicht erreichbar</h1>
|
||||
<p role="status">Bitte laden Sie diese Seite in wenigen Minuten erneut. Ihre Freigaben bleiben unverändert.</p>
|
||||
</section>
|
||||
<div className="space-y-6 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500" aria-labelledby="albums-title">
|
||||
<div>
|
||||
<p className="text-sm font-semibold uppercase tracking-widest text-primary-600 dark:text-primary-500 mb-2">Bildarchiv</p>
|
||||
<h1 id="albums-title" className="text-4xl font-bold tracking-tight">Alben momentan nicht erreichbar</h1>
|
||||
</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
|
||||
const assets = items.length > 0
|
||||
? await immichClient.searchAssets({
|
||||
assetIds: items.map(i => i.assetId)
|
||||
})
|
||||
? await Promise.all(items.map(i => immichClient.getAsset(i.assetId).catch(() => null)))
|
||||
: [];
|
||||
|
||||
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 (
|
||||
<section className="editorial-section">
|
||||
<p className="editorial-kicker">Merkzettel</p>
|
||||
<h1>Dein Leuchtkasten</h1>
|
||||
<div className="space-y-8 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500">
|
||||
<div>
|
||||
<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 ? (
|
||||
<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">
|
||||
<p className="text-sm text-gray-600">
|
||||
<div className="flex justify-between items-center bg-card p-4 rounded-xl border border-border shadow-sm">
|
||||
<p className="text-sm font-medium text-muted-foreground">
|
||||
{items.length} {items.length === 1 ? 'Bild' : 'Bilder'} gemerkt
|
||||
</p>
|
||||
<DownloadLightboxForm assetIds={items.map(i => i.assetId)} />
|
||||
</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) => {
|
||||
const asset = assetMap.get(item.assetId);
|
||||
if (!asset) return null;
|
||||
|
||||
return (
|
||||
<li key={item.assetId} className="photo-contact-frame relative group">
|
||||
<Link href={`/redaktion/nutzungen/neu?assetId=${item.assetId}`} className="contact-sheet-link">
|
||||
<Image
|
||||
alt={asset.originalFileName}
|
||||
className="contact-sheet-image"
|
||||
height={200}
|
||||
src={`/api/assets/${encodeURIComponent(item.assetId)}/thumbnail`}
|
||||
width={300}
|
||||
/>
|
||||
<div className="contact-strip">
|
||||
<span className="contact-strip-name" title={asset.originalFileName}>
|
||||
{asset.originalFileName}
|
||||
<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="block">
|
||||
<div className="aspect-[3/2] w-full overflow-hidden bg-muted">
|
||||
<Image
|
||||
alt={asset.originalFileName ?? "Bild"}
|
||||
className="w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"
|
||||
height={200}
|
||||
src={`/api/assets/${encodeURIComponent(item.assetId)}/thumbnail`}
|
||||
width={300}
|
||||
/>
|
||||
</div>
|
||||
<div className="p-3 border-t border-border bg-card">
|
||||
<span className="block truncate text-xs font-medium text-muted-foreground" title={asset.originalFileName}>
|
||||
{asset.originalFileName ?? "Unbekannt"}
|
||||
</span>
|
||||
</div>
|
||||
</Link>
|
||||
@@ -66,6 +69,6 @@ export default async function LightboxPage() {
|
||||
</ul>
|
||||
</>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user