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

+88 -68
View File
@@ -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>
);
}