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>
|
||||
);
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
import { useState } from "react";
|
||||
|
||||
import { authClient } from "@/modules/auth/client";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
// Renders into the portal masthead. Better Auth's signOut clears the session
|
||||
// cookie server-side; we then hard-navigate to the login page so no stale
|
||||
@@ -20,8 +21,14 @@ export function LogoutButton() {
|
||||
}
|
||||
|
||||
return (
|
||||
<button className="portal-signout" disabled={pending} onClick={signOut} type="button">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
disabled={pending}
|
||||
onClick={signOut}
|
||||
type="button"
|
||||
>
|
||||
{pending ? "…" : "Abmelden"}
|
||||
</button>
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import Link from "next/link";
|
||||
|
||||
import { BrandLogo } from "@/components/brand/logo";
|
||||
import { LogoutButton } from "@/components/layout/logout-button";
|
||||
import { ThemeToggle } from "@/components/theme-toggle";
|
||||
|
||||
export type NavItem = { href: string; label: string };
|
||||
|
||||
@@ -27,24 +28,35 @@ export function PortalShell({
|
||||
children,
|
||||
}: Readonly<PortalShellProps>) {
|
||||
return (
|
||||
<div className="editorial-shell">
|
||||
<header className="portal-masthead">
|
||||
<Link aria-label={sectionLabel} className="portal-brand" href={brandHref}>
|
||||
<BrandLogo variant="white" />
|
||||
</Link>
|
||||
<div className="portal-masthead-meta">
|
||||
<span>{sectionLabel}</span>
|
||||
<nav aria-label={sectionLabel}>
|
||||
{nav.map((item) => (
|
||||
<Link key={item.href} href={item.href}>
|
||||
{item.label}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
<LogoutButton />
|
||||
<div className="min-h-screen bg-background flex flex-col">
|
||||
<header className="sticky top-0 z-50 w-full border-b border-border/40 bg-background/80 backdrop-blur-md transition-colors duration-300">
|
||||
<div className="flex h-16 items-center justify-between px-6 lg:px-12">
|
||||
<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>
|
||||
<div className="flex items-center gap-6 text-sm font-medium">
|
||||
<span className="hidden md:inline-block text-muted-foreground uppercase tracking-widest text-xs font-bold">{sectionLabel}</span>
|
||||
<nav aria-label={sectionLabel} className="hidden sm:flex items-center gap-6">
|
||||
{nav.map((item) => (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
className="transition-colors hover:text-primary-500 text-foreground"
|
||||
>
|
||||
{item.label}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
<div className="flex items-center gap-4">
|
||||
<ThemeToggle />
|
||||
<LogoutButton />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</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>
|
||||
);
|
||||
}
|
||||
@@ -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,
|
||||
query,
|
||||
showAlbumName = false,
|
||||
lightboxAssetIds,
|
||||
}: Readonly<{
|
||||
albumId?: string;
|
||||
albumName: string;
|
||||
|
||||
@@ -24,6 +24,7 @@ const validSelection = {
|
||||
usageIds: ["u1", "u2"],
|
||||
period,
|
||||
adminUserId: "a1",
|
||||
flatrateCentsSnapshot: null,
|
||||
};
|
||||
|
||||
const address: BillingReportAddress = {
|
||||
@@ -69,6 +70,10 @@ function createMockRepo() {
|
||||
return address;
|
||||
},
|
||||
|
||||
async getEditorialFlatrate() {
|
||||
return { flatrateActive: false, flatratePriceCents: null, flatrateAssetLimit: null };
|
||||
},
|
||||
|
||||
async getSelectedUsages(_editorialId, usageIds) {
|
||||
return usageIds.map((id) => selectedUsage(id, usageStatuses.get(id) as "open" | "reopened"));
|
||||
},
|
||||
@@ -233,6 +238,7 @@ test("previewReport returns PDF bytes without persisting or billing", async () =
|
||||
editorialId: validSelection.editorialId,
|
||||
usageIds: validSelection.usageIds,
|
||||
period: validSelection.period,
|
||||
flatrateCentsSnapshot: null,
|
||||
});
|
||||
|
||||
expect(bytes).toBeInstanceOf(Buffer);
|
||||
|
||||
@@ -55,6 +55,7 @@ export type ReportSelection = {
|
||||
editorialId: string;
|
||||
usageIds: string[];
|
||||
period: BillingPeriod;
|
||||
flatrateCentsSnapshot: number | null;
|
||||
};
|
||||
|
||||
export type FinalizeReportInput = ReportSelection & {
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
import { useState, useTransition } from "react";
|
||||
|
||||
import { archiveEditorialAction } from "@/app/admin/redaktionen/[id]/actions";
|
||||
import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Button } from "@/components/ui/button";
|
||||
|
||||
type DangerZoneProps = {
|
||||
editorialId: string;
|
||||
@@ -22,28 +25,36 @@ export function DangerZone({ editorialId, editorialName }: DangerZoneProps) {
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="danger-zone" aria-labelledby="danger-title">
|
||||
<h2 id="danger-title">Gefahrenzone</h2>
|
||||
<p>Alle Albumrechte werden widerrufen und der Login wird deaktiviert. Abrechnungsdaten bleiben erhalten.</p>
|
||||
<label>
|
||||
<span>Redaktionsname zur Bestätigung eingeben:</span>
|
||||
<input
|
||||
type="text"
|
||||
value={confirmText}
|
||||
onChange={(e) => setConfirmText(e.target.value)}
|
||||
placeholder={editorialName}
|
||||
className="danger-zone-input"
|
||||
disabled={isPending}
|
||||
/>
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
className="action-button action-button--danger"
|
||||
disabled={!isConfirmed || isPending}
|
||||
onClick={handleArchive}
|
||||
>
|
||||
{isPending ? "Wird archiviert…" : "Redaktion archivieren"}
|
||||
</button>
|
||||
</section>
|
||||
<Card className="border-destructive/50 bg-destructive/5 dark:bg-destructive/10">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-destructive">Gefahrenzone</CardTitle>
|
||||
<CardDescription>
|
||||
Alle Albumrechte werden widerrufen und der Login wird deaktiviert. Abrechnungsdaten bleiben erhalten.
|
||||
</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"
|
||||
value={confirmText}
|
||||
onChange={(e) => setConfirmText(e.target.value)}
|
||||
placeholder={editorialName}
|
||||
disabled={isPending}
|
||||
className="border-destructive/30 focus-visible:ring-destructive"
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
type="button"
|
||||
variant="destructive"
|
||||
disabled={!isConfirmed || isPending}
|
||||
onClick={handleArchive}
|
||||
>
|
||||
{isPending ? "Wird archiviert…" : "Redaktion archivieren"}
|
||||
</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,7 @@
|
||||
import Link from "next/link";
|
||||
import { Card, CardContent, CardHeader, CardTitle, CardDescription, CardFooter } from "@/components/ui/card";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { archiveEditorialAction, suspendEditorialAction, reactivateEditorialAction, updateFlatrateAction } from "@/app/admin/redaktionen/[id]/actions";
|
||||
import { DangerZone } from "./DangerZone";
|
||||
|
||||
@@ -21,121 +24,160 @@ export function EditorialDetailContent({
|
||||
hasActiveGrant,
|
||||
}: Readonly<{ editorial: EditorialDetail; hasActiveGrant: boolean }>) {
|
||||
return (
|
||||
<section className="content-section" aria-labelledby="editorial-title">
|
||||
<p className="eyebrow">Redaktion</p>
|
||||
<h1 id="editorial-title">{editorial.name}</h1>
|
||||
<div className="space-y-8 max-w-4xl 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</p>
|
||||
<h1 className="text-4xl font-bold tracking-tight">{editorial.name}</h1>
|
||||
</div>
|
||||
|
||||
{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.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
<dl>
|
||||
<dt>Ansprechperson</dt>
|
||||
<dd>{editorial.contactName}</dd>
|
||||
<dt>Anmelde-E-Mail</dt>
|
||||
<dd>{editorial.loginEmail}</dd>
|
||||
<dt>Status</dt>
|
||||
<dd>{editorial.status}</dd>
|
||||
<dt>E-Mail bestätigt</dt>
|
||||
<dd>{editorial.emailVerifiedAt ? "Ja" : "Nein"}</dd>
|
||||
<dt>Individueller Nettopreis</dt>
|
||||
<dd>
|
||||
{editorial.currentPriceCents === null
|
||||
? "Noch nicht festgelegt"
|
||||
: formatCents(editorial.currentPriceCents)}
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<section aria-labelledby="approval-title">
|
||||
<h2 id="approval-title">Freigabe</h2>
|
||||
<button type="button" disabled aria-describedby="approval-help">
|
||||
Redaktion freigeben
|
||||
</button>
|
||||
<p id="approval-help">
|
||||
{hasActiveGrant
|
||||
? "Mindestens ein Albumrecht ist zugewiesen. Die Freigabe bleibt bis zur weiteren Verwaltungsoberfläche deaktiviert."
|
||||
: "Eine Freigabe ist erst möglich, wenn mindestens ein aktives Albumrecht zugewiesen wurde."}
|
||||
</p>
|
||||
<Link href={`/admin/redaktionen/${editorial.id}/alben`}>Albumrechte verwalten</Link>
|
||||
{" · "}
|
||||
<Link href={`/admin/redaktionen/${editorial.id}/auto-regeln`}>Auto-Zuweisungsregeln</Link>
|
||||
</section>
|
||||
|
||||
{/* Flatrate Settings */}
|
||||
{!editorial.archivedAt && (
|
||||
<section aria-labelledby="flatrate-title" className="mt-8">
|
||||
<h2 id="flatrate-title">Flatrate-Einstellungen</h2>
|
||||
<form action={updateFlatrateAction.bind(null, editorial.id)} className="space-y-4 max-w-lg mt-4">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Stammdaten</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<dl className="grid grid-cols-1 sm:grid-cols-2 gap-x-8 gap-y-4">
|
||||
<div>
|
||||
<label className="flex items-center gap-2 font-semibold">
|
||||
<input type="checkbox" name="flatrateActive" defaultChecked={editorial.flatrateActive} />
|
||||
Flatrate aktivieren
|
||||
</label>
|
||||
<p className="text-sm text-gray-500 mt-1">Wenn aktiviert, werden Downloads nach einem Pauschalpreis abgerechnet.</p>
|
||||
<dt className="text-sm font-medium text-muted-foreground">Ansprechperson</dt>
|
||||
<dd className="mt-1 font-medium">{editorial.contactName}</dd>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-4">
|
||||
<div className="flex-1">
|
||||
<label className="block font-semibold mb-1" htmlFor="flatratePriceEuros">Flatrate-Preis (Netto €)</label>
|
||||
<input
|
||||
type="number"
|
||||
id="flatratePriceEuros"
|
||||
name="flatratePriceEuros"
|
||||
step="0.01"
|
||||
min="0"
|
||||
className="border p-2 rounded w-full"
|
||||
defaultValue={editorial.flatratePriceCents ? (editorial.flatratePriceCents / 100).toFixed(2) : ""}
|
||||
/>
|
||||
</div>
|
||||
<div className="flex-1">
|
||||
<label className="block font-semibold mb-1" htmlFor="flatrateAssetLimit">Bild-Limit (pro Monat)</label>
|
||||
<input
|
||||
type="number"
|
||||
id="flatrateAssetLimit"
|
||||
name="flatrateAssetLimit"
|
||||
min="1"
|
||||
placeholder="Unbegrenzt"
|
||||
className="border p-2 rounded w-full"
|
||||
defaultValue={editorial.flatrateAssetLimit ?? ""}
|
||||
/>
|
||||
<p className="text-xs text-gray-500 mt-1">Leer lassen für unbegrenzte Flatrate.</p>
|
||||
</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>
|
||||
|
||||
<button type="submit" className="px-4 py-2 bg-black text-white font-semibold rounded hover:bg-gray-800 transition">
|
||||
Speichern
|
||||
</button>
|
||||
</form>
|
||||
</section>
|
||||
)}
|
||||
<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
|
||||
? "Noch nicht festgelegt"
|
||||
: formatCents(editorial.currentPriceCents)}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Freigabe & Rechte</CardTitle>
|
||||
<CardDescription>
|
||||
{hasActiveGrant
|
||||
? "Mindestens ein Albumrecht ist zugewiesen. Die Freigabe bleibt bis zur weiteren Verwaltungsoberfläche deaktiviert."
|
||||
: "Eine Freigabe ist erst möglich, wenn mindestens ein aktives Albumrecht zugewiesen wurde."}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent className="flex flex-col sm:flex-row gap-4 items-start sm:items-center">
|
||||
<Button disabled variant="outline">
|
||||
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>
|
||||
|
||||
{/* Status Actions */}
|
||||
{!editorial.archivedAt && (
|
||||
<section aria-labelledby="status-actions-title">
|
||||
<h2 id="status-actions-title">Status-Aktionen</h2>
|
||||
{editorial.status === 'active' && (
|
||||
<form action={suspendEditorialAction.bind(null, editorial.id)}>
|
||||
<button type="submit" className="action-button action-button--warning">
|
||||
Zugang sperren
|
||||
</button>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Flatrate-Einstellungen</CardTitle>
|
||||
<CardDescription>Pauschalpreis für Downloads aktivieren.</CardDescription>
|
||||
</CardHeader>
|
||||
<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
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium" htmlFor="flatratePriceEuros">Flatrate-Preis (Netto €)</label>
|
||||
<Input
|
||||
type="number"
|
||||
id="flatratePriceEuros"
|
||||
name="flatratePriceEuros"
|
||||
step="0.01"
|
||||
min="0"
|
||||
defaultValue={editorial.flatratePriceCents ? (editorial.flatratePriceCents / 100).toFixed(2) : ""}
|
||||
/>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label className="text-sm font-medium" htmlFor="flatrateAssetLimit">Bild-Limit (pro Monat)</label>
|
||||
<Input
|
||||
type="number"
|
||||
id="flatrateAssetLimit"
|
||||
name="flatrateAssetLimit"
|
||||
min="1"
|
||||
placeholder="Unbegrenzt"
|
||||
defaultValue={editorial.flatrateAssetLimit ?? ""}
|
||||
/>
|
||||
<p className="text-xs text-muted-foreground">Leer lassen für unbegrenzte Flatrate.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button type="submit">
|
||||
Speichern
|
||||
</Button>
|
||||
</form>
|
||||
)}
|
||||
{editorial.status === 'suspended' && (
|
||||
<form action={reactivateEditorialAction.bind(null, editorial.id)}>
|
||||
<button type="submit" className="action-button">
|
||||
Zugang reaktivieren
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
</section>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{!editorial.archivedAt && (
|
||||
<Card className="border-border">
|
||||
<CardHeader>
|
||||
<CardTitle>Status-Aktionen</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{editorial.status === 'active' && (
|
||||
<form action={suspendEditorialAction.bind(null, editorial.id)}>
|
||||
<Button type="submit" variant="destructive">
|
||||
Zugang sperren
|
||||
</Button>
|
||||
</form>
|
||||
)}
|
||||
{editorial.status === 'suspended' && (
|
||||
<form action={reactivateEditorialAction.bind(null, editorial.id)}>
|
||||
<Button type="submit" variant="secondary">
|
||||
Zugang reaktivieren
|
||||
</Button>
|
||||
</form>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
{/* Danger Zone */}
|
||||
{!editorial.archivedAt && (
|
||||
<DangerZone editorialId={editorial.id} editorialName={editorial.name} />
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,10 @@ export type ImmichAsset = {
|
||||
originalMimeType: string;
|
||||
localDateTime: string | null;
|
||||
fileCreatedAt: string | null;
|
||||
exifInfo?: {
|
||||
exifImageWidth?: number | null;
|
||||
exifImageHeight?: number | null;
|
||||
} | null;
|
||||
albums: Array<{ id: string }>;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@ import { and, eq } from "drizzle-orm";
|
||||
import { db } from "@/db/client";
|
||||
import { lightboxItems } from "@/db/schema";
|
||||
import { immichClient } from "@/modules/immich/client";
|
||||
import type { PhotoAsset } from "@/modules/immich/types";
|
||||
import type { ImmichAsset } from "@/modules/immich/types";
|
||||
|
||||
export type LightboxItem = {
|
||||
assetId: string;
|
||||
addedAt: Date;
|
||||
asset?: PhotoAsset; // populated if joined
|
||||
asset?: ImmichAsset; // populated if joined
|
||||
};
|
||||
|
||||
export const lightboxService = {
|
||||
|
||||
Reference in new issue
Block a user