feat: complete UI design system refactoring and fix TS build errors

This commit is contained in:
Leon Tonhäuser committed 2026-08-11 03:38:34 +02:00
1 parent 0b1ffdfdfc
commit 8728308fc6
27 files changed
+847 -370

No files matched your search

+89 -67
View File
@@ -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", () => {
+34 -31
View File
@@ -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>
);
}