Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fdd5cd4573 | ||
|
|
9c7b3e69ad | ||
|
|
5482616f3d | ||
|
|
45337cd0dc | ||
|
|
2540b907b8 | ||
|
|
a9a1ae6d80 | ||
|
|
bff48467e0 | ||
|
|
1391b9fea4 | ||
|
|
fb4f7d741b | ||
|
|
8418751ec8 |
No files matched your search
@@ -45,3 +45,6 @@ next-env.d.ts
|
||||
.env.local
|
||||
!.env.example
|
||||
*.log
|
||||
|
||||
# Build-Artefakte
|
||||
dist/
|
||||
+2
-2
@@ -12,7 +12,7 @@ metadata:
|
||||
title: Courier
|
||||
description: Transaktionsmail für deine Apps über Amazon SES.
|
||||
icon: https://git.aimighty.olares.de/aimighty/courier/raw/branch/main/icon.png
|
||||
version: 26.11.1
|
||||
version: 26.11.10
|
||||
categories:
|
||||
- Applications
|
||||
|
||||
@@ -106,7 +106,7 @@ envs:
|
||||
default: "1000"
|
||||
|
||||
spec:
|
||||
versionName: '26.11.1'
|
||||
versionName: '26.11.10'
|
||||
fullDescription: |
|
||||
**Courier** ist ein kleiner Versanddienst für transaktionale E-Mails:
|
||||
eine Resend-kompatible HTTP-API, Warteschlange, Retry, Logs und
|
||||
|
||||
@@ -26,8 +26,12 @@ Ohne `MAIL_TRANSPORT=ses` landet jede Mail nur im Log (`dry-run`).
|
||||
|
||||
## API
|
||||
|
||||
Deployed: `https://ef0124d4.kaivostudio.olares.de/api` (App-ID-Adresse der
|
||||
Box). Ein stabiler Name (`courier.hubsport.club`) braucht noch einen
|
||||
DNS-/Tunnel-Eintrag.
|
||||
|
||||
```bash
|
||||
curl -X POST http://127.0.0.1:3400/api/emails \
|
||||
curl -X POST https://ef0124d4.kaivostudio.olares.de/api/emails/ \
|
||||
-H "Authorization: Bearer ck_live_…" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
@@ -49,10 +53,20 @@ Fehler kommen im Resend-Format (`statusCode`, `name`, `message`).
|
||||
npm run ses:records
|
||||
```
|
||||
|
||||
Gibt die Cloudflare-Records für DKIM, MAIL FROM und DMARC aus. Danach im
|
||||
AWS-Console den Production Access beantragen (SES → Account dashboard).
|
||||
Gibt die Cloudflare-Records für DKIM, MAIL FROM und DMARC aus. Mit einem
|
||||
Token (Zone → DNS → Edit) setzt `CLOUDFLARE_API_TOKEN=… npm run ses:dns` sie
|
||||
automatisch. Danach im AWS-Console den Production Access beantragen
|
||||
(SES → Account dashboard).
|
||||
Zustellereignisse kommen per SNS auf `/api/webhooks/ses?token=…`.
|
||||
|
||||
## Resend-SDK
|
||||
|
||||
```bash
|
||||
COURIER_KEY=ck_live_… \
|
||||
COURIER_BASE_URL=https://ef0124d4.kaivostudio.olares.de/api \
|
||||
npm run test:resend
|
||||
```
|
||||
|
||||
## Olares
|
||||
|
||||
Chart unter `olares/`. Werte für AWS und SNS kommen aus `.secrets.md` in
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
import { usePathname } from "next/navigation";
|
||||
import {
|
||||
Ban,
|
||||
BarChart3,
|
||||
BookOpen,
|
||||
Globe,
|
||||
KeyRound,
|
||||
LayoutDashboard,
|
||||
Mail,
|
||||
type LucideIcon,
|
||||
} from "lucide-react";
|
||||
|
||||
type Item = { href: string; label: string; icon: LucideIcon };
|
||||
|
||||
const groups: { title: string; items: Item[] }[] = [
|
||||
{
|
||||
title: "Senden",
|
||||
items: [
|
||||
{ href: "/", label: "Übersicht", icon: LayoutDashboard },
|
||||
{ href: "/messages", label: "Nachrichten", icon: Mail },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Konfiguration",
|
||||
items: [
|
||||
{ href: "/domains", label: "Domains", icon: Globe },
|
||||
{ href: "/keys", label: "API-Keys", icon: KeyRound },
|
||||
{ href: "/suppressions", label: "Suppressions", icon: Ban },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: "Betrieb",
|
||||
items: [
|
||||
{ href: "/metrics", label: "Metriken", icon: BarChart3 },
|
||||
{ href: "/docs", label: "Dokumentation", icon: BookOpen },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
function isActive(pathname: string, href: string) {
|
||||
if (href === "/") return pathname === "/";
|
||||
return pathname === href || pathname.startsWith(`${href}/`);
|
||||
}
|
||||
|
||||
export function AppNav({ variant = "sidebar" }: { variant?: "sidebar" | "mobile" }) {
|
||||
const pathname = usePathname().replace(/^\/__preview\/\d+/, "") || "/";
|
||||
|
||||
return (
|
||||
<nav
|
||||
className={variant === "sidebar" ? "app-nav app-nav--sidebar" : "app-nav app-nav--mobile"}
|
||||
aria-label="Hauptnavigation"
|
||||
>
|
||||
{groups.map((group) => (
|
||||
<div className="app-nav__group" key={group.title}>
|
||||
{variant === "sidebar" ? <p className="app-nav__title">{group.title}</p> : null}
|
||||
{group.items.map((item) => {
|
||||
const Icon = item.icon;
|
||||
return (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
className="app-nav__link"
|
||||
aria-current={isActive(pathname, item.href) ? "page" : undefined}
|
||||
>
|
||||
<Icon className="app-nav__icon" aria-hidden="true" />
|
||||
<span>{item.label}</span>
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
))}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
export function CopyButton({ value, label = "Kopieren" }: { value: string; label?: string }) {
|
||||
const [copied, setCopied] = useState(false);
|
||||
|
||||
async function copy() {
|
||||
try {
|
||||
await navigator.clipboard.writeText(value);
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
} catch {
|
||||
setCopied(false);
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<button type="button" className="ds-button ds-button--secondary ds-button--sm" onClick={copy}>
|
||||
{copied ? "Kopiert" : label}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import { PageHeader } from "@/app/page-header";
|
||||
|
||||
export const metadata = { title: "Courier – Dokumentation" };
|
||||
|
||||
export default function Docs() {
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Dokumentation"
|
||||
lead="Die Courier-API ist weitgehend Resend-kompatibel. Basis-URL: /api"
|
||||
code={false}
|
||||
eyebrow="Courier"
|
||||
/>
|
||||
|
||||
<section className="ds-card app-panel">
|
||||
<h2>Authentifizierung</h2>
|
||||
<p className="app-muted">
|
||||
Jede Anfrage braucht einen API-Key als Bearer-Token. Der Key gilt nur für seine
|
||||
Absenderdomain.
|
||||
</p>
|
||||
<pre className="app-code">{`Authorization: Bearer ck_live_…`}</pre>
|
||||
</section>
|
||||
|
||||
<section className="ds-card app-panel app-section">
|
||||
<h2>Mail senden</h2>
|
||||
<pre className="app-code">{`curl -X POST https://<courier-adresse>/api/emails/ \\
|
||||
-H "Authorization: Bearer ck_live_…" \\
|
||||
-H "Content-Type: application/json" \\
|
||||
-d '{
|
||||
"from": "plan <plan@hubsport.club>",
|
||||
"to": "kunde@example.com",
|
||||
"subject": "Dein Anmeldelink",
|
||||
"html": "<p>Hallo</p>",
|
||||
"text": "Hallo"
|
||||
}'`}</pre>
|
||||
<p className="app-muted">
|
||||
Unterstützt <code>from</code>, <code>to</code>, <code>cc</code>, <code>bcc</code>,{" "}
|
||||
<code>reply_to</code>, <code>subject</code>, <code>html</code>, <code>text</code>,{" "}
|
||||
<code>headers</code>, <code>attachments</code> und <code>tags</code>.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section className="ds-card app-panel app-section">
|
||||
<h2>Resend-SDK</h2>
|
||||
<pre className="app-code">{`import { Resend } from "resend";
|
||||
|
||||
const resend = new Resend(process.env.COURIER_API_KEY, {
|
||||
baseUrl: "https://<courier-adresse>/api",
|
||||
});
|
||||
|
||||
await resend.emails.send({
|
||||
from: "plan <plan@hubsport.club>",
|
||||
to: "kunde@example.com",
|
||||
subject: "Test",
|
||||
html: "<p>Hallo</p>",
|
||||
});`}</pre>
|
||||
</section>
|
||||
|
||||
<section className="ds-card app-panel app-section">
|
||||
<h2>Batch und Status</h2>
|
||||
<pre className="app-code">{`POST /api/emails/batch // bis zu 100 Mails
|
||||
GET /api/emails/:id // Status einer Mail
|
||||
GET /api/health // Health-Check`}</pre>
|
||||
<p className="app-muted">
|
||||
Ein <code>Idempotency-Key</code>-Header verhindert doppelte Sendungen.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section className="ds-card app-panel app-section">
|
||||
<h2>Fehler</h2>
|
||||
<pre className="app-code">{`{ "statusCode": 422, "name": "validation_error", "message": "…" }
|
||||
{ "statusCode": 429, "name": "rate_limit_exceeded", "message": "…" }
|
||||
{ "statusCode": 422, "name": "recipient_suppressed", "message": "…" }`}</pre>
|
||||
<p className="app-muted">
|
||||
Gesperrte Empfänger stehen unter <a href="/suppressions">Suppressions</a>. Domains und
|
||||
Keys werden unter <a href="/domains">Domains</a> und <a href="/keys">API-Keys</a> gepflegt.
|
||||
</p>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
import Link from "next/link";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
import { CopyButton } from "@/app/copy-button";
|
||||
import { PageHeader } from "@/app/page-header";
|
||||
import { config } from "@/lib/config";
|
||||
import { datum } from "@/lib/format";
|
||||
import { getDomainRow, sesAccountStatus, verifyDomain } from "@/lib/ses-admin";
|
||||
|
||||
import { verifyDomainAction } from "../actions";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
function statusBadge(status: string) {
|
||||
if (status === "verified") return <span className="ds-badge ds-badge--success">Verifiziert</span>;
|
||||
if (status === "failed") return <span className="ds-badge ds-badge--danger">Fehler</span>;
|
||||
return <span className="ds-badge ds-badge--warning">Ausstehend</span>;
|
||||
}
|
||||
|
||||
export default async function DomainDetail({ params }: { params: Promise<{ domain: string }> }) {
|
||||
const raw = (await params).domain;
|
||||
let domain = raw;
|
||||
try {
|
||||
domain = decodeURIComponent(raw);
|
||||
} catch {
|
||||
// Der Parameter ist bereits dekodiert.
|
||||
}
|
||||
|
||||
if (!domain.includes(".")) notFound();
|
||||
let row = await getDomainRow(domain);
|
||||
if (!row) {
|
||||
row = await verifyDomain(domain);
|
||||
}
|
||||
if (!row) notFound();
|
||||
|
||||
const ses = await sesAccountStatus();
|
||||
const mailFrom = row.mail_from_domain || `bounce.${domain}`;
|
||||
const dkim = row.dkim_tokens ?? [];
|
||||
|
||||
return (
|
||||
<>
|
||||
<p>
|
||||
<Link href="/domains">← Domains</Link>
|
||||
</p>
|
||||
<PageHeader
|
||||
eyebrow="Domain"
|
||||
title={row.domain}
|
||||
lead={row.status === "verified" ? "Die Domain ist bei SES verifiziert und kann senden." : "Die DNS-Records unten müssen noch gesetzt und geprüft werden."}
|
||||
code={false}
|
||||
actions={
|
||||
<>
|
||||
{statusBadge(row.status)}
|
||||
<form action={verifyDomainAction}>
|
||||
<input type="hidden" name="domain" value={row.domain} />
|
||||
<button className="ds-button ds-button--secondary ds-button--sm" type="submit">
|
||||
Status prüfen
|
||||
</button>
|
||||
</form>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
{!ses.production ? (
|
||||
<div className="ds-alert ds-alert--warning">
|
||||
<div>
|
||||
<p className="ds-alert__title">SES Production Access fehlt</p>
|
||||
<p className="ds-alert__text">
|
||||
Die Domain kann verifiziert sein, aber beliebige Empfänger erst nach der AWS-Freigabe.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<section className="ds-card app-panel">
|
||||
<div className="app-panel__head">
|
||||
<h2>Status</h2>
|
||||
</div>
|
||||
<dl className="app-dl">
|
||||
<dt>SES-Status</dt>
|
||||
<dd>{statusBadge(row.status)}</dd>
|
||||
<dt>DKIM</dt>
|
||||
<dd>{dkim.length ? `${dkim.length} Tokens` : "Noch keine Tokens"}</dd>
|
||||
<dt>MAIL FROM</dt>
|
||||
<dd className="app-mono">
|
||||
{row.mail_from_domain || "–"} {row.mail_from_status ? `(${row.mail_from_status})` : ""}
|
||||
</dd>
|
||||
<dt>Zuletzt geprüft</dt>
|
||||
<dd className="app-mono">{datum(row.last_checked_at)}</dd>
|
||||
</dl>
|
||||
</section>
|
||||
|
||||
<section className="ds-card app-panel app-section">
|
||||
<div className="app-panel__head">
|
||||
<h2>DNS-Records</h2>
|
||||
</div>
|
||||
<p className="app-muted">
|
||||
Bei Cloudflare als <strong>DNS only</strong> eintragen. Die Namen sind relativ zu{" "}
|
||||
<code className="app-mono">{row.domain}</code>.
|
||||
</p>
|
||||
|
||||
<div className="app-code-list">
|
||||
{dkim.map((token) => {
|
||||
const name = `${token}._domainkey.${row.domain}`;
|
||||
const value = `${token}.dkim.amazonses.com`;
|
||||
return (
|
||||
<div className="app-code-row" key={token}>
|
||||
<span className="ds-badge">CNAME</span>
|
||||
<code className="app-mono">{name}</code>
|
||||
<code className="app-mono">{value}</code>
|
||||
<CopyButton value={value} label="Kopieren" />
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
<div className="app-code-row">
|
||||
<span className="ds-badge">MX 10</span>
|
||||
<code className="app-mono">{mailFrom}</code>
|
||||
<code className="app-mono">feedback-smtp.{config.awsRegion}.amazonses.com</code>
|
||||
<CopyButton value={`feedback-smtp.${config.awsRegion}.amazonses.com`} label="Kopieren" />
|
||||
</div>
|
||||
|
||||
<div className="app-code-row">
|
||||
<span className="ds-badge">TXT</span>
|
||||
<code className="app-mono">{mailFrom}</code>
|
||||
<code className="app-mono">v=spf1 include:amazonses.com ~all</code>
|
||||
<CopyButton value="v=spf1 include:amazonses.com ~all" label="Kopieren" />
|
||||
</div>
|
||||
|
||||
<div className="app-code-row">
|
||||
<span className="ds-badge">TXT</span>
|
||||
<code className="app-mono">_dmarc.{row.domain}</code>
|
||||
<code className="app-mono">v=DMARC1; p=none;</code>
|
||||
<CopyButton value="v=DMARC1; p=none;" label="Kopieren" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!dkim.length ? (
|
||||
<div className="ds-alert ds-alert--warning">
|
||||
<div>
|
||||
<p className="ds-alert__title">Noch keine DKIM-Tokens</p>
|
||||
<p className="ds-alert__text">
|
||||
Klicke oben auf „Status prüfen“, um die Identity erneut von SES zu laden.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</section>
|
||||
|
||||
<section className="ds-card app-panel app-section">
|
||||
<div className="app-panel__head">
|
||||
<h2>API-Key für diese Domain</h2>
|
||||
</div>
|
||||
<p className="app-muted">
|
||||
Lege unter <Link href="/keys">API-Keys</Link> einen Key mit genau dieser Domain an. Der
|
||||
Key darf dann nur Absender aus <code className="app-mono">{row.domain}</code> verwenden.
|
||||
</p>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
"use server";
|
||||
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { createDomainIdentity, normalizeDomain, validDomain, verifyDomain } from "@/lib/ses-admin";
|
||||
|
||||
export async function createDomainAction(formData: FormData) {
|
||||
const input = String(formData.get("domain") ?? "");
|
||||
const domain = normalizeDomain(input);
|
||||
if (!validDomain(domain)) {
|
||||
redirect(`/domains/new?error=${encodeURIComponent("Ungültige Domain")}`);
|
||||
}
|
||||
try {
|
||||
await createDomainIdentity(domain);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : "Domain konnte nicht angelegt werden";
|
||||
redirect(`/domains/new?error=${encodeURIComponent(message)}`);
|
||||
}
|
||||
revalidatePath("/domains");
|
||||
redirect(`/domains/${encodeURIComponent(domain)}`);
|
||||
}
|
||||
|
||||
export async function verifyDomainAction(formData: FormData) {
|
||||
const domain = normalizeDomain(String(formData.get("domain") ?? ""));
|
||||
if (domain) await verifyDomain(domain);
|
||||
revalidatePath("/domains");
|
||||
revalidatePath(`/domains/${encodeURIComponent(domain)}`);
|
||||
redirect(`/domains/${encodeURIComponent(domain)}`);
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
import { PageHeader } from "@/app/page-header";
|
||||
|
||||
import { createDomainAction } from "../actions";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function NewDomain({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ error?: string }>;
|
||||
}) {
|
||||
const { error } = await searchParams;
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Domain hinzufügen"
|
||||
lead="Courier legt die SES-Identity an und zeigt danach die DNS-Records zum Kopieren."
|
||||
code={false}
|
||||
/>
|
||||
|
||||
{error ? (
|
||||
<div className="ds-alert ds-alert--danger" role="alert">
|
||||
<div>
|
||||
<p className="ds-alert__title">Domain nicht angelegt</p>
|
||||
<p className="ds-alert__text">{error}</p>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<section className="ds-card app-panel">
|
||||
<form action={createDomainAction} className="ds-stack app-form">
|
||||
<div className="ds-field">
|
||||
<label className="ds-field__label" htmlFor="domain">
|
||||
Domain
|
||||
</label>
|
||||
<input
|
||||
className="ds-input"
|
||||
id="domain"
|
||||
name="domain"
|
||||
required
|
||||
placeholder="send.aimighty.de"
|
||||
autoComplete="off"
|
||||
spellCheck={false}
|
||||
aria-describedby="domain-hint"
|
||||
/>
|
||||
<span className="ds-field__hint" id="domain-hint">
|
||||
Wenn die Hauptdomain bereits Mail nutzt (z. B. One.com), nimm eine Subdomain wie{" "}
|
||||
<code>send.aimighty.de</code>. Die DNS-Records erscheinen nach dem Anlegen.
|
||||
</span>
|
||||
</div>
|
||||
<div className="app-actions">
|
||||
<button className="ds-button ds-button--lg" type="submit">
|
||||
Domain anlegen
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
import Link from "next/link";
|
||||
import { ChevronRight, Globe } from "lucide-react";
|
||||
|
||||
import { EmptyState } from "@/app/empty-state";
|
||||
import { PageHeader } from "@/app/page-header";
|
||||
import { datum, relativ } from "@/lib/format";
|
||||
import { listDomainRows, sesAccountStatus, syncDomains } from "@/lib/ses-admin";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
function statusBadge(status: string) {
|
||||
if (status === "verified") return <span className="ds-badge ds-badge--success">Verifiziert</span>;
|
||||
if (status === "failed") return <span className="ds-badge ds-badge--danger">Fehler</span>;
|
||||
return <span className="ds-badge ds-badge--warning">Ausstehend</span>;
|
||||
}
|
||||
|
||||
export default async function Domains() {
|
||||
let rows: Awaited<ReturnType<typeof listDomainRows>> = [];
|
||||
let ses = { production: false, max24h: 0, rate: 0 };
|
||||
let error = "";
|
||||
try {
|
||||
ses = await sesAccountStatus();
|
||||
rows = await syncDomains();
|
||||
} catch (cause) {
|
||||
error = cause instanceof Error ? cause.message : "Domains nicht erreichbar";
|
||||
try {
|
||||
rows = await listDomainRows();
|
||||
} catch {
|
||||
// Die Seite zeigt den Fehler unten.
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Domains"
|
||||
lead="Verifizierte SES-Identities für den Versand. Jeder API-Key darf nur aus seiner Domain senden."
|
||||
actions={
|
||||
<Link className="ds-button ds-button--sm" href="/domains/new">
|
||||
Domain hinzufügen
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
|
||||
{error ? (
|
||||
<div className="ds-alert ds-alert--danger" role="alert">
|
||||
<div>
|
||||
<p className="ds-alert__title">Domains konnten nicht synchronisiert werden</p>
|
||||
<p className="ds-alert__text">{error}</p>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="app-grid app-grid--sidebar">
|
||||
{rows.length ? (
|
||||
<section className="ds-card app-panel" aria-labelledby="domain-list">
|
||||
<div className="app-panel__head">
|
||||
<h2 id="domain-list">Domains</h2>
|
||||
</div>
|
||||
<div className="app-domain-list">
|
||||
{rows.map((row) => (
|
||||
<Link
|
||||
key={row.domain}
|
||||
className="app-domain-row"
|
||||
href={`/domains/${encodeURIComponent(row.domain)}`}
|
||||
>
|
||||
<span className="app-domain-row__icon" aria-hidden="true">
|
||||
<Globe />
|
||||
</span>
|
||||
<span className="app-domain-row__main">
|
||||
<span className="app-domain-row__name">{row.domain}</span>
|
||||
<span className="app-domain-row__meta">
|
||||
<span>
|
||||
{row.dkim_tokens?.length
|
||||
? `${row.dkim_tokens.length} DKIM-Tokens`
|
||||
: "keine DKIM-Tokens"}
|
||||
</span>
|
||||
<span className="app-mono">{row.mail_from_domain || "kein MAIL FROM"}</span>
|
||||
<span title={datum(row.last_checked_at)}>
|
||||
geprüft {row.last_checked_at ? relativ(row.last_checked_at) : "–"}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
<span className="app-domain-row__side">
|
||||
{statusBadge(row.status)}
|
||||
<ChevronRight className="app-domain-row__chevron" aria-hidden="true" />
|
||||
</span>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
) : (
|
||||
<EmptyState
|
||||
icon={Globe}
|
||||
title="Noch keine Domains"
|
||||
text="Füge eine Domain hinzu, verifiziere sie mit den angezeigten DNS-Records und lege danach einen API-Key an."
|
||||
action={
|
||||
<Link className="ds-button ds-button--sm" href="/domains/new">
|
||||
Domain hinzufügen
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
<aside className="ds-card app-panel" aria-labelledby="ses-konto">
|
||||
<div className="app-panel__head">
|
||||
<h2 id="ses-konto">SES-Konto</h2>
|
||||
{ses.production ? (
|
||||
<span className="ds-badge ds-badge--success">Production</span>
|
||||
) : (
|
||||
<span className="ds-badge ds-badge--warning">Sandbox</span>
|
||||
)}
|
||||
</div>
|
||||
<dl className="app-dl">
|
||||
<dt>Tagesquote</dt>
|
||||
<dd>{Math.round(ses.max24h)} Mails</dd>
|
||||
<dt>Rate</dt>
|
||||
<dd>{ses.rate}/s</dd>
|
||||
<dt>Region</dt>
|
||||
<dd className="app-mono">eu-west-1</dd>
|
||||
</dl>
|
||||
|
||||
{!ses.production ? (
|
||||
<div className="ds-alert ds-alert--warning">
|
||||
<div>
|
||||
<p className="ds-alert__title">Sandbox aktiv</p>
|
||||
<p className="ds-alert__text">
|
||||
Für 500/Tag braucht das AWS-Konto Production Access. Bis dahin nur verifizierte
|
||||
Empfänger.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<h2 className="app-section">So funktioniert's</h2>
|
||||
<ol className="app-steps">
|
||||
<li>Domain anlegen und die DNS-Records setzen.</li>
|
||||
<li>Status prüfen, bis DKIM und SES „Verifiziert“ melden.</li>
|
||||
<li>API-Key mit dieser Domain erzeugen.</li>
|
||||
</ol>
|
||||
</aside>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import type { LucideIcon } from "lucide-react";
|
||||
|
||||
export function EmptyState({
|
||||
icon: Icon,
|
||||
title,
|
||||
text,
|
||||
action,
|
||||
}: {
|
||||
icon: LucideIcon;
|
||||
title: string;
|
||||
text: string;
|
||||
action?: React.ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<div className="app-empty">
|
||||
<span className="app-empty__icon" aria-hidden="true">
|
||||
<Icon />
|
||||
</span>
|
||||
<p className="app-empty__title">{title}</p>
|
||||
<p className="app-empty__text">{text}</p>
|
||||
{action ? <div className="app-actions">{action}</div> : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+994
-262
File diff suppressed because it is too large.
Load diff
+109
-28
@@ -2,53 +2,134 @@
|
||||
|
||||
import { useActionState } from "react";
|
||||
|
||||
import { CopyButton } from "@/app/copy-button";
|
||||
|
||||
import { createKey, type KeyState } from "./actions";
|
||||
|
||||
export function KeyForm() {
|
||||
export function KeyForm({ domains }: { domains: string[] }) {
|
||||
const [state, action, pending] = useActionState<KeyState, FormData>(createKey, {});
|
||||
|
||||
return (
|
||||
<>
|
||||
<form action={action} className="formular">
|
||||
<div className="feld">
|
||||
<label htmlFor="app">App</label>
|
||||
<input id="app" name="app" required placeholder="plan" autoComplete="off" />
|
||||
<span className="hinweis">Technischer Name, z. B. plan, lunch oder places.</span>
|
||||
<form action={action} className="ds-stack app-form">
|
||||
<div className="ds-field">
|
||||
<label className="ds-field__label" htmlFor="app">
|
||||
App
|
||||
</label>
|
||||
<input
|
||||
className="ds-input"
|
||||
id="app"
|
||||
name="app"
|
||||
required
|
||||
placeholder="plan"
|
||||
autoComplete="off"
|
||||
spellCheck={false}
|
||||
aria-describedby="app-hint"
|
||||
/>
|
||||
<span className="ds-field__hint" id="app-hint">
|
||||
Technischer Name, z. B. plan, lunch oder places.
|
||||
</span>
|
||||
</div>
|
||||
<div className="feld">
|
||||
<label htmlFor="name">Bezeichnung</label>
|
||||
<input id="name" name="name" required placeholder="Plan" autoComplete="off" />
|
||||
|
||||
<div className="ds-field">
|
||||
<label className="ds-field__label" htmlFor="name">
|
||||
Bezeichnung
|
||||
</label>
|
||||
<input
|
||||
className="ds-input"
|
||||
id="name"
|
||||
name="name"
|
||||
required
|
||||
placeholder="Plan"
|
||||
autoComplete="off"
|
||||
/>
|
||||
</div>
|
||||
<div className="feld">
|
||||
<label htmlFor="domain">Absenderdomain</label>
|
||||
<input id="domain" name="domain" defaultValue="hubsport.club" required autoComplete="off" />
|
||||
|
||||
<div className="ds-field">
|
||||
<label className="ds-field__label" htmlFor="domain">
|
||||
Absenderdomain
|
||||
</label>
|
||||
<select className="ds-select" id="domain" name="domain" defaultValue={domains[0]} required>
|
||||
{domains.map((domain) => (
|
||||
<option key={domain} value={domain}>
|
||||
{domain}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<span className="ds-field__hint" id="domain-hint">
|
||||
Nur Adressen dieser Domain werden akzeptiert. Weitere Domain unter{" "}
|
||||
<a href="/domains/new">Domains</a> anlegen.
|
||||
</span>
|
||||
</div>
|
||||
<div className="feld">
|
||||
<label htmlFor="from">Nur diese Absenderadresse (optional)</label>
|
||||
<input id="from" name="from" placeholder="noreply@hubsport.club" autoComplete="off" />
|
||||
|
||||
<div className="ds-field">
|
||||
<label className="ds-field__label" htmlFor="from">
|
||||
Nur diese Absenderadresse (optional)
|
||||
</label>
|
||||
<input
|
||||
className="ds-input"
|
||||
id="from"
|
||||
name="from"
|
||||
placeholder="noreply@hubsport.club"
|
||||
autoComplete="off"
|
||||
spellCheck={false}
|
||||
/>
|
||||
</div>
|
||||
<div className="zeile">
|
||||
<div className="feld">
|
||||
<label htmlFor="daily">Tageslimit</label>
|
||||
<input id="daily" name="daily" type="number" min={1} defaultValue={500} required />
|
||||
|
||||
<div className="app-form-row">
|
||||
<div className="ds-field">
|
||||
<label className="ds-field__label" htmlFor="daily">
|
||||
Tageslimit
|
||||
</label>
|
||||
<input
|
||||
className="ds-input"
|
||||
id="daily"
|
||||
name="daily"
|
||||
type="number"
|
||||
min={1}
|
||||
defaultValue={500}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<div className="feld">
|
||||
<label htmlFor="monthly">Monatslimit</label>
|
||||
<input id="monthly" name="monthly" type="number" min={1} defaultValue={15000} required />
|
||||
<div className="ds-field">
|
||||
<label className="ds-field__label" htmlFor="monthly">
|
||||
Monatslimit
|
||||
</label>
|
||||
<input
|
||||
className="ds-input"
|
||||
id="monthly"
|
||||
name="monthly"
|
||||
type="number"
|
||||
min={1}
|
||||
defaultValue={15000}
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<button className="knopf" type="submit" disabled={pending}>
|
||||
|
||||
<div className="app-actions">
|
||||
<button className="ds-button ds-button--lg" type="submit" disabled={pending}>
|
||||
{pending ? "Erzeuge…" : "API-Key erzeugen"}
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{state.error ? <p className="fehler">{state.error}</p> : null}
|
||||
{state.error ? (
|
||||
<p className="ds-field__error" role="alert">
|
||||
{state.error}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
{state.key ? (
|
||||
<div style={{ marginTop: 20 }}>
|
||||
<p className="erfolg">Key erzeugt. Er wird nur jetzt angezeigt:</p>
|
||||
<code className="schluessel">{state.key}</code>
|
||||
<div className="ds-alert ds-alert--success app-section" role="status">
|
||||
<div>
|
||||
<p className="ds-alert__title">API-Key erzeugt</p>
|
||||
<p className="ds-alert__text">Der Key wird nur jetzt angezeigt. Bitte sicher ablegen.</p>
|
||||
<code className="app-key app-section">{state.key}</code>
|
||||
<div className="app-actions app-section">
|
||||
<CopyButton value={state.key} label="Key kopieren" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</>
|
||||
|
||||
+146
-54
@@ -1,5 +1,11 @@
|
||||
import Link from "next/link";
|
||||
import { KeyRound } from "lucide-react";
|
||||
|
||||
import { EmptyState } from "@/app/empty-state";
|
||||
import { PageHeader } from "@/app/page-header";
|
||||
import { datum } from "@/lib/format";
|
||||
import { listApiKeys } from "@/lib/queries";
|
||||
import { listDomainRows } from "@/lib/ses-admin";
|
||||
|
||||
import { KeyForm } from "./key-form";
|
||||
import { revokeKey } from "./actions";
|
||||
@@ -8,79 +14,165 @@ export const dynamic = "force-dynamic";
|
||||
|
||||
export default async function Keys() {
|
||||
let keys: Awaited<ReturnType<typeof listApiKeys>> = [];
|
||||
let domains: string[] = ["hubsport.club"];
|
||||
let error = "";
|
||||
try {
|
||||
keys = await listApiKeys();
|
||||
domains = (await listDomainRows()).map((row) => row.domain);
|
||||
if (!domains.length) domains = ["hubsport.club"];
|
||||
} catch (cause) {
|
||||
error = cause instanceof Error ? cause.message : "Datenbank nicht erreichbar";
|
||||
}
|
||||
|
||||
const active = keys.filter((key) => !key.revoked_at).length;
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1>API-Keys</h1>
|
||||
<p className="lead">
|
||||
Jede App bekommt einen eigenen Key. Der Key gilt nur für die eingetragene Absenderdomain und
|
||||
wird nur gehasht gespeichert.
|
||||
</p>
|
||||
<PageHeader
|
||||
title="API-Keys"
|
||||
lead="Jede App bekommt einen eigenen Key. Er gilt nur für die eingetragene Absenderdomain und wird ausschließlich gehasht gespeichert."
|
||||
actions={
|
||||
<Link className="ds-button ds-button--secondary ds-button--sm" href="#neu">
|
||||
Neuer Key
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
|
||||
{error ? <p className="fehler">Datenbank nicht erreichbar: {error}</p> : null}
|
||||
{error ? (
|
||||
<div className="ds-alert ds-alert--danger" role="alert">
|
||||
<div>
|
||||
<p className="ds-alert__title">Datenbank nicht erreichbar</p>
|
||||
<p className="ds-alert__text">{error}</p>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<section className="abschnitt">
|
||||
<h2>Neuen Key erzeugen</h2>
|
||||
<KeyForm />
|
||||
<section className="ds-card app-panel" id="neu" aria-labelledby="neu">
|
||||
<div className="app-panel__head">
|
||||
<div>
|
||||
<h2 id="neu">Neuen Key erzeugen</h2>
|
||||
<p className="app-muted">Ein Key pro App, mit eigenem Tages- und Monatslimit.</p>
|
||||
</div>
|
||||
</div>
|
||||
<KeyForm domains={domains} />
|
||||
</section>
|
||||
|
||||
<section className="abschnitt">
|
||||
<h2>Vorhandene Keys</h2>
|
||||
<section className="ds-card app-panel app-section" aria-labelledby="vorhanden">
|
||||
<div className="app-panel__head">
|
||||
<h2 id="vorhanden">Vorhandene Keys</h2>
|
||||
<span className="ds-badge">{active} aktiv</span>
|
||||
</div>
|
||||
|
||||
{keys.length ? (
|
||||
<table className="tabelle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>App</th>
|
||||
<th>Bezeichnung</th>
|
||||
<th>Prefix</th>
|
||||
<th>Domain</th>
|
||||
<th>Limit</th>
|
||||
<th>Zuletzt</th>
|
||||
<th>Status</th>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{keys.map((key) => (
|
||||
<tr key={key.id}>
|
||||
<td>{key.app}</td>
|
||||
<td>{key.name}</td>
|
||||
<td className="mono">{key.prefix}…</td>
|
||||
<td>{key.from_domain}</td>
|
||||
<td className="mono">
|
||||
{key.daily_limit}/Tag · {key.monthly_limit}/Monat
|
||||
</td>
|
||||
<td className="mono">{datum(key.last_used_at)}</td>
|
||||
<td>{key.revoked_at ? <span className="status status-failed">gesperrt</span> : <span className="status status-sent">aktiv</span>}</td>
|
||||
<td>
|
||||
{key.revoked_at ? null : (
|
||||
<form action={revokeKey}>
|
||||
<input type="hidden" name="id" value={key.id} />
|
||||
<button className="knopf knopf-gefahr" type="submit">
|
||||
Sperren
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
</td>
|
||||
<>
|
||||
<div className="app-table-scroll app-desktop-table">
|
||||
<table className="ds-table">
|
||||
<caption className="ds-visually-hidden">API-Keys für die Apps</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>App</th>
|
||||
<th>Bezeichnung</th>
|
||||
<th>Prefix</th>
|
||||
<th className="app-hide-sm">Domain</th>
|
||||
<th>Limit</th>
|
||||
<th className="app-hide-sm">Zuletzt</th>
|
||||
<th>Status</th>
|
||||
<th />
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>
|
||||
{keys.map((key) => (
|
||||
<tr key={key.id}>
|
||||
<td>{key.app}</td>
|
||||
<td>{key.name}</td>
|
||||
<td className="app-mono">{key.prefix}…</td>
|
||||
<td className="app-hide-sm">{key.from_domain}</td>
|
||||
<td className="app-mono app-nowrap">
|
||||
{key.daily_limit}/Tag · {key.monthly_limit}/Monat
|
||||
</td>
|
||||
<td className="app-hide-sm app-mono app-nowrap">{datum(key.last_used_at)}</td>
|
||||
<td>
|
||||
{key.revoked_at ? (
|
||||
<span className="ds-badge ds-badge--danger">Gesperrt</span>
|
||||
) : (
|
||||
<span className="ds-badge ds-badge--success">Aktiv</span>
|
||||
)}
|
||||
</td>
|
||||
<td>
|
||||
{key.revoked_at ? null : (
|
||||
<form action={revokeKey}>
|
||||
<input type="hidden" name="id" value={key.id} />
|
||||
<button
|
||||
className="ds-button ds-button--danger ds-button--sm"
|
||||
type="submit"
|
||||
aria-label={`Key ${key.name} endgültig sperren`}
|
||||
>
|
||||
Sperren
|
||||
</button>
|
||||
</form>
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div className="app-mobile-list">
|
||||
{keys.map((key) => (
|
||||
<article key={key.id} className="app-mobile-item">
|
||||
<div className="app-mobile-item__top">
|
||||
<span>
|
||||
<strong>{key.name}</strong> <span className="app-muted">({key.app})</span>
|
||||
</span>
|
||||
{key.revoked_at ? (
|
||||
<span className="ds-badge ds-badge--danger">Gesperrt</span>
|
||||
) : (
|
||||
<span className="ds-badge ds-badge--success">Aktiv</span>
|
||||
)}
|
||||
</div>
|
||||
<div className="app-mobile-item__meta">
|
||||
<span className="app-mono">{key.prefix}…</span>
|
||||
<span className="app-mono">
|
||||
{key.daily_limit}/Tag · {key.monthly_limit}/Monat
|
||||
</span>
|
||||
</div>
|
||||
{key.revoked_at ? null : (
|
||||
<div className="app-mobile-item__actions">
|
||||
<form action={revokeKey}>
|
||||
<input type="hidden" name="id" value={key.id} />
|
||||
<button
|
||||
className="ds-button ds-button--danger ds-button--sm"
|
||||
type="submit"
|
||||
aria-label={`Key ${key.name} endgültig sperren`}
|
||||
>
|
||||
Sperren
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
)}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
) : (
|
||||
<p className="leer">Noch keine Keys.</p>
|
||||
<EmptyState
|
||||
icon={KeyRound}
|
||||
title="Noch keine Keys"
|
||||
text="Erzeuge oben den ersten Key für eine App."
|
||||
action={<Link className="ds-button ds-button--secondary ds-button--sm" href="#neu">Key erzeugen</Link>}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<section className="abschnitt">
|
||||
<h2>Verwendung</h2>
|
||||
<p>Die API ist weitgehend Resend-kompatibel:</p>
|
||||
<pre className="mono">{`curl -X POST https://courier.hubsport.club/api/emails \\
|
||||
<section className="ds-card app-panel app-section" aria-labelledby="verwendung">
|
||||
<div className="app-panel__head">
|
||||
<h2 id="verwendung">Verwendung</h2>
|
||||
</div>
|
||||
<p className="app-muted">
|
||||
Die API ist weitgehend Resend-kompatibel. Das Resend-SDK kann mit einer eigenen{" "}
|
||||
<code className="app-mono">baseUrl</code> auf Courier zeigen.
|
||||
</p>
|
||||
<pre className="app-code">{`curl -X POST https://<courier-adresse>/api/emails/ \\
|
||||
-H "Authorization: Bearer ck_live_…" \\
|
||||
-H "Content-Type: application/json" \\
|
||||
-d '{
|
||||
|
||||
+52
-13
@@ -1,7 +1,11 @@
|
||||
import type { Metadata } from "next";
|
||||
import Link from "next/link";
|
||||
import { GeistMono } from "geist/font/mono";
|
||||
import { GeistSans } from "geist/font/sans";
|
||||
|
||||
import { AppNav } from "./app-nav";
|
||||
import { MobileMenu } from "./mobile-menu";
|
||||
import { ThemeToggle } from "./theme-toggle";
|
||||
import "./globals.css";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
@@ -10,23 +14,58 @@ export const metadata: Metadata = {
|
||||
robots: { index: false, follow: false },
|
||||
};
|
||||
|
||||
const themeScript = `try {
|
||||
var t = localStorage.getItem('courier-theme');
|
||||
if (!t) t = matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
||||
document.documentElement.dataset.theme = t;
|
||||
} catch (e) {}`;
|
||||
|
||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<html lang="de" className={`${GeistSans.variable} ${GeistMono.variable}`}>
|
||||
<html lang="de" className={`${GeistSans.variable} ${GeistMono.variable}`} suppressHydrationWarning>
|
||||
<body>
|
||||
<header className="kopf">
|
||||
<div className="kopf-inhalt">
|
||||
<a className="marke" href="/">
|
||||
Courier
|
||||
</a>
|
||||
<nav className="nav" aria-label="Hauptnavigation">
|
||||
<a href="/">Übersicht</a>
|
||||
<a href="/messages">Nachrichten</a>
|
||||
<a href="/keys">API-Keys</a>
|
||||
</nav>
|
||||
<script dangerouslySetInnerHTML={{ __html: themeScript }} />
|
||||
<a className="ds-skip" href="#inhalt">
|
||||
Zum Inhalt
|
||||
</a>
|
||||
|
||||
<div className="app-shell">
|
||||
<aside className="app-sidebar">
|
||||
<div className="app-sidebar__top">
|
||||
<Link className="app-brand" href="/">
|
||||
<span className="app-brand__mark" aria-hidden="true" />
|
||||
Courier
|
||||
</Link>
|
||||
<AppNav />
|
||||
</div>
|
||||
<div className="app-sidebar__footer">
|
||||
<div className="app-sidebar__status">
|
||||
<span className="app-sidebar__dot" aria-hidden="true" />
|
||||
Amazon SES
|
||||
</div>
|
||||
<ThemeToggle />
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
<div className="app-content">
|
||||
<header className="app-mobilebar">
|
||||
<div className="app-mobilebar__row">
|
||||
<Link className="app-brand" href="/">
|
||||
<span className="app-brand__mark" aria-hidden="true" />
|
||||
Courier
|
||||
</Link>
|
||||
<div className="app-mobilebar__actions">
|
||||
<ThemeToggle />
|
||||
<MobileMenu />
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main id="inhalt" className="app-main">
|
||||
{children}
|
||||
</main>
|
||||
</div>
|
||||
</header>
|
||||
<main className="inhalt">{children}</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
+100
-88
@@ -1,6 +1,9 @@
|
||||
import Link from "next/link";
|
||||
import { notFound } from "next/navigation";
|
||||
|
||||
import { datum } from "@/lib/format";
|
||||
import { CopyButton } from "@/app/copy-button";
|
||||
import { EventBadge, StatusBadge } from "@/app/status-badge";
|
||||
import { datum, kurz } from "@/lib/format";
|
||||
import { messageDetail } from "@/lib/queries";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
@@ -10,100 +13,109 @@ export default async function Nachricht({ params }: { params: Promise<{ id: stri
|
||||
const detail = await messageDetail(id).catch(() => null);
|
||||
if (!detail) notFound();
|
||||
const { message, events } = detail;
|
||||
const payload = message.payload as { text?: string; html?: string } | null;
|
||||
const content = payload?.text || payload?.html || "";
|
||||
|
||||
return (
|
||||
<>
|
||||
<p>
|
||||
<a href="/messages">← Nachrichten</a>
|
||||
</p>
|
||||
<h1>{message.subject}</h1>
|
||||
<p className="lead">
|
||||
<span className={`status status-${message.status}`}>{message.status}</span>{" "}
|
||||
<span className="mono">{message.id}</span>
|
||||
</p>
|
||||
<nav className="ds-breadcrumb" aria-label="Brotkrümel">
|
||||
<ol>
|
||||
<li>
|
||||
<Link href="/messages">Nachrichten</Link>
|
||||
<span className="ds-breadcrumb__sep" aria-hidden="true">
|
||||
/
|
||||
</span>
|
||||
</li>
|
||||
<li aria-current="page">Details</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<section className="abschnitt">
|
||||
<h2>Kopf</h2>
|
||||
<table className="tabelle">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>App</th>
|
||||
<td>{message.app}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Von</th>
|
||||
<td>{message.from_name ? `${message.from_name} <${message.from_email}>` : message.from_email}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>An</th>
|
||||
<td>{message.to_emails.join(", ")}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>CC / BCC</th>
|
||||
<td>
|
||||
{message.cc_emails.join(", ") || "–"} / {message.bcc_emails.join(", ") || "–"}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>SES-ID</th>
|
||||
<td className="mono">{message.provider_message_id || "–"}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Erstellt</th>
|
||||
<td className="mono">{datum(message.created_at)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Gesendet</th>
|
||||
<td className="mono">{datum(message.sent_at)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Abgeschlossen</th>
|
||||
<td className="mono">{datum(message.completed_at)}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Versuche</th>
|
||||
<td className="mono">{message.attempts}</td>
|
||||
</tr>
|
||||
{message.error ? (
|
||||
<tr>
|
||||
<th>Fehler</th>
|
||||
<td className="fehler">{message.error}</td>
|
||||
</tr>
|
||||
) : null}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
<div className="app-pagehead app-section">
|
||||
<p className="app-eyebrow">Nachricht</p>
|
||||
<h1>{message.subject}</h1>
|
||||
<div className="app-actions">
|
||||
<StatusBadge status={message.status} />
|
||||
<span className="app-mono app-muted">{message.id}</span>
|
||||
<CopyButton value={message.id} label="ID kopieren" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section className="abschnitt">
|
||||
<h2>Events</h2>
|
||||
{events.length ? (
|
||||
<table className="tabelle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Zeit</th>
|
||||
<th>Typ</th>
|
||||
<th>Details</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{message.error ? (
|
||||
<div className="ds-alert ds-alert--danger" role="alert">
|
||||
<div>
|
||||
<p className="ds-alert__title">Zustellung fehlgeschlagen</p>
|
||||
<p className="ds-alert__text">{message.error}</p>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="app-grid app-grid--sidebar">
|
||||
<section className="ds-card app-panel" aria-labelledby="kopf">
|
||||
<div className="app-panel__head">
|
||||
<h2 id="kopf">Kopf</h2>
|
||||
</div>
|
||||
<dl className="app-dl">
|
||||
<dt>App</dt>
|
||||
<dd>{message.app}</dd>
|
||||
<dt>Von</dt>
|
||||
<dd>
|
||||
{message.from_name ? `${message.from_name} <${message.from_email}>` : message.from_email}
|
||||
</dd>
|
||||
<dt>An</dt>
|
||||
<dd>{message.to_emails.join(", ")}</dd>
|
||||
<dt>CC / BCC</dt>
|
||||
<dd>
|
||||
{message.cc_emails.join(", ") || "–"} / {message.bcc_emails.join(", ") || "–"}
|
||||
</dd>
|
||||
<dt>SES-ID</dt>
|
||||
<dd className="app-mono">{message.provider_message_id || "–"}</dd>
|
||||
<dt>Erstellt</dt>
|
||||
<dd className="app-mono">{datum(message.created_at)}</dd>
|
||||
<dt>Gesendet</dt>
|
||||
<dd className="app-mono">{datum(message.sent_at)}</dd>
|
||||
<dt>Abgeschlossen</dt>
|
||||
<dd className="app-mono">{datum(message.completed_at)}</dd>
|
||||
<dt>Versuche</dt>
|
||||
<dd className="app-mono">{message.attempts}</dd>
|
||||
</dl>
|
||||
|
||||
{content ? (
|
||||
<details>
|
||||
<summary>Inhalt anzeigen</summary>
|
||||
<pre className="app-code app-section">{kurz(content, 6000)}</pre>
|
||||
</details>
|
||||
) : null}
|
||||
</section>
|
||||
|
||||
<section className="ds-card app-panel" aria-labelledby="events">
|
||||
<div className="app-panel__head">
|
||||
<h2 id="events">Ereignisse</h2>
|
||||
</div>
|
||||
{events.length ? (
|
||||
<ol className="app-timeline">
|
||||
{events.map((event) => (
|
||||
<tr key={event.id}>
|
||||
<td className="mono">{datum(event.created_at)}</td>
|
||||
<td>{event.type}</td>
|
||||
<td>
|
||||
<details>
|
||||
<summary>JSON</summary>
|
||||
<pre className="mono">{JSON.stringify(event.payload, null, 2)}</pre>
|
||||
</details>
|
||||
</td>
|
||||
</tr>
|
||||
<li key={event.id} className="app-timeline__item">
|
||||
<div className="app-timeline__head">
|
||||
<EventBadge type={event.type} />
|
||||
<span className="app-mono app-muted">{datum(event.created_at)}</span>
|
||||
</div>
|
||||
<details>
|
||||
<summary>Rohdaten</summary>
|
||||
<pre className="app-code app-section">{JSON.stringify(event.payload, null, 2)}</pre>
|
||||
</details>
|
||||
</li>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
) : (
|
||||
<p className="leer">Noch keine Zustellereignisse.</p>
|
||||
)}
|
||||
</section>
|
||||
</ol>
|
||||
) : (
|
||||
<div className="ds-empty">
|
||||
<p className="ds-empty__title">Noch keine Zustellereignisse</p>
|
||||
<p className="ds-empty__text">
|
||||
SES meldet Zustellung, Bounce und Beschwerde über SNS zurück.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</section>
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import { listMessages } from "@/lib/queries";
|
||||
|
||||
export const runtime = "nodejs";
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
function cell(value: unknown): string {
|
||||
const text = value == null ? "" : String(value);
|
||||
return `"${text.replace(/"/g, '""')}"`;
|
||||
}
|
||||
|
||||
export async function GET(request: Request) {
|
||||
const params = new URL(request.url).searchParams;
|
||||
const rows = await listMessages({
|
||||
q: params.get("q") ?? "",
|
||||
status: params.get("status") ?? "",
|
||||
keyId: params.get("key") ?? "",
|
||||
days: Number(params.get("days") ?? 0),
|
||||
limit: 10000,
|
||||
});
|
||||
|
||||
const head = ["id", "created_at", "status", "app", "from", "to", "subject", "error"];
|
||||
const lines = [
|
||||
head.map(cell).join(","),
|
||||
...rows.map((row) =>
|
||||
[
|
||||
row.id,
|
||||
row.created_at,
|
||||
row.status,
|
||||
row.app,
|
||||
row.from_email,
|
||||
row.to_emails.join("; "),
|
||||
row.subject,
|
||||
row.error,
|
||||
]
|
||||
.map(cell)
|
||||
.join(","),
|
||||
),
|
||||
];
|
||||
|
||||
return new Response(`\uFEFF${lines.join("\n")}\n`, {
|
||||
headers: {
|
||||
"content-type": "text/csv; charset=utf-8",
|
||||
"content-disposition": `attachment; filename="courier-${new Date().toISOString().slice(0, 10)}.csv"`,
|
||||
"cache-control": "no-store",
|
||||
},
|
||||
});
|
||||
}
|
||||
+212
-49
@@ -1,76 +1,239 @@
|
||||
import { datum, kurz } from "@/lib/format";
|
||||
import { listMessages } from "@/lib/queries";
|
||||
import Link from "next/link";
|
||||
import { Mail } from "lucide-react";
|
||||
|
||||
import { EmptyState } from "@/app/empty-state";
|
||||
import { PageHeader } from "@/app/page-header";
|
||||
import { StatusBadge } from "@/app/status-badge";
|
||||
import { datum, relativ } from "@/lib/format";
|
||||
import { listApiKeys, listMessages } from "@/lib/queries";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
const STATUS = ["queued", "sending", "sent", "delivered", "bounced", "complained", "failed"];
|
||||
const STATUS = [
|
||||
{ value: "", label: "Alle Status" },
|
||||
{ value: "queued", label: "Warteschlange" },
|
||||
{ value: "sending", label: "Wird gesendet" },
|
||||
{ value: "sent", label: "Gesendet" },
|
||||
{ value: "delivered", label: "Zugestellt" },
|
||||
{ value: "bounced", label: "Bounce" },
|
||||
{ value: "complained", label: "Beschwerde" },
|
||||
{ value: "failed", label: "Fehlgeschlagen" },
|
||||
];
|
||||
|
||||
const DAYS = [
|
||||
{ value: "1", label: "24 Stunden" },
|
||||
{ value: "7", label: "7 Tage" },
|
||||
{ value: "30", label: "30 Tage" },
|
||||
{ value: "0", label: "Alle" },
|
||||
];
|
||||
|
||||
export default async function Nachrichten({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ status?: string }>;
|
||||
searchParams: Promise<{ q?: string; status?: string; key?: string; days?: string }>;
|
||||
}) {
|
||||
const { status } = await searchParams;
|
||||
const params = await searchParams;
|
||||
const q = String(params.q ?? "").trim();
|
||||
const status = String(params.status ?? "");
|
||||
const keyId = String(params.key ?? "");
|
||||
const days = Number(params.days ?? 7);
|
||||
|
||||
let messages: Awaited<ReturnType<typeof listMessages>> = [];
|
||||
let keys: Awaited<ReturnType<typeof listApiKeys>> = [];
|
||||
let error = "";
|
||||
try {
|
||||
messages = await listMessages(status);
|
||||
[messages, keys] = await Promise.all([
|
||||
listMessages({ q, status, keyId, days, limit: 100 }),
|
||||
listApiKeys(),
|
||||
]);
|
||||
} catch (cause) {
|
||||
error = cause instanceof Error ? cause.message : "Datenbank nicht erreichbar";
|
||||
}
|
||||
|
||||
const query = new URLSearchParams();
|
||||
if (q) query.set("q", q);
|
||||
if (status) query.set("status", status);
|
||||
if (keyId) query.set("key", keyId);
|
||||
query.set("days", String(days));
|
||||
const exportHref = `/messages/export/${query.size ? `?${query.toString()}` : ""}`;
|
||||
const resetHref = "/messages";
|
||||
const filtered = q || status || keyId || Number(params.days);
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1>Nachrichten</h1>
|
||||
<p className="lead">Die letzten 100 Mails, neueste zuerst.</p>
|
||||
<PageHeader
|
||||
title="Nachrichten"
|
||||
lead="Die letzten 100 Mails, neueste zuerst. Suche und Filter bleiben in der Adresse."
|
||||
actions={
|
||||
<>
|
||||
<Link className="ds-button ds-button--secondary ds-button--sm" href="/suppressions">
|
||||
Suppressions
|
||||
</Link>
|
||||
<Link className="ds-button ds-button--secondary ds-button--sm" href={exportHref}>
|
||||
CSV exportieren
|
||||
</Link>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
<div className="zeile" style={{ marginBottom: 20 }}>
|
||||
<a className="knopf knopf-sekundaer" href="/messages">
|
||||
Alle
|
||||
</a>
|
||||
{STATUS.map((value) => (
|
||||
<a key={value} className="knopf knopf-sekundaer" href={`/messages?status=${value}`}>
|
||||
{value}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
<form className="app-toolbar" method="get">
|
||||
<div className="ds-field">
|
||||
<label className="ds-visually-hidden" htmlFor="q">
|
||||
Suche
|
||||
</label>
|
||||
<input
|
||||
className="ds-input"
|
||||
id="q"
|
||||
name="q"
|
||||
defaultValue={q}
|
||||
placeholder="Betreff, Empfänger, ID…"
|
||||
/>
|
||||
</div>
|
||||
<div className="ds-field">
|
||||
<label className="ds-visually-hidden" htmlFor="status">
|
||||
Status
|
||||
</label>
|
||||
<select className="ds-select" id="status" name="status" defaultValue={status}>
|
||||
{STATUS.map((item) => (
|
||||
<option key={item.value || "all"} value={item.value}>
|
||||
{item.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="ds-field">
|
||||
<label className="ds-visually-hidden" htmlFor="key">
|
||||
API-Key
|
||||
</label>
|
||||
<select className="ds-select" id="key" name="key" defaultValue={keyId}>
|
||||
<option value="">Alle API-Keys</option>
|
||||
{keys.map((key) => (
|
||||
<option key={key.id} value={key.id}>
|
||||
{key.app} · {key.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="ds-field">
|
||||
<label className="ds-visually-hidden" htmlFor="days">
|
||||
Zeitraum
|
||||
</label>
|
||||
<select className="ds-select" id="days" name="days" defaultValue={String(days)}>
|
||||
{DAYS.map((item) => (
|
||||
<option key={item.value} value={item.value}>
|
||||
{item.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="app-toolbar__actions">
|
||||
<button className="ds-button" type="submit">
|
||||
Filtern
|
||||
</button>
|
||||
{filtered ? (
|
||||
<Link className="ds-button ds-button--secondary" href={resetHref}>
|
||||
Zurücksetzen
|
||||
</Link>
|
||||
) : null}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{error ? (
|
||||
<p className="fehler">Datenbank nicht erreichbar: {error}</p>
|
||||
<div className="ds-alert ds-alert--danger" role="alert">
|
||||
<div>
|
||||
<p className="ds-alert__title">Datenbank nicht erreichbar</p>
|
||||
<p className="ds-alert__text">{error}</p>
|
||||
</div>
|
||||
</div>
|
||||
) : messages.length ? (
|
||||
<section className="abschnitt">
|
||||
<table className="tabelle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Zeit</th>
|
||||
<th>App</th>
|
||||
<th>Empfänger</th>
|
||||
<th>Betreff</th>
|
||||
<th>Versuche</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{messages.map((message) => (
|
||||
<tr key={message.id}>
|
||||
<td className="mono">{datum(message.created_at)}</td>
|
||||
<td>{message.app}</td>
|
||||
<td>{message.to_emails.join(", ")}</td>
|
||||
<td>
|
||||
<a href={`/messages/${message.id}`}>{kurz(message.subject, 70)}</a>
|
||||
{message.error ? <div className="fehler mono">{kurz(message.error, 80)}</div> : null}
|
||||
</td>
|
||||
<td className="mono">{message.attempts}</td>
|
||||
<td>
|
||||
<span className={`status status-${message.status}`}>{message.status}</span>
|
||||
</td>
|
||||
<section className="ds-card app-panel">
|
||||
<div className="app-table-scroll app-desktop-table">
|
||||
<table className="ds-table app-table--messages">
|
||||
<caption className="ds-visually-hidden">Gefilterte Nachrichten</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Zeit</th>
|
||||
<th className="app-hide-sm">App</th>
|
||||
<th>Empfänger</th>
|
||||
<th>Betreff</th>
|
||||
<th className="app-hide-sm">Versuche</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>
|
||||
{messages.map((message) => (
|
||||
<tr key={message.id}>
|
||||
<td className="app-mono app-nowrap">
|
||||
<time dateTime={message.created_at} title={datum(message.created_at)}>
|
||||
{relativ(message.created_at)}
|
||||
</time>
|
||||
</td>
|
||||
<td className="app-hide-sm">{message.app}</td>
|
||||
<td>
|
||||
{message.to_emails[0]}
|
||||
{message.to_emails.length > 1 ? (
|
||||
<span className="app-muted"> +{message.to_emails.length - 1}</span>
|
||||
) : null}
|
||||
</td>
|
||||
<td>
|
||||
<Link href={`/messages/${message.id}`}>
|
||||
<span className="app-ellipsis">{message.subject}</span>
|
||||
</Link>
|
||||
{message.error ? <span className="ds-field__error">{message.error}</span> : null}
|
||||
</td>
|
||||
<td className="app-hide-sm app-mono">{message.attempts}</td>
|
||||
<td>
|
||||
<StatusBadge status={message.status} />
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div className="app-mobile-list">
|
||||
{messages.map((message) => (
|
||||
<article key={message.id} className="app-mobile-item">
|
||||
<div className="app-mobile-item__top">
|
||||
<Link href={`/messages/${message.id}`}>{message.subject}</Link>
|
||||
<StatusBadge status={message.status} />
|
||||
</div>
|
||||
<div className="app-mobile-item__meta">
|
||||
<span>
|
||||
{message.to_emails[0]}
|
||||
{message.to_emails.length > 1 ? ` +${message.to_emails.length - 1}` : ""}
|
||||
</span>
|
||||
<span className="app-mono" title={datum(message.created_at)}>
|
||||
{relativ(message.created_at)}
|
||||
</span>
|
||||
</div>
|
||||
{message.error ? (
|
||||
<span className="app-mobile-item__error">{message.error}</span>
|
||||
) : null}
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
) : (
|
||||
<p className="leer">Keine Nachrichten in dieser Ansicht.</p>
|
||||
<EmptyState
|
||||
icon={Mail}
|
||||
title={filtered ? "Keine Treffer" : "Noch keine Nachrichten"}
|
||||
text={
|
||||
filtered
|
||||
? "Kein Eintrag passt zu Suche und Filtern."
|
||||
: "Sobald eine App über die API sendet, erscheint sie hier."
|
||||
}
|
||||
action={
|
||||
filtered ? (
|
||||
<Link className="ds-button ds-button--sm" href="/messages">
|
||||
Filter zurücksetzen
|
||||
</Link>
|
||||
) : (
|
||||
<Link className="ds-button ds-button--sm" href="/docs">
|
||||
API ansehen
|
||||
</Link>
|
||||
)
|
||||
}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
import Link from "next/link";
|
||||
import { BarChart3 } from "lucide-react";
|
||||
|
||||
import { EmptyState } from "@/app/empty-state";
|
||||
import { PageHeader } from "@/app/page-header";
|
||||
import { datum } from "@/lib/format";
|
||||
import { dailyMetrics, listApiKeys } from "@/lib/queries";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
const RANGES = [
|
||||
{ value: "7", label: "7 Tage" },
|
||||
{ value: "14", label: "14 Tage" },
|
||||
{ value: "30", label: "30 Tage" },
|
||||
];
|
||||
|
||||
function dayLabel(day: string): string {
|
||||
return new Intl.DateTimeFormat("de-DE", { day: "2-digit", month: "2-digit" }).format(
|
||||
new Date(`${day}T12:00:00`),
|
||||
);
|
||||
}
|
||||
|
||||
function percent(value: number, total: number): string {
|
||||
if (!total) return "–";
|
||||
return `${Math.round((value / total) * 1000) / 10} %`;
|
||||
}
|
||||
|
||||
export default async function Metrics({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ days?: string; key?: string }>;
|
||||
}) {
|
||||
const params = await searchParams;
|
||||
const days = Number(params.days ?? 14);
|
||||
const keyId = String(params.key ?? "");
|
||||
|
||||
let rows: Awaited<ReturnType<typeof dailyMetrics>> = [];
|
||||
let keys: Awaited<ReturnType<typeof listApiKeys>> = [];
|
||||
let error = "";
|
||||
try {
|
||||
[rows, keys] = await Promise.all([dailyMetrics(days, keyId), listApiKeys()]);
|
||||
} catch (cause) {
|
||||
error = cause instanceof Error ? cause.message : "Datenbank nicht erreichbar";
|
||||
}
|
||||
|
||||
const total = rows.reduce((sum, row) => sum + row.total, 0);
|
||||
const delivered = rows.reduce((sum, row) => sum + row.delivered, 0);
|
||||
const bounced = rows.reduce((sum, row) => sum + row.bounced, 0);
|
||||
const complained = rows.reduce((sum, row) => sum + row.complained, 0);
|
||||
const failed = rows.reduce((sum, row) => sum + row.failed, 0);
|
||||
const final = delivered + bounced + complained + failed;
|
||||
|
||||
const W = 760;
|
||||
const H = 220;
|
||||
const padX = 16;
|
||||
const padTop = 16;
|
||||
const padBottom = 28;
|
||||
const max = Math.max(...rows.map((row) => row.total), 1);
|
||||
const x = (index: number) => padX + (index * (W - 2 * padX)) / Math.max(rows.length - 1, 1);
|
||||
const y = (value: number) => H - padBottom - (value / max) * (H - padTop - padBottom);
|
||||
const line = rows.map((row, index) => `${index === 0 ? "M" : "L"}${x(index)},${y(row.total)}`).join(" ");
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Metriken"
|
||||
lead="Volumen, Zustellung und Fehler der letzten Tage. Tageswerte, keine Marketingzahlen."
|
||||
/>
|
||||
|
||||
<form className="app-toolbar app-toolbar--metrics" method="get">
|
||||
<div className="ds-field">
|
||||
<label className="ds-visually-hidden" htmlFor="days">
|
||||
Zeitraum
|
||||
</label>
|
||||
<select className="ds-select" id="days" name="days" defaultValue={String(days)}>
|
||||
{RANGES.map((range) => (
|
||||
<option key={range.value} value={range.value}>
|
||||
{range.label}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="ds-field">
|
||||
<label className="ds-visually-hidden" htmlFor="key">
|
||||
API-Key
|
||||
</label>
|
||||
<select className="ds-select" id="key" name="key" defaultValue={keyId}>
|
||||
<option value="">Alle API-Keys</option>
|
||||
{keys.map((key) => (
|
||||
<option key={key.id} value={key.id}>
|
||||
{key.app} · {key.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div className="app-toolbar__actions">
|
||||
<button className="ds-button" type="submit">
|
||||
Anzeigen
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{error ? (
|
||||
<div className="ds-alert ds-alert--danger" role="alert">
|
||||
<div>
|
||||
<p className="ds-alert__title">Datenbank nicht erreichbar</p>
|
||||
<p className="ds-alert__text">{error}</p>
|
||||
</div>
|
||||
</div>
|
||||
) : total === 0 ? (
|
||||
<EmptyState
|
||||
icon={BarChart3}
|
||||
title="Noch keine Daten"
|
||||
text="Sobald Courier Mails verarbeitet, erscheinen hier Volumen und Zustellraten."
|
||||
action={
|
||||
<Link className="ds-button ds-button--sm" href="/docs">
|
||||
API ansehen
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
) : (
|
||||
<>
|
||||
<section className="app-stats" aria-label="Kennzahlen">
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{total}</span>
|
||||
<span className="ds-stat__label">Mails</span>
|
||||
<span className="ds-stat__meta">{days} Tage</span>
|
||||
</article>
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{percent(delivered, final)}</span>
|
||||
<span className="ds-stat__label">Zustellrate</span>
|
||||
<span className="ds-stat__meta">{delivered} zugestellt</span>
|
||||
</article>
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{percent(bounced, final)}</span>
|
||||
<span className="ds-stat__label">Bounce-Rate</span>
|
||||
<span className="ds-stat__meta">{bounced} Bounces</span>
|
||||
</article>
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{percent(complained, final)}</span>
|
||||
<span className="ds-stat__label">Complaint-Rate</span>
|
||||
<span className="ds-stat__meta">{complained} Beschwerden</span>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section className="ds-card app-panel" aria-labelledby="verlauf">
|
||||
<div className="app-panel__head">
|
||||
<h2 id="verlauf">Verlauf</h2>
|
||||
</div>
|
||||
<div className="app-chart">
|
||||
<svg
|
||||
viewBox={`0 0 ${W} ${H}`}
|
||||
role="img"
|
||||
aria-label={`Tägliches Mailvolumen der letzten ${days} Tage`}
|
||||
>
|
||||
<title>Mailvolumen pro Tag</title>
|
||||
{[0, 0.5, 1].map((fraction) => (
|
||||
<line
|
||||
key={fraction}
|
||||
x1={padX}
|
||||
x2={W - padX}
|
||||
y1={y(max * fraction)}
|
||||
y2={y(max * fraction)}
|
||||
className="app-chart__grid"
|
||||
/>
|
||||
))}
|
||||
<path d={line} className="app-chart__line" />
|
||||
{rows.map((row, index) => (
|
||||
<circle
|
||||
key={row.day}
|
||||
cx={x(index)}
|
||||
cy={y(row.total)}
|
||||
r={3}
|
||||
className="app-chart__dot"
|
||||
>
|
||||
<title>{`${dayLabel(row.day)}: ${row.total}`}</title>
|
||||
</circle>
|
||||
))}
|
||||
</svg>
|
||||
<div className="app-chart__axis">
|
||||
<span>{dayLabel(rows[0]?.day ?? "")}</span>
|
||||
<span>{dayLabel(rows[rows.length - 1]?.day ?? "")}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="app-table-scroll app-desktop-table app-section">
|
||||
<table className="ds-table">
|
||||
<caption className="ds-visually-hidden">Tageswerte</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Tag</th>
|
||||
<th className="ds-table__num">Mails</th>
|
||||
<th className="ds-table__num">Zugestellt</th>
|
||||
<th className="ds-table__num">Bounce</th>
|
||||
<th className="ds-table__num">Beschwerde</th>
|
||||
<th className="ds-table__num">Fehler</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map((row) => (
|
||||
<tr key={row.day}>
|
||||
<td>{dayLabel(row.day)}</td>
|
||||
<td className="ds-table__num">{row.total}</td>
|
||||
<td className="ds-table__num">{row.delivered}</td>
|
||||
<td className="ds-table__num">{row.bounced}</td>
|
||||
<td className="ds-table__num">{row.complained}</td>
|
||||
<td className="ds-table__num">{row.failed}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div className="app-mobile-list">
|
||||
{rows.map((row) => (
|
||||
<article key={row.day} className="app-mobile-item">
|
||||
<div className="app-mobile-item__top">
|
||||
<span>{dayLabel(row.day)}</span>
|
||||
<span className="ds-badge">{row.total} Mails</span>
|
||||
</div>
|
||||
<div className="app-mobile-item__meta">
|
||||
<span>{row.delivered} zugestellt</span>
|
||||
<span>{row.bounced} Bounce</span>
|
||||
<span>{row.complained} Beschwerde</span>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<p className="app-muted app-section">
|
||||
Stand: {datum(new Date())}. Zustellrate = zugestellt / (zugestellt + Bounce +
|
||||
Beschwerde + Fehler).
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import { usePathname } from "next/navigation";
|
||||
import { Menu } from "lucide-react";
|
||||
|
||||
import { AppNav } from "./app-nav";
|
||||
|
||||
export function MobileMenu() {
|
||||
const [open, setOpen] = useState(false);
|
||||
const pathname = usePathname();
|
||||
|
||||
useEffect(() => {
|
||||
setOpen(false);
|
||||
}, [pathname]);
|
||||
|
||||
return (
|
||||
<div className="app-mobilemenu">
|
||||
<button
|
||||
type="button"
|
||||
className="app-mobilemenu__toggle"
|
||||
aria-expanded={open}
|
||||
aria-controls="mobile-navigation"
|
||||
onClick={() => setOpen((value) => !value)}
|
||||
>
|
||||
<Menu className="app-nav__icon" aria-hidden="true" />
|
||||
Menü
|
||||
</button>
|
||||
{open ? (
|
||||
<div className="app-mobilemenu__panel" id="mobile-navigation">
|
||||
<AppNav variant="mobile" />
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import Link from "next/link";
|
||||
import { Code2 } from "lucide-react";
|
||||
|
||||
export function PageHeader({
|
||||
eyebrow = "Courier",
|
||||
title,
|
||||
lead,
|
||||
actions,
|
||||
code = true,
|
||||
}: {
|
||||
eyebrow?: string;
|
||||
title: string;
|
||||
lead?: string;
|
||||
actions?: React.ReactNode;
|
||||
code?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<div className="app-pagehead">
|
||||
<div className="app-pagehead__row">
|
||||
<div>
|
||||
<p className="app-eyebrow">{eyebrow}</p>
|
||||
<h1>{title}</h1>
|
||||
{lead ? <p className="app-lead">{lead}</p> : null}
|
||||
</div>
|
||||
<div className="app-pagehead__actions">
|
||||
{actions}
|
||||
{code ? (
|
||||
<Link className="ds-button ds-button--secondary ds-button--sm" href="/docs" aria-label="API-Dokumentation">
|
||||
<Code2 className="app-nav__icon" aria-hidden="true" />
|
||||
API
|
||||
</Link>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,167 +0,0 @@
|
||||
.page {
|
||||
--gray-rgb: 0, 0, 0;
|
||||
--gray-alpha-200: rgba(var(--gray-rgb), 0.08);
|
||||
--gray-alpha-100: rgba(var(--gray-rgb), 0.05);
|
||||
|
||||
--button-primary-hover: #383838;
|
||||
--button-secondary-hover: #f2f2f2;
|
||||
|
||||
display: grid;
|
||||
grid-template-rows: 20px 1fr 20px;
|
||||
align-items: center;
|
||||
justify-items: center;
|
||||
min-height: 100svh;
|
||||
padding: 80px;
|
||||
gap: 64px;
|
||||
font-family: var(--font-geist-sans);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.page {
|
||||
--gray-rgb: 255, 255, 255;
|
||||
--gray-alpha-200: rgba(var(--gray-rgb), 0.145);
|
||||
--gray-alpha-100: rgba(var(--gray-rgb), 0.06);
|
||||
|
||||
--button-primary-hover: #ccc;
|
||||
--button-secondary-hover: #1a1a1a;
|
||||
}
|
||||
}
|
||||
|
||||
.main {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 32px;
|
||||
grid-row-start: 2;
|
||||
}
|
||||
|
||||
.main ol {
|
||||
font-family: var(--font-geist-mono);
|
||||
padding-left: 0;
|
||||
margin: 0;
|
||||
font-size: 14px;
|
||||
line-height: 24px;
|
||||
letter-spacing: -0.01em;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
.main li:not(:last-of-type) {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.main code {
|
||||
font-family: inherit;
|
||||
background: var(--gray-alpha-100);
|
||||
padding: 2px 4px;
|
||||
border-radius: 4px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.ctas {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.ctas a {
|
||||
appearance: none;
|
||||
border-radius: 128px;
|
||||
height: 48px;
|
||||
padding: 0 20px;
|
||||
border: 1px solid transparent;
|
||||
transition:
|
||||
background 0.2s,
|
||||
color 0.2s,
|
||||
border-color 0.2s;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 16px;
|
||||
line-height: 20px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
a.primary {
|
||||
background: var(--foreground);
|
||||
color: var(--background);
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
a.secondary {
|
||||
border-color: var(--gray-alpha-200);
|
||||
min-width: 158px;
|
||||
}
|
||||
|
||||
.footer {
|
||||
grid-row-start: 3;
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.footer a {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.footer img {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
/* Enable hover only on non-touch devices */
|
||||
@media (hover: hover) and (pointer: fine) {
|
||||
a.primary:hover {
|
||||
background: var(--button-primary-hover);
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
a.secondary:hover {
|
||||
background: var(--button-secondary-hover);
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
.footer a:hover {
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.page {
|
||||
padding: 32px;
|
||||
padding-bottom: 80px;
|
||||
}
|
||||
|
||||
.main {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.main ol {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ctas {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ctas a {
|
||||
font-size: 14px;
|
||||
height: 40px;
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
a.secondary {
|
||||
min-width: auto;
|
||||
}
|
||||
|
||||
.footer {
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
.logo {
|
||||
filter: invert();
|
||||
}
|
||||
}
|
||||
+136
-72
@@ -1,9 +1,23 @@
|
||||
import Link from "next/link";
|
||||
import { Mail } from "lucide-react";
|
||||
|
||||
import { EmptyState } from "./empty-state";
|
||||
import { PageHeader } from "./page-header";
|
||||
|
||||
import { config } from "@/lib/config";
|
||||
import { datum, kurz } from "@/lib/format";
|
||||
import { datum } from "@/lib/format";
|
||||
import { dashboardStats } from "@/lib/queries";
|
||||
|
||||
import { StatusBadge } from "./status-badge";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
function transportLabel() {
|
||||
if (config.transport === "ses") return { label: "Amazon SES", tone: "success" };
|
||||
if (config.transport === "resend") return { label: "Resend", tone: "info" };
|
||||
return { label: "Dry-Run", tone: "warning" };
|
||||
}
|
||||
|
||||
export default async function Startseite() {
|
||||
let stats: Awaited<ReturnType<typeof dashboardStats>> | null = null;
|
||||
let error = "";
|
||||
@@ -13,85 +27,135 @@ export default async function Startseite() {
|
||||
error = cause instanceof Error ? cause.message : "Datenbank nicht erreichbar";
|
||||
}
|
||||
|
||||
const transport = transportLabel();
|
||||
|
||||
return (
|
||||
<>
|
||||
<h1>Übersicht</h1>
|
||||
<p className="lead">
|
||||
Courier nimmt Mails von deinen Apps an, legt sie in eine Warteschlange und übergibt sie an
|
||||
Amazon SES. Absenderdomain: <strong>{config.fromDomain}</strong>, Transport:{" "}
|
||||
<strong>{config.transport}</strong>.
|
||||
</p>
|
||||
<PageHeader
|
||||
title="Übersicht"
|
||||
lead="Transaktionsmail für deine Apps: eine API, eine Warteschlange, klare Zustellereignisse."
|
||||
/>
|
||||
|
||||
{error ? (
|
||||
<section className="abschnitt">
|
||||
<h2>Einrichtung fehlt</h2>
|
||||
<p className="fehler">Datenbank nicht erreichbar: {error}</p>
|
||||
<p>
|
||||
Migration ausführen: <code>npm run db:migrate</code>, danach einen Key erzeugen:{" "}
|
||||
<code>npm run db:key -- --app plan --name Plan</code>.
|
||||
</p>
|
||||
</section>
|
||||
<div className="ds-alert ds-alert--danger" role="alert">
|
||||
<div>
|
||||
<p className="ds-alert__title">Datenbank nicht erreichbar</p>
|
||||
<p className="ds-alert__text">{error}</p>
|
||||
<p className="ds-alert__text">
|
||||
Migration ausführen: <code className="app-mono">npm run db:migrate</code>, danach einen Key
|
||||
erzeugen: <code className="app-mono">npm run db:key -- --app plan --name Plan</code>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<div className="karten">
|
||||
<div className="karte">
|
||||
<span className="zahl">{stats?.counts.queued ?? 0}</span>
|
||||
<span className="label">in Warteschlange</span>
|
||||
</div>
|
||||
<div className="karte">
|
||||
<span className="zahl">{(stats?.counts.sent ?? 0) + (stats?.counts.delivered ?? 0)}</span>
|
||||
<span className="label">gesendet / zugestellt (24 h)</span>
|
||||
</div>
|
||||
<div className="karte">
|
||||
<span className="zahl">
|
||||
{(stats?.counts.failed ?? 0) + (stats?.counts.bounced ?? 0) + (stats?.counts.complained ?? 0)}
|
||||
<section className="app-stats" aria-label="Kennzahlen der letzten 24 Stunden">
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{stats?.counts.queued ?? 0}</span>
|
||||
<span className="ds-stat__label">In Warteschlange</span>
|
||||
<span className="ds-stat__meta">werden gleich gesendet</span>
|
||||
</article>
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">
|
||||
{(stats?.counts.sent ?? 0) + (stats?.counts.delivered ?? 0)}
|
||||
</span>
|
||||
<span className="label">Fehler (24 h)</span>
|
||||
</div>
|
||||
<div className="karte">
|
||||
<span className="zahl">{stats?.suppressed ?? 0}</span>
|
||||
<span className="label">gesperrte Empfänger</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<section className="abschnitt">
|
||||
<div className="abschnitt-kopf">
|
||||
<h2>Letzte Nachrichten</h2>
|
||||
<a className="knopf knopf-sekundaer" href="/messages">
|
||||
Alle ansehen
|
||||
</a>
|
||||
</div>
|
||||
{stats?.recent.length ? (
|
||||
<table className="tabelle">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Zeit</th>
|
||||
<th>App</th>
|
||||
<th>Empfänger</th>
|
||||
<th>Betreff</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{stats.recent.map((message) => (
|
||||
<tr key={message.id}>
|
||||
<td className="mono">{datum(message.created_at)}</td>
|
||||
<td>{message.app}</td>
|
||||
<td>{message.to_emails.join(", ")}</td>
|
||||
<td>
|
||||
<a href={`/messages/${message.id}`}>{kurz(message.subject, 60)}</a>
|
||||
</td>
|
||||
<td>
|
||||
<span className={`status status-${message.status}`}>{message.status}</span>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
) : (
|
||||
<p className="leer">Noch keine Nachrichten.</p>
|
||||
)}
|
||||
<span className="ds-stat__label">Gesendet / zugestellt</span>
|
||||
<span className="ds-stat__meta">letzte 24 Stunden</span>
|
||||
</article>
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">
|
||||
{(stats?.counts.failed ?? 0) +
|
||||
(stats?.counts.bounced ?? 0) +
|
||||
(stats?.counts.complained ?? 0)}
|
||||
</span>
|
||||
<span className="ds-stat__label">Fehler</span>
|
||||
<span className="ds-stat__meta">Bounce, Beschwerde, fehlgeschlagen</span>
|
||||
</article>
|
||||
<article className="ds-card app-stat">
|
||||
<span className="ds-stat__value">{stats?.suppressed ?? 0}</span>
|
||||
<span className="ds-stat__label">Gesperrte Empfänger</span>
|
||||
<span className="ds-stat__meta">nach hartem Bounce oder Beschwerde</span>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<div className="app-grid app-grid--sidebar">
|
||||
<section className="ds-card app-panel" aria-labelledby="letzte-nachrichten">
|
||||
<div className="app-panel__head">
|
||||
<h2 id="letzte-nachrichten">Letzte Nachrichten</h2>
|
||||
<Link className="ds-button ds-button--secondary ds-button--sm" href="/messages">
|
||||
Alle ansehen
|
||||
</Link>
|
||||
</div>
|
||||
{stats?.recent.length ? (
|
||||
<div className="app-message-list">
|
||||
{stats.recent.map((message) => (
|
||||
<Link key={message.id} className="app-message-row" href={`/messages/${message.id}`}>
|
||||
<span className="app-message-row__main">
|
||||
<span className="app-message-row__subject">{message.subject}</span>
|
||||
<span className="app-message-row__meta">
|
||||
<span>
|
||||
{message.to_emails[0]}
|
||||
{message.to_emails.length > 1 ? ` +${message.to_emails.length - 1}` : ""}
|
||||
</span>
|
||||
<span className="app-mono">{datum(message.created_at)}</span>
|
||||
</span>
|
||||
</span>
|
||||
<StatusBadge status={message.status} />
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
<EmptyState
|
||||
icon={Mail}
|
||||
title="Noch keine Nachrichten"
|
||||
text="Sobald eine App über die API sendet, erscheint sie hier."
|
||||
action={<Link className="ds-button ds-button--sm" href="/docs">API ansehen</Link>}
|
||||
/>
|
||||
)}
|
||||
</section>
|
||||
|
||||
<aside className="ds-card app-panel" aria-labelledby="system">
|
||||
<div className="app-panel__head">
|
||||
<h2 id="system">System</h2>
|
||||
</div>
|
||||
<dl className="app-dl">
|
||||
<dt>Transport</dt>
|
||||
<dd>
|
||||
<span
|
||||
className={`ds-badge${transport.tone === "success" ? " ds-badge--success" : ` ds-badge--${transport.tone}`}`}
|
||||
>
|
||||
{transport.label}
|
||||
</span>
|
||||
</dd>
|
||||
<dt>Standarddomain</dt>
|
||||
<dd className="app-mono">{config.fromDomain}</dd>
|
||||
<dt>Konfiguration</dt>
|
||||
<dd className="app-mono">{config.sesConfigurationSet}</dd>
|
||||
<dt>Region</dt>
|
||||
<dd className="app-mono">{config.awsRegion}</dd>
|
||||
</dl>
|
||||
|
||||
{config.transport === "dry-run" ? (
|
||||
<div className="ds-alert ds-alert--warning">
|
||||
<div>
|
||||
<p className="ds-alert__title">Dry-Run aktiv</p>
|
||||
<p className="ds-alert__text">
|
||||
Mails werden nur protokolliert, nicht an SES übergeben.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="app-actions">
|
||||
<Link className="ds-button ds-button--secondary ds-button--sm" href="/keys">
|
||||
API-Keys
|
||||
</Link>
|
||||
<Link className="ds-button ds-button--secondary ds-button--sm" href="/domains">
|
||||
Domains
|
||||
</Link>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
const STATUS: Record<string, { label: string; tone: string }> = {
|
||||
queued: { label: "In Warteschlange", tone: "warning" },
|
||||
sending: { label: "Wird gesendet", tone: "info" },
|
||||
sent: { label: "Gesendet", tone: "info" },
|
||||
delivered: { label: "Zugestellt", tone: "success" },
|
||||
bounced: { label: "Bounce", tone: "danger" },
|
||||
complained: { label: "Beschwerde", tone: "danger" },
|
||||
failed: { label: "Fehlgeschlagen", tone: "danger" },
|
||||
};
|
||||
|
||||
const EVENTS: Record<string, { label: string; tone: string }> = {
|
||||
Send: { label: "Angenommen", tone: "info" },
|
||||
Delivery: { label: "Zugestellt", tone: "success" },
|
||||
Bounce: { label: "Bounce", tone: "danger" },
|
||||
Complaint: { label: "Beschwerde", tone: "danger" },
|
||||
Reject: { label: "Abgelehnt", tone: "danger" },
|
||||
};
|
||||
|
||||
export function StatusBadge({ status }: { status: string }) {
|
||||
const entry = STATUS[status] ?? { label: status, tone: "neutral" };
|
||||
return (
|
||||
<span className={`ds-badge${entry.tone === "neutral" ? "" : ` ds-badge--${entry.tone}`}`}>
|
||||
{entry.label}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
|
||||
export function EventBadge({ type }: { type: string }) {
|
||||
const entry = EVENTS[type] ?? { label: type, tone: "neutral" };
|
||||
return (
|
||||
<span className={`ds-badge${entry.tone === "neutral" ? "" : ` ds-badge--${entry.tone}`}`}>
|
||||
{entry.label}
|
||||
</span>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
"use server";
|
||||
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { validEmail } from "@/lib/address";
|
||||
import { query } from "@/lib/db";
|
||||
|
||||
function back(message: string, ok = false): never {
|
||||
redirect(`/suppressions?${ok ? "ok" : "error"}=${encodeURIComponent(message)}`);
|
||||
}
|
||||
|
||||
export async function addSuppression(formData: FormData) {
|
||||
const email = String(formData.get("email") ?? "").trim().toLowerCase();
|
||||
const reason = String(formData.get("reason") ?? "manual").trim();
|
||||
if (!validEmail(email)) back("Ungültige E-Mail-Adresse");
|
||||
await query(
|
||||
`insert into suppressions (email, reason)
|
||||
values ($1, $2)
|
||||
on conflict (email) do update set reason = excluded.reason`,
|
||||
[email, reason || "manual"],
|
||||
);
|
||||
revalidatePath("/suppressions");
|
||||
back("Empfänger gesperrt", true);
|
||||
}
|
||||
|
||||
export async function removeSuppression(formData: FormData) {
|
||||
const email = String(formData.get("email") ?? "").trim().toLowerCase();
|
||||
if (!email) back("E-Mail-Adresse fehlt");
|
||||
await query(`delete from suppressions where email = $1`, [email]);
|
||||
revalidatePath("/suppressions");
|
||||
back("Empfänger entsperrt", true);
|
||||
}
|
||||
@@ -0,0 +1,195 @@
|
||||
import Link from "next/link";
|
||||
import { Ban } from "lucide-react";
|
||||
|
||||
import { EmptyState } from "@/app/empty-state";
|
||||
import { PageHeader } from "@/app/page-header";
|
||||
import { datum } from "@/lib/format";
|
||||
import { listSuppressions } from "@/lib/queries";
|
||||
|
||||
import { addSuppression, removeSuppression } from "./actions";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
const REASONS: Record<string, string> = {
|
||||
hard_bounce: "Harter Bounce",
|
||||
complaint: "Beschwerde",
|
||||
manual: "Manuell",
|
||||
};
|
||||
|
||||
export default async function Suppressions({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ q?: string; error?: string; ok?: string }>;
|
||||
}) {
|
||||
const params = await searchParams;
|
||||
const q = String(params.q ?? "").trim();
|
||||
let rows: Awaited<ReturnType<typeof listSuppressions>> = [];
|
||||
let error = "";
|
||||
try {
|
||||
rows = await listSuppressions(q);
|
||||
} catch (cause) {
|
||||
error = cause instanceof Error ? cause.message : "Datenbank nicht erreichbar";
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<PageHeader
|
||||
title="Suppressions"
|
||||
lead="Adressen, an die Courier nicht mehr sendet – nach hartem Bounce, Beschwerde oder manueller Sperre."
|
||||
actions={
|
||||
<Link className="ds-button ds-button--secondary ds-button--sm" href="#neu">
|
||||
Empfänger sperren
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
|
||||
{params.error ? (
|
||||
<div className="ds-alert ds-alert--danger" role="alert">
|
||||
<div>
|
||||
<p className="ds-alert__title">Nicht gespeichert</p>
|
||||
<p className="ds-alert__text">{params.error}</p>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
{params.ok ? (
|
||||
<div className="ds-alert ds-alert--success" role="status">
|
||||
<div>
|
||||
<p className="ds-alert__title">Gespeichert</p>
|
||||
<p className="ds-alert__text">{params.ok}</p>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<form className="app-toolbar app-toolbar--compact" method="get">
|
||||
<div className="ds-field">
|
||||
<label className="ds-visually-hidden" htmlFor="q">
|
||||
Suche
|
||||
</label>
|
||||
<input
|
||||
className="ds-input"
|
||||
id="q"
|
||||
name="q"
|
||||
defaultValue={q}
|
||||
placeholder="E-Mail oder Grund…"
|
||||
/>
|
||||
</div>
|
||||
<div className="app-toolbar__actions">
|
||||
<button className="ds-button ds-button--secondary" type="submit">
|
||||
Suchen
|
||||
</button>
|
||||
{q ? (
|
||||
<Link className="ds-button ds-button--secondary" href="/suppressions">
|
||||
Zurücksetzen
|
||||
</Link>
|
||||
) : null}
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{error ? (
|
||||
<div className="ds-alert ds-alert--danger" role="alert">
|
||||
<div>
|
||||
<p className="ds-alert__title">Datenbank nicht erreichbar</p>
|
||||
<p className="ds-alert__text">{error}</p>
|
||||
</div>
|
||||
</div>
|
||||
) : rows.length ? (
|
||||
<section className="ds-card app-panel">
|
||||
<div className="app-table-scroll app-desktop-table">
|
||||
<table className="ds-table">
|
||||
<caption className="ds-visually-hidden">Gesperrte Empfänger</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>E-Mail</th>
|
||||
<th>Grund</th>
|
||||
<th>Seit</th>
|
||||
<th />
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map((row) => (
|
||||
<tr key={row.email}>
|
||||
<td>{row.email}</td>
|
||||
<td>
|
||||
<span className="ds-badge ds-badge--danger">
|
||||
{REASONS[row.reason] ?? row.reason}
|
||||
</span>
|
||||
</td>
|
||||
<td className="app-mono">{datum(row.created_at)}</td>
|
||||
<td>
|
||||
<form action={removeSuppression}>
|
||||
<input type="hidden" name="email" value={row.email} />
|
||||
<button className="ds-button ds-button--secondary ds-button--sm" type="submit">
|
||||
Entsperren
|
||||
</button>
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div className="app-mobile-list">
|
||||
{rows.map((row) => (
|
||||
<article key={row.email} className="app-mobile-item">
|
||||
<div className="app-mobile-item__top">
|
||||
<span>{row.email}</span>
|
||||
<span className="ds-badge ds-badge--danger">
|
||||
{REASONS[row.reason] ?? row.reason}
|
||||
</span>
|
||||
</div>
|
||||
<div className="app-mobile-item__meta">
|
||||
<span className="app-mono">{datum(row.created_at)}</span>
|
||||
<form action={removeSuppression}>
|
||||
<input type="hidden" name="email" value={row.email} />
|
||||
<button className="ds-button ds-button--secondary ds-button--sm" type="submit">
|
||||
Entsperren
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
) : (
|
||||
<EmptyState
|
||||
icon={Ban}
|
||||
title={q ? "Keine Treffer" : "Keine gesperrten Empfänger"}
|
||||
text={
|
||||
q
|
||||
? "Keine Adresse passt zur Suche."
|
||||
: "Harte Bounces und Beschwerden landen automatisch hier."
|
||||
}
|
||||
/>
|
||||
)}
|
||||
|
||||
<section className="ds-card app-panel app-section" id="neu" aria-labelledby="neu-titel">
|
||||
<div className="app-panel__head">
|
||||
<h2 id="neu-titel">Empfänger manuell sperren</h2>
|
||||
</div>
|
||||
<form action={addSuppression} className="ds-stack app-form">
|
||||
<div className="ds-field">
|
||||
<label className="ds-field__label" htmlFor="email">
|
||||
E-Mail-Adresse
|
||||
</label>
|
||||
<input className="ds-input" id="email" name="email" type="email" required autoComplete="off" />
|
||||
</div>
|
||||
<div className="ds-field">
|
||||
<label className="ds-field__label" htmlFor="reason">
|
||||
Grund
|
||||
</label>
|
||||
<select className="ds-select" id="reason" name="reason" defaultValue="manual">
|
||||
<option value="manual">Manuell</option>
|
||||
<option value="hard_bounce">Harter Bounce</option>
|
||||
<option value="complaint">Beschwerde</option>
|
||||
</select>
|
||||
</div>
|
||||
<div className="app-actions">
|
||||
<button className="ds-button" type="submit">
|
||||
Sperren
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export function ThemeToggle() {
|
||||
const [dark, setDark] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const read = () => setDark(document.documentElement.dataset.theme === "dark");
|
||||
read();
|
||||
const onChange = () => read();
|
||||
window.addEventListener("courier-theme", onChange);
|
||||
return () => window.removeEventListener("courier-theme", onChange);
|
||||
}, []);
|
||||
|
||||
function toggle() {
|
||||
const next = dark ? "light" : "dark";
|
||||
document.documentElement.dataset.theme = next;
|
||||
try {
|
||||
localStorage.setItem("courier-theme", next);
|
||||
} catch {
|
||||
// Privater Modus: die Wahl gilt nur für diese Sitzung.
|
||||
}
|
||||
setDark(!dark);
|
||||
window.dispatchEvent(new Event("courier-theme"));
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="app-theme-toggle"
|
||||
onClick={toggle}
|
||||
aria-pressed={dark}
|
||||
aria-label={dark ? "Hellen Modus einschalten" : "Dunklen Modus einschalten"}
|
||||
>
|
||||
{dark ? "Hell" : "Dunkel"}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
create table if not exists domains (
|
||||
domain text primary key,
|
||||
status text not null default 'pending',
|
||||
dkim_tokens jsonb,
|
||||
mail_from_domain text,
|
||||
mail_from_status text,
|
||||
last_checked_at timestamptz,
|
||||
created_at timestamptz not null default now()
|
||||
);
|
||||
|
||||
insert into domains (domain, status)
|
||||
values ('hubsport.club', 'pending')
|
||||
on conflict (domain) do nothing;
|
||||
@@ -7,6 +7,18 @@ export function datum(value: string | Date | null | undefined): string {
|
||||
}).format(new Date(value));
|
||||
}
|
||||
|
||||
export function relativ(value: string | Date | null | undefined): string {
|
||||
if (!value) return "–";
|
||||
const diff = (new Date(value).getTime() - Date.now()) / 1000;
|
||||
const rtf = new Intl.RelativeTimeFormat("de", { numeric: "auto", style: "short" });
|
||||
const abs = Math.abs(diff);
|
||||
if (abs < 60) return rtf.format(Math.round(diff), "second");
|
||||
if (abs < 3600) return rtf.format(Math.round(diff / 60), "minute");
|
||||
if (abs < 86400) return rtf.format(Math.round(diff / 3600), "hour");
|
||||
if (abs < 30 * 86400) return rtf.format(Math.round(diff / 86400), "day");
|
||||
return datum(value);
|
||||
}
|
||||
|
||||
export function kurz(value: string, max = 42): string {
|
||||
return value.length > max ? `${value.slice(0, max - 1)}…` : value;
|
||||
}
|
||||
+78
-10
@@ -28,18 +28,45 @@ export async function dashboardStats() {
|
||||
return { counts, recent: recent.rows, suppressed: Number(suppressed.rows[0]?.count ?? 0) };
|
||||
}
|
||||
|
||||
export async function listMessages(status: string | undefined, limit = 100) {
|
||||
export type MessageFilters = {
|
||||
status?: string;
|
||||
q?: string;
|
||||
days?: number;
|
||||
keyId?: string;
|
||||
limit?: number;
|
||||
};
|
||||
|
||||
export async function listMessages(filters: MessageFilters = {}) {
|
||||
const params: unknown[] = [];
|
||||
let where = "";
|
||||
if (status) {
|
||||
params.push(status);
|
||||
where = `where status = $${params.length}`;
|
||||
const where: string[] = [];
|
||||
|
||||
if (filters.status) {
|
||||
params.push(filters.status);
|
||||
where.push(`status = $${params.length}`);
|
||||
}
|
||||
if (filters.keyId) {
|
||||
params.push(filters.keyId);
|
||||
where.push(`api_key_id = $${params.length}`);
|
||||
}
|
||||
if (filters.q) {
|
||||
params.push(`%${filters.q}%`);
|
||||
const n = params.length;
|
||||
where.push(
|
||||
`(subject ILIKE $${n} OR from_email ILIKE $${n} OR array_to_string(to_emails, ' ') ILIKE $${n} OR id::text ILIKE $${n} OR provider_message_id ILIKE $${n})`,
|
||||
);
|
||||
}
|
||||
if (filters.days && filters.days > 0) {
|
||||
params.push(filters.days);
|
||||
where.push(`created_at >= now() - ($${params.length} || ' days')::interval`);
|
||||
}
|
||||
|
||||
const limit = Math.min(Math.max(filters.limit ?? 100, 1), 10000);
|
||||
params.push(limit);
|
||||
const { rows } = await query<{
|
||||
id: string;
|
||||
app: string;
|
||||
subject: string;
|
||||
from_email: string;
|
||||
to_emails: string[];
|
||||
status: string;
|
||||
attempts: number;
|
||||
@@ -47,9 +74,9 @@ export async function listMessages(status: string | undefined, limit = 100) {
|
||||
completed_at: string | null;
|
||||
error: string | null;
|
||||
}>(
|
||||
`select id, app, subject, to_emails, status, attempts, created_at, completed_at, error
|
||||
`select id, app, subject, from_email, to_emails, status, attempts, created_at, completed_at, error
|
||||
from messages
|
||||
${where}
|
||||
${where.length ? `where ${where.join(" and ")}` : ""}
|
||||
order by created_at desc
|
||||
limit $${params.length}`,
|
||||
params,
|
||||
@@ -103,10 +130,51 @@ export async function listApiKeys() {
|
||||
return rows;
|
||||
}
|
||||
|
||||
export async function listSuppressions(limit = 100) {
|
||||
export async function listSuppressions(q?: string, limit = 200) {
|
||||
const params: unknown[] = [];
|
||||
let where = "";
|
||||
if (q) {
|
||||
params.push(`%${q}%`);
|
||||
where = `where email ILIKE $1 or reason ILIKE $1`;
|
||||
}
|
||||
params.push(limit);
|
||||
const { rows } = await query<{ email: string; reason: string; created_at: string }>(
|
||||
`select email, reason, created_at from suppressions order by created_at desc limit $1`,
|
||||
[limit],
|
||||
`select email, reason, created_at from suppressions ${where} order by created_at desc limit $${params.length}`,
|
||||
params,
|
||||
);
|
||||
return rows;
|
||||
}
|
||||
|
||||
|
||||
export type DailyMetric = {
|
||||
day: string;
|
||||
total: number;
|
||||
delivered: number;
|
||||
bounced: number;
|
||||
complained: number;
|
||||
failed: number;
|
||||
};
|
||||
|
||||
export async function dailyMetrics(days = 14, keyId = ""): Promise<DailyMetric[]> {
|
||||
const span = Math.min(Math.max(days, 1), 90);
|
||||
const { rows } = await query<DailyMetric>(
|
||||
`with days as (
|
||||
select generate_series(current_date - ($1::int - 1), current_date, interval '1 day')::date as day
|
||||
)
|
||||
select to_char(d.day, 'YYYY-MM-DD') as day,
|
||||
count(m.id)::int as total,
|
||||
count(m.id) filter (where m.status = 'delivered')::int as delivered,
|
||||
count(m.id) filter (where m.status = 'bounced')::int as bounced,
|
||||
count(m.id) filter (where m.status = 'complained')::int as complained,
|
||||
count(m.id) filter (where m.status = 'failed')::int as failed
|
||||
from days d
|
||||
left join messages m
|
||||
on m.created_at >= d.day
|
||||
and m.created_at < d.day + interval '1 day'
|
||||
and ($2::uuid is null or m.api_key_id = $2)
|
||||
group by d.day
|
||||
order by d.day`,
|
||||
[span, keyId || null],
|
||||
);
|
||||
return rows;
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
import {
|
||||
CreateEmailIdentityCommand,
|
||||
GetAccountCommand,
|
||||
GetEmailIdentityCommand,
|
||||
ListEmailIdentitiesCommand,
|
||||
PutEmailIdentityMailFromAttributesCommand,
|
||||
SESv2Client,
|
||||
} from "@aws-sdk/client-sesv2";
|
||||
|
||||
import { config } from "./config";
|
||||
import { query } from "./db";
|
||||
|
||||
const client = new SESv2Client({ region: config.awsRegion });
|
||||
|
||||
export type DomainRow = {
|
||||
domain: string;
|
||||
status: string;
|
||||
dkim_tokens: string[] | null;
|
||||
mail_from_domain: string | null;
|
||||
mail_from_status: string | null;
|
||||
last_checked_at: string | null;
|
||||
created_at: string;
|
||||
};
|
||||
|
||||
const DOMAIN = /^(?=.{1,253}$)([a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,}$/;
|
||||
|
||||
export function normalizeDomain(value: string): string {
|
||||
return value.trim().toLowerCase().replace(/\.$/, "");
|
||||
}
|
||||
|
||||
export function validDomain(value: string): boolean {
|
||||
return DOMAIN.test(normalizeDomain(value));
|
||||
}
|
||||
|
||||
async function upsertDomain(domain: string, detail: Awaited<ReturnType<typeof getIdentity>>) {
|
||||
const status = detail.VerifiedForSendingStatus ? "verified" : "pending";
|
||||
const tokens = detail.DkimAttributes?.Tokens ?? null;
|
||||
const mailFrom = detail.MailFromAttributes?.MailFromDomain ?? null;
|
||||
const mailFromStatus = detail.MailFromAttributes?.MailFromDomainStatus ?? null;
|
||||
await query(
|
||||
`insert into domains (domain, status, dkim_tokens, mail_from_domain, mail_from_status, last_checked_at)
|
||||
values ($1,$2,$3,$4,$5,now())
|
||||
on conflict (domain) do update set
|
||||
status = excluded.status,
|
||||
dkim_tokens = excluded.dkim_tokens,
|
||||
mail_from_domain = excluded.mail_from_domain,
|
||||
mail_from_status = excluded.mail_from_status,
|
||||
last_checked_at = now()`,
|
||||
[domain, status, JSON.stringify(tokens), mailFrom, mailFromStatus],
|
||||
);
|
||||
}
|
||||
|
||||
async function getIdentity(domain: string) {
|
||||
return client.send(new GetEmailIdentityCommand({ EmailIdentity: domain }));
|
||||
}
|
||||
|
||||
export async function syncDomains(): Promise<DomainRow[]> {
|
||||
const list = await client.send(new ListEmailIdentitiesCommand({ PageSize: 100 }));
|
||||
for (const identity of list.EmailIdentities ?? []) {
|
||||
if (identity.IdentityType !== "DOMAIN" || !identity.IdentityName) continue;
|
||||
try {
|
||||
const detail = await getIdentity(identity.IdentityName);
|
||||
await upsertDomain(identity.IdentityName, detail);
|
||||
} catch {
|
||||
// Einzelne Identities dürfen die Übersicht nicht blockieren.
|
||||
}
|
||||
}
|
||||
return listDomainRows();
|
||||
}
|
||||
|
||||
export async function listDomainRows(): Promise<DomainRow[]> {
|
||||
const { rows } = await query<DomainRow>(`select * from domains order by domain`);
|
||||
return rows;
|
||||
}
|
||||
|
||||
export async function getDomainRow(domain: string): Promise<DomainRow | null> {
|
||||
const { rows } = await query<DomainRow>(`select * from domains where domain = $1`, [domain]);
|
||||
return rows[0] ?? null;
|
||||
}
|
||||
|
||||
export async function verifyDomain(domain: string): Promise<DomainRow | null> {
|
||||
try {
|
||||
const detail = await getIdentity(domain);
|
||||
await upsertDomain(domain, detail);
|
||||
} catch {
|
||||
return getDomainRow(domain);
|
||||
}
|
||||
return getDomainRow(domain);
|
||||
}
|
||||
|
||||
export async function createDomainIdentity(domain: string): Promise<DomainRow> {
|
||||
const normalized = normalizeDomain(domain);
|
||||
let detail: Awaited<ReturnType<typeof getIdentity>>;
|
||||
try {
|
||||
await client.send(new CreateEmailIdentityCommand({ EmailIdentity: normalized }));
|
||||
detail = await getIdentity(normalized);
|
||||
} catch (error) {
|
||||
if ((error as Error).name !== "AlreadyExistsException") throw error;
|
||||
detail = await getIdentity(normalized);
|
||||
}
|
||||
|
||||
try {
|
||||
await client.send(
|
||||
new PutEmailIdentityMailFromAttributesCommand({
|
||||
EmailIdentity: normalized,
|
||||
MailFromDomain: `bounce.${normalized}`,
|
||||
BehaviorOnMxFailure: "USE_DEFAULT_VALUE",
|
||||
}),
|
||||
);
|
||||
detail = await getIdentity(normalized);
|
||||
} catch {
|
||||
// MAIL FROM ist optional; die Identity bleibt nutzbar.
|
||||
}
|
||||
|
||||
await upsertDomain(normalized, detail);
|
||||
const row = await getDomainRow(normalized);
|
||||
if (!row) throw new Error("Domain konnte nicht gespeichert werden");
|
||||
return row;
|
||||
}
|
||||
|
||||
export async function sesAccountStatus() {
|
||||
try {
|
||||
const account = await client.send(new GetAccountCommand({}));
|
||||
return {
|
||||
production: account.ProductionAccessEnabled ?? false,
|
||||
max24h: account.SendQuota?.Max24HourSend ?? 0,
|
||||
rate: account.SendQuota?.MaxSendRate ?? 0,
|
||||
};
|
||||
} catch {
|
||||
return { production: false, max24h: 0, rate: 0 };
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -2,7 +2,7 @@ apiVersion: v2
|
||||
name: courier
|
||||
description: Transaktionsmail-Gateway für hubsport.club über Amazon SES.
|
||||
type: application
|
||||
version: 26.11.1
|
||||
appVersion: "26.11.1"
|
||||
version: 26.11.10
|
||||
appVersion: "26.11.10"
|
||||
icon: https://git.aimighty.olares.de/aimighty/courier/raw/branch/main/icon.png
|
||||
home: https://git.aimighty.olares.de/aimighty/courier
|
||||
@@ -12,7 +12,7 @@ metadata:
|
||||
title: Courier
|
||||
description: Transaktionsmail für deine Apps über Amazon SES.
|
||||
icon: https://git.aimighty.olares.de/aimighty/courier/raw/branch/main/icon.png
|
||||
version: 26.11.1
|
||||
version: 26.11.10
|
||||
categories:
|
||||
- Applications
|
||||
|
||||
@@ -106,7 +106,7 @@ envs:
|
||||
default: "1000"
|
||||
|
||||
spec:
|
||||
versionName: '26.11.1'
|
||||
versionName: '26.11.10'
|
||||
fullDescription: |
|
||||
**Courier** ist ein kleiner Versanddienst für transaktionale E-Mails:
|
||||
eine Resend-kompatible HTTP-API, Warteschlange, Retry, Logs und
|
||||
|
||||
@@ -16,7 +16,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: courier
|
||||
image: "{{ .Values.images.registry }}/courier:{{ .Values.images.tag | default .Chart.AppVersion }}"
|
||||
image: "{{ .Values.images.registry }}/{{ .Values.images.repository | default "courier" }}:{{ .Values.images.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.images.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
|
||||
@@ -16,7 +16,7 @@ spec:
|
||||
spec:
|
||||
containers:
|
||||
- name: courier-worker
|
||||
image: "{{ .Values.images.registry }}/courier:{{ .Values.images.tag | default .Chart.AppVersion }}"
|
||||
image: "{{ .Values.images.registry }}/{{ .Values.images.repository | default "courier" }}:{{ .Values.images.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.images.pullPolicy }}
|
||||
command:
|
||||
- ./node_modules/.bin/tsx
|
||||
|
||||
@@ -6,6 +6,7 @@ workloads:
|
||||
|
||||
images:
|
||||
registry: git.aimighty.olares.de/aimighty
|
||||
repository: courier
|
||||
tag: ""
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
|
||||
Generated
+75
-4
@@ -1,15 +1,16 @@
|
||||
{
|
||||
"name": "courier",
|
||||
"version": "26.11.1",
|
||||
"version": "26.11.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "courier",
|
||||
"version": "26.11.1",
|
||||
"version": "26.11.5",
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-sesv2": "^3.1175.0",
|
||||
"geist": "^1.9.2",
|
||||
"lucide-react": "^1.78.0",
|
||||
"next": "15.5.29",
|
||||
"nodemailer": "^10.6.1",
|
||||
"pg": "^8.23.1",
|
||||
@@ -25,6 +26,7 @@
|
||||
"@types/pg": "^8.23.1",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"resend": "^6.39.0",
|
||||
"typescript": "^5"
|
||||
}
|
||||
},
|
||||
@@ -1503,6 +1505,13 @@
|
||||
"node": ">=18.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@stablelib/base64": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@stablelib/base64/-/base64-1.0.1.tgz",
|
||||
"integrity": "sha512-1bnPQqSxSuc3Ii6MhBysoWCg58j97aUjuCSZrGSmDxNqtytIi0k8utUenAwTZN4V5mXXYGsVUI9zeBqy+jBOSQ==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@swc/helpers": {
|
||||
"version": "0.5.15",
|
||||
"resolved": "https://registry.npmjs.org/@swc/helpers/-/helpers-0.5.15.tgz",
|
||||
@@ -1548,7 +1557,7 @@
|
||||
"version": "19.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz",
|
||||
"integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"csstype": "^3.2.2"
|
||||
@@ -1600,7 +1609,7 @@
|
||||
"version": "3.2.4",
|
||||
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.4.tgz",
|
||||
"integrity": "sha512-PoKaoPzQapnEoqUSnHx1u6W6ku8CVEgKsnpmmzU3m1nwkidpPBQ8V/Zq2+bWNrsOKoKLwTGdbx6xF7BXP1zLVQ==",
|
||||
"dev": true,
|
||||
"devOptional": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/detect-libc": {
|
||||
@@ -1654,6 +1663,13 @@
|
||||
"@esbuild/win32-x64": "0.28.2"
|
||||
}
|
||||
},
|
||||
"node_modules/fast-sha256": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/fast-sha256/-/fast-sha256-1.3.0.tgz",
|
||||
"integrity": "sha512-n11RGP/lrWEFI/bWdygLxhI+pVeo1ZYIVwvvPkW7azl/rOy+F3HYRZ2K5zeE9mmkhQppyv9sQFx0JM9UabnpPQ==",
|
||||
"dev": true,
|
||||
"license": "Unlicense"
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
@@ -1677,6 +1693,21 @@
|
||||
"next": ">=13.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/lucide-react": {
|
||||
"version": "1.78.0",
|
||||
"resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.78.0.tgz",
|
||||
"integrity": "sha512-61NFdT5ZfAY8xs3LWKkB78GVeuiCcjYFEXeHWxWP+mQhP+UWLGsA9hJZQPtIyXRDhOvT8kgmWwAIyH5L7RIhAA==",
|
||||
"license": "ISC",
|
||||
"peerDependencies": {
|
||||
"@types/react": "*",
|
||||
"react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@types/react": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/nanoid": {
|
||||
"version": "3.3.20",
|
||||
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz",
|
||||
@@ -1851,6 +1882,13 @@
|
||||
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/postal-mime": {
|
||||
"version": "2.7.6",
|
||||
"resolved": "https://registry.npmjs.org/postal-mime/-/postal-mime-2.7.6.tgz",
|
||||
"integrity": "sha512-UUlyE2KlxmvwMGq060onF/VWU3zD6dVW31FwokQ5v26jWd35fbs2MoTFzh+jXnPwAyV2MULMKXcBInGOl5TO6Q==",
|
||||
"dev": true,
|
||||
"license": "MIT-0"
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.31",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
|
||||
@@ -1939,6 +1977,28 @@
|
||||
"react": "^19.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/resend": {
|
||||
"version": "6.39.0",
|
||||
"resolved": "https://registry.npmjs.org/resend/-/resend-6.39.0.tgz",
|
||||
"integrity": "sha512-szNf/OR2I5rreOt5dQr7+aZLGFhkNJ0pSjzQIkU1oIrfh7kMZFDJQ3/Cc9s1yVeapafYFg0/aNyj41lsbHPeUw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"postal-mime": "2.7.6",
|
||||
"standardwebhooks": "1.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=20"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@react-email/render": "*"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@react-email/render": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/scheduler": {
|
||||
"version": "0.26.0",
|
||||
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz",
|
||||
@@ -2032,6 +2092,17 @@
|
||||
"node": ">= 10.x"
|
||||
}
|
||||
},
|
||||
"node_modules/standardwebhooks": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/standardwebhooks/-/standardwebhooks-1.1.1.tgz",
|
||||
"integrity": "sha512-bCbX9ZEyFkWPsRz7Bl3NuQUJohmwGSev/yhr7vhaGPlc4AfIrspIRa6cPTBuI1ItmrTDJ4d/S2hCsfe4+vQGnQ==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@stablelib/base64": "^1.0.0",
|
||||
"fast-sha256": "^1.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/styled-jsx": {
|
||||
"version": "5.1.6",
|
||||
"resolved": "https://registry.npmjs.org/styled-jsx/-/styled-jsx-5.1.6.tgz",
|
||||
|
||||
+6
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "courier",
|
||||
"version": "26.11.1",
|
||||
"version": "26.11.10",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -H 0.0.0.0 -p 3400",
|
||||
@@ -10,11 +10,14 @@
|
||||
"db:migrate": "node scripts/migrate.mjs",
|
||||
"db:key": "node scripts/create-key.mjs",
|
||||
"worker": "tsx scripts/worker.ts",
|
||||
"ses:records": "node scripts/ses-records.mjs"
|
||||
"ses:records": "node scripts/ses-records.mjs",
|
||||
"ses:dns": "node scripts/cloudflare-dns.mjs",
|
||||
"test:resend": "node scripts/test-resend.mjs"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-sesv2": "^3.1175.0",
|
||||
"geist": "^1.9.2",
|
||||
"lucide-react": "^1.78.0",
|
||||
"next": "15.5.29",
|
||||
"nodemailer": "^10.6.1",
|
||||
"pg": "^8.23.1",
|
||||
@@ -30,6 +33,7 @@
|
||||
"@types/pg": "^8.23.1",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"resend": "^6.39.0",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
import { SESv2Client, GetEmailIdentityCommand } from "@aws-sdk/client-sesv2";
|
||||
|
||||
const token = process.env.CLOUDFLARE_API_TOKEN;
|
||||
const zoneName = process.env.CLOUDFLARE_ZONE_NAME || "hubsport.club";
|
||||
const domain = process.env.MAIL_FROM_DOMAIN || zoneName;
|
||||
const region = process.env.AWS_REGION || "eu-west-1";
|
||||
|
||||
if (!token) {
|
||||
console.error("CLOUDFLARE_API_TOKEN fehlt (Zone → DNS → Edit für " + zoneName + ").");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const ses = new SESv2Client({ region });
|
||||
const identity = await ses.send(new GetEmailIdentityCommand({ EmailIdentity: domain }));
|
||||
const tokens = identity.DkimAttributes?.Tokens ?? [];
|
||||
if (tokens.length !== 3) {
|
||||
console.error(`Erwartet 3 DKIM-Tokens, bekommen: ${tokens.length}`);
|
||||
process.exit(1);
|
||||
}
|
||||
const mailFrom = identity.MailFromAttributes?.MailFromDomain ?? `bounce.${domain}`;
|
||||
|
||||
const api = "https://api.cloudflare.com/client/v4";
|
||||
async function call(method, path, body) {
|
||||
const response = await fetch(api + path, {
|
||||
method,
|
||||
headers: { authorization: `Bearer ${token}`, "content-type": "application/json" },
|
||||
body: body ? JSON.stringify(body) : undefined,
|
||||
});
|
||||
const data = await response.json();
|
||||
if (!data.success) throw new Error(`${method} ${path}: ${JSON.stringify(data.errors)}`);
|
||||
return data.result;
|
||||
}
|
||||
|
||||
const zones = await call("GET", `/zones?name=${encodeURIComponent(zoneName)}`);
|
||||
const zone = zones[0];
|
||||
if (!zone) throw new Error(`Zone ${zoneName} nicht gefunden oder Token ohne Zugriff`);
|
||||
|
||||
const records = [];
|
||||
for (const value of tokens) {
|
||||
records.push({
|
||||
type: "CNAME",
|
||||
name: `${value}._domainkey.${domain}`,
|
||||
content: `${value}.dkim.amazonses.com`,
|
||||
ttl: 3600,
|
||||
proxied: false,
|
||||
});
|
||||
}
|
||||
records.push({
|
||||
type: "MX",
|
||||
name: mailFrom,
|
||||
content: `feedback-smtp.${region}.amazonses.com`,
|
||||
priority: 10,
|
||||
ttl: 3600,
|
||||
proxied: false,
|
||||
});
|
||||
records.push({
|
||||
type: "TXT",
|
||||
name: mailFrom,
|
||||
content: "v=spf1 include:amazonses.com ~all",
|
||||
ttl: 3600,
|
||||
proxied: false,
|
||||
});
|
||||
records.push({
|
||||
type: "TXT",
|
||||
name: `_dmarc.${domain}`,
|
||||
content: "v=DMARC1; p=none;",
|
||||
ttl: 3600,
|
||||
proxied: false,
|
||||
});
|
||||
|
||||
for (const record of records) {
|
||||
const existing = await call(
|
||||
"GET",
|
||||
`/zones/${zone.id}/dns_records?type=${record.type}&name=${encodeURIComponent(record.name)}`,
|
||||
);
|
||||
const match = existing.find((item) => String(item.content).replace(/^"|"$/g, "") === record.content);
|
||||
if (match) {
|
||||
console.log(`ok ${record.type.padEnd(5)} ${record.name}`);
|
||||
continue;
|
||||
}
|
||||
await call("POST", `/zones/${zone.id}/dns_records`, record);
|
||||
console.log(`created ${record.type.padEnd(5)} ${record.name}`);
|
||||
}
|
||||
|
||||
console.log("\nDNS gesetzt. SES braucht für die Verifikation meist 1–5 Minuten.");
|
||||
+14
-3
@@ -23,9 +23,20 @@ const key = `ck_live_${randomBytes(24).toString("base64url")}`;
|
||||
const hash = createHmac("sha256", pepper).update(key).digest("hex");
|
||||
const prefix = key.slice(0, 16);
|
||||
|
||||
const url =
|
||||
process.env.DATABASE_URL ||
|
||||
`postgresql://courier@127.0.0.1:${process.env.DB_PORT || "55432"}/courier`;
|
||||
function databaseUrl() {
|
||||
if (process.env.DATABASE_URL) return process.env.DATABASE_URL;
|
||||
const host = process.env.DB_HOST;
|
||||
if (host) {
|
||||
const user = encodeURIComponent(process.env.DB_USER ?? "");
|
||||
const password = encodeURIComponent(process.env.DB_PASSWORD ?? "");
|
||||
const name = process.env.DB_NAME ?? "courier";
|
||||
const port = process.env.DB_PORT ?? "5432";
|
||||
return `postgresql://${user}:${password}@${host}:${port}/${name}`;
|
||||
}
|
||||
return `postgresql://courier@127.0.0.1:${process.env.DB_PORT || "55432"}/courier`;
|
||||
}
|
||||
|
||||
const url = databaseUrl();
|
||||
const client = new pg.Client({ connectionString: url });
|
||||
await client.connect();
|
||||
const { rows } = await client.query(
|
||||
|
||||
+14
-3
@@ -3,9 +3,20 @@ import { readdir, readFile } from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import pg from "pg";
|
||||
|
||||
const url =
|
||||
process.env.DATABASE_URL ||
|
||||
`postgresql://courier@127.0.0.1:${process.env.DB_PORT || "55432"}/courier`;
|
||||
function databaseUrl() {
|
||||
if (process.env.DATABASE_URL) return process.env.DATABASE_URL;
|
||||
const host = process.env.DB_HOST;
|
||||
if (host) {
|
||||
const user = encodeURIComponent(process.env.DB_USER ?? "");
|
||||
const password = encodeURIComponent(process.env.DB_PASSWORD ?? "");
|
||||
const name = process.env.DB_NAME ?? "courier";
|
||||
const port = process.env.DB_PORT ?? "5432";
|
||||
return `postgresql://${user}:${password}@${host}:${port}/${name}`;
|
||||
}
|
||||
return `postgresql://courier@127.0.0.1:${process.env.DB_PORT || "55432"}/courier`;
|
||||
}
|
||||
|
||||
const url = databaseUrl();
|
||||
|
||||
const client = new pg.Client({ connectionString: url });
|
||||
await client.connect();
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Resend } from "resend";
|
||||
|
||||
const key = process.env.COURIER_KEY;
|
||||
const baseUrl = process.env.COURIER_BASE_URL;
|
||||
if (!key || !baseUrl) {
|
||||
console.error("COURIER_KEY und COURIER_BASE_URL setzen");
|
||||
process.exit(1);
|
||||
}
|
||||
const resend = new Resend(key, { baseUrl });
|
||||
const { data, error } = await resend.emails.send({
|
||||
from: "plan <plan@hubsport.club>",
|
||||
to: "test@example.com",
|
||||
subject: "Resend-SDK gegen Courier",
|
||||
html: "<p>Hallo</p>",
|
||||
});
|
||||
console.log(error ? { error } : { data });
|
||||
@@ -0,0 +1,73 @@
|
||||
# Komponenten
|
||||
|
||||
HTML + CSS, framework-frei. Farben, Masse und Radius kommen ausschliesslich aus
|
||||
den `--ds-*`-Rollen. Kein JavaScript ausser dem, was die Plattform liefert
|
||||
(`<dialog>`, `<details>`, native Formularelemente).
|
||||
|
||||
## Einbinden
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" href="design-system/tokens/index.css">
|
||||
<link rel="stylesheet" href="design-system/components/index.css">
|
||||
```
|
||||
|
||||
## Dateien
|
||||
|
||||
| Datei | Inhalt |
|
||||
|---|---|
|
||||
| `base.css` | Box-Modell, Body, Fokus, Container, `ds-stack`/`ds-row`, `ds-divider`, reduced-motion |
|
||||
| `button.css` | `.ds-button` + secondary/ghost/danger, sm/md/lg, icon, loading |
|
||||
| `form.css` | Feld, Input, Textarea, Select, Checkbox/Radio, Switch, Auswahl-Chips, Fehlermeldung |
|
||||
| `data.css` | Karte mit Aktionsfuß, Kennzahl, Tabelle, Badge, Alert, Empty, Skeleton, Progress |
|
||||
| `overlay.css` | Dialog (`<dialog>`), Menü, Toast |
|
||||
| `navigation.css` | Skip-Link, Nav, Tabs, Breadcrumb, Pagination |
|
||||
|
||||
## Verträge
|
||||
|
||||
**Knopf** — `class="ds-button"`, Variante als `ds-button--secondary|ghost|danger`,
|
||||
Grösse als `--sm|--lg`, Icon-only als `--icon` mit `aria-label`. Laden:
|
||||
`data-loading="true"` oder `aria-busy="true"` + Spinner; auf grobem Zeiger
|
||||
sind alle Knöpfe und Felder mindestens 44px hoch.
|
||||
|
||||
**Feld** — `.ds-field` → `.ds-field__label` (`for`), Control, `.ds-field__hint`,
|
||||
bei Fehler `.ds-field--invalid` + `.ds-field__error` (`id`) und
|
||||
`aria-describedby`/`aria-invalid` am Control.
|
||||
|
||||
**Auswahl-Chip** — `.ds-choice-chips` + `.ds-choice-chip` als
|
||||
`<button type="button" aria-pressed="false">`; mindestens 44px, Hinweis in
|
||||
`.ds-choice-chip__hint`, Häkchen in `.ds-choice-chip__mark`. Klicklogik und
|
||||
Textfeld-Synchronisation kommen von der App.
|
||||
|
||||
**Dialog** — natives `<dialog class="ds-dialog">`; öffnen mit `showModal()`,
|
||||
schliessen mit `close()` oder `<form method="dialog">`. Fokusfalle und `Esc`
|
||||
kommen vom Browser.
|
||||
|
||||
**Aktionskarte** — `.ds-card` + `.ds-card__footer`, darin `.ds-card__meta`
|
||||
(links) und `.ds-card__actions` (rechts). Die Fußzeile bricht mobil in eine
|
||||
Spalte; ein offenes `<details>` nimmt die volle Breite ein.
|
||||
|
||||
**Menü** — `.ds-menu[role="menu"]` (mit `aria-label`) +
|
||||
`.ds-menu__item[role="menuitem"]`. Pfeiltasten und `Esc` sind **nicht** enthalten
|
||||
und müssen ergänzt werden. Deaktivierte Einträge sind `<span>`, nicht
|
||||
`<a href>` — sonst bleiben sie fokussierbar und auslösbar.
|
||||
|
||||
**Toast** — `.ds-toast-region` (fixiert) mit `.ds-toast[role="status"]` bzw.
|
||||
`role="alert"` für Fehler.
|
||||
|
||||
**Tabs** — `.ds-tabs[role="tablist"]` (mit `aria-label`),
|
||||
`.ds-tab[role="tab"]` mit `aria-selected`; Pfeiltasten und Panel-Verknüpfung
|
||||
ergänzen.
|
||||
|
||||
**Pagination** — `.ds-pagination__item`; deaktivierte Seiten als
|
||||
`<span aria-disabled="true">`, nicht als Link.
|
||||
|
||||
## Druck
|
||||
|
||||
`print.css` liefert `.ds-no-print` (Bedienung ausblenden), `.ds-print-only`
|
||||
(nur auf Papier) und `.ds-print-break` (Seitenumbruch). Regeln:
|
||||
`references/print.md`.
|
||||
|
||||
## Prüfen
|
||||
|
||||
`gallery.html` zeigt alle Varianten und Zustände. Hell/Dunkel:
|
||||
`?theme=dark`. Dialog geöffnet: `?dialog=open`.
|
||||
@@ -0,0 +1,130 @@
|
||||
/* Grundlage — setzt nur, was jede Ansicht braucht. Kein Voll-Reset. */
|
||||
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html {
|
||||
-webkit-text-size-adjust: 100%;
|
||||
text-size-adjust: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
background: var(--ds-bg);
|
||||
color: var(--ds-text);
|
||||
font-family: var(--ds-font-sans);
|
||||
font-size: var(--ds-text-md);
|
||||
line-height: var(--ds-leading-normal);
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
h1, h2, h3, h4, h5, h6 {
|
||||
line-height: var(--ds-leading-tight);
|
||||
letter-spacing: var(--ds-tracking-tight);
|
||||
text-wrap: balance;
|
||||
}
|
||||
|
||||
p {
|
||||
text-wrap: pretty;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--ds-link);
|
||||
text-decoration-thickness: 0.0625rem;
|
||||
text-underline-offset: 0.2em;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: var(--ds-link-hover);
|
||||
}
|
||||
|
||||
img, svg, video, canvas {
|
||||
display: block;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
svg {
|
||||
color: inherit;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.ds-icon {
|
||||
width: var(--ds-icon-md);
|
||||
height: var(--ds-icon-md);
|
||||
}
|
||||
|
||||
button, input, select, textarea {
|
||||
font: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
::selection {
|
||||
background: var(--ds-selection-bg);
|
||||
color: var(--ds-selection-text);
|
||||
}
|
||||
|
||||
:focus-visible {
|
||||
outline: var(--ds-focus-width) solid var(--ds-focus-ring);
|
||||
outline-offset: var(--ds-focus-offset);
|
||||
}
|
||||
|
||||
.ds-visually-hidden {
|
||||
position: absolute;
|
||||
width: 0.0625rem;
|
||||
height: 0.0625rem;
|
||||
padding: 0;
|
||||
margin: -0.0625rem;
|
||||
overflow: hidden;
|
||||
clip: rect(0 0 0 0);
|
||||
white-space: nowrap;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.ds-container {
|
||||
width: 100%;
|
||||
max-width: var(--ds-container-lg);
|
||||
margin-inline: auto;
|
||||
padding-inline: var(--ds-space-4);
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
.ds-container {
|
||||
padding-inline: var(--ds-space-6);
|
||||
}
|
||||
}
|
||||
|
||||
.ds-stack {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-space-4);
|
||||
}
|
||||
|
||||
.ds-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--ds-space-2);
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
animation-duration: 1ms !important;
|
||||
animation-iteration-count: 1 !important;
|
||||
transition-duration: 1ms !important;
|
||||
}
|
||||
}
|
||||
|
||||
.ds-divider {
|
||||
margin: var(--ds-space-6) 0 var(--ds-space-4);
|
||||
border: 0;
|
||||
border-top: var(--ds-border-thin) solid var(--ds-border);
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
.ds-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: var(--ds-space-2);
|
||||
min-height: var(--ds-control-md);
|
||||
padding-inline: var(--ds-space-4);
|
||||
border: var(--ds-border-thin) solid var(--ds-action-border);
|
||||
border-radius: var(--ds-radius-control);
|
||||
background: var(--ds-action-bg);
|
||||
color: var(--ds-action-text);
|
||||
font-size: var(--ds-text-sm);
|
||||
font-weight: var(--ds-weight-medium);
|
||||
line-height: var(--ds-leading-snug);
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
transition: background-color var(--ds-duration-fast) var(--ds-ease-standard),
|
||||
border-color var(--ds-duration-fast) var(--ds-ease-standard),
|
||||
color var(--ds-duration-fast) var(--ds-ease-standard);
|
||||
}
|
||||
|
||||
a.ds-button:link,
|
||||
a.ds-button:visited {
|
||||
color: var(--ds-action-text);
|
||||
}
|
||||
|
||||
a.ds-button--secondary:link,
|
||||
a.ds-button--secondary:visited {
|
||||
color: var(--ds-action2-text);
|
||||
}
|
||||
|
||||
a.ds-button--ghost:link,
|
||||
a.ds-button--ghost:visited {
|
||||
color: var(--ds-action3-text);
|
||||
}
|
||||
|
||||
a.ds-button--danger:link,
|
||||
a.ds-button--danger:visited {
|
||||
color: var(--ds-danger-action-text);
|
||||
}
|
||||
|
||||
.ds-button:hover:not(:disabled, [aria-disabled="true"]) {
|
||||
background: var(--ds-action-bg-hover);
|
||||
}
|
||||
|
||||
.ds-button:active:not(:disabled, [aria-disabled="true"]) {
|
||||
background: var(--ds-action-bg-active);
|
||||
}
|
||||
|
||||
.ds-button:disabled,
|
||||
.ds-button[aria-disabled="true"] {
|
||||
background: var(--ds-disabled-bg);
|
||||
border-color: var(--ds-disabled-border);
|
||||
color: var(--ds-disabled-text);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.ds-button--secondary {
|
||||
background: var(--ds-action2-bg);
|
||||
border-color: var(--ds-action2-border);
|
||||
color: var(--ds-action2-text);
|
||||
}
|
||||
|
||||
.ds-button--secondary:hover:not(:disabled, [aria-disabled="true"]) {
|
||||
background: var(--ds-action2-bg-hover);
|
||||
border-color: var(--ds-action2-border-hover);
|
||||
}
|
||||
|
||||
.ds-button--ghost {
|
||||
background: transparent;
|
||||
border-color: transparent;
|
||||
color: var(--ds-action3-text);
|
||||
}
|
||||
|
||||
.ds-button--ghost:hover:not(:disabled, [aria-disabled="true"]) {
|
||||
background: var(--ds-action3-bg-hover);
|
||||
color: var(--ds-text);
|
||||
}
|
||||
|
||||
.ds-button--danger {
|
||||
background: var(--ds-danger-action-bg);
|
||||
border-color: var(--ds-danger-action-border);
|
||||
color: var(--ds-danger-action-text);
|
||||
}
|
||||
|
||||
.ds-button--danger:hover:not(:disabled, [aria-disabled="true"]) {
|
||||
background: var(--ds-danger-action-bg-hover);
|
||||
}
|
||||
|
||||
.ds-button--danger:active:not(:disabled, [aria-disabled="true"]) {
|
||||
background: var(--ds-danger-action-bg-active);
|
||||
}
|
||||
|
||||
.ds-button--sm {
|
||||
min-height: var(--ds-control-sm);
|
||||
padding-inline: var(--ds-space-3);
|
||||
font-size: var(--ds-text-xs);
|
||||
}
|
||||
|
||||
.ds-button--lg {
|
||||
min-height: var(--ds-control-lg);
|
||||
padding-inline: var(--ds-space-6);
|
||||
font-size: var(--ds-text-md);
|
||||
}
|
||||
|
||||
.ds-button--icon {
|
||||
width: var(--ds-control-lg);
|
||||
min-height: var(--ds-control-lg);
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.ds-button--icon.ds-button--sm {
|
||||
width: var(--ds-control-sm);
|
||||
min-height: var(--ds-control-sm);
|
||||
}
|
||||
|
||||
.ds-button--icon.ds-button--lg {
|
||||
width: var(--ds-control-lg);
|
||||
min-height: var(--ds-control-lg);
|
||||
}
|
||||
|
||||
.ds-button .ds-icon {
|
||||
width: var(--ds-icon-md);
|
||||
height: var(--ds-icon-md);
|
||||
}
|
||||
|
||||
.ds-button--lg .ds-icon {
|
||||
width: var(--ds-icon-lg);
|
||||
height: var(--ds-icon-lg);
|
||||
}
|
||||
|
||||
.ds-button[data-loading="true"],
|
||||
.ds-button[aria-busy="true"] {
|
||||
pointer-events: none;
|
||||
cursor: progress;
|
||||
}
|
||||
|
||||
.ds-button[data-loading="true"] .ds-button__icon,
|
||||
.ds-button[aria-busy="true"] .ds-button__icon {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ds-button:not([data-loading="true"]):not([aria-busy="true"]) .ds-spinner {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ds-spinner {
|
||||
width: var(--ds-icon-sm);
|
||||
height: var(--ds-icon-sm);
|
||||
border: var(--ds-border-strong) solid currentColor;
|
||||
border-right-color: transparent;
|
||||
border-radius: var(--ds-radius-full);
|
||||
animation: ds-spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes ds-spin {
|
||||
to {
|
||||
transform: rotate(1turn);
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.ds-spinner {
|
||||
animation: none;
|
||||
border-right-color: currentColor;
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
.ds-button-group {
|
||||
display: inline-flex;
|
||||
gap: var(--ds-space-2);
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
@media (pointer: coarse) {
|
||||
.ds-button,
|
||||
.ds-button--sm,
|
||||
.ds-button--icon.ds-button--sm {
|
||||
min-height: var(--ds-target-touch);
|
||||
}
|
||||
|
||||
.ds-button--icon.ds-button--sm {
|
||||
width: var(--ds-target-touch);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,324 @@
|
||||
.ds-card {
|
||||
background: var(--ds-surface);
|
||||
border: var(--ds-border-thin) solid var(--ds-border);
|
||||
border-radius: var(--ds-radius-surface);
|
||||
padding: var(--ds-space-4);
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
.ds-card {
|
||||
padding: var(--ds-space-6);
|
||||
}
|
||||
}
|
||||
|
||||
.ds-card__title {
|
||||
font-size: var(--ds-text-lg);
|
||||
font-weight: var(--ds-weight-semibold);
|
||||
}
|
||||
|
||||
.ds-card__text {
|
||||
color: var(--ds-text-muted);
|
||||
font-size: var(--ds-text-sm);
|
||||
}
|
||||
|
||||
.ds-stat__value {
|
||||
font-size: var(--ds-text-3xl);
|
||||
font-weight: var(--ds-weight-bold);
|
||||
line-height: var(--ds-leading-tight);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.ds-stat__label {
|
||||
font-size: var(--ds-text-sm);
|
||||
color: var(--ds-text-muted);
|
||||
}
|
||||
|
||||
.ds-stat__meta {
|
||||
font-size: var(--ds-text-xs);
|
||||
color: var(--ds-text-subtle);
|
||||
}
|
||||
|
||||
.ds-table-wrap {
|
||||
max-width: 100%;
|
||||
overflow-x: auto;
|
||||
background: var(--ds-surface);
|
||||
border: var(--ds-border-thin) solid var(--ds-border);
|
||||
border-radius: var(--ds-radius-surface);
|
||||
}
|
||||
|
||||
.ds-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: var(--ds-text-sm);
|
||||
}
|
||||
|
||||
.ds-table th {
|
||||
height: var(--ds-control-md);
|
||||
padding-inline: var(--ds-space-3);
|
||||
border-bottom: var(--ds-border-thin) solid var(--ds-border);
|
||||
color: var(--ds-text-muted);
|
||||
font-size: var(--ds-text-xs);
|
||||
font-weight: var(--ds-weight-semibold);
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ds-table td {
|
||||
height: var(--ds-space-12);
|
||||
padding-inline: var(--ds-space-3);
|
||||
border-bottom: var(--ds-border-thin) solid var(--ds-border);
|
||||
color: var(--ds-text);
|
||||
}
|
||||
|
||||
.ds-table tbody tr:last-child td {
|
||||
border-bottom: 0;
|
||||
}
|
||||
|
||||
.ds-table tbody tr:hover {
|
||||
background: var(--ds-surface-hover);
|
||||
}
|
||||
|
||||
.ds-table--compact td {
|
||||
height: var(--ds-control-md);
|
||||
}
|
||||
|
||||
.ds-table--roomy td {
|
||||
height: 3.5rem;
|
||||
}
|
||||
|
||||
.ds-table__num {
|
||||
text-align: right;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
|
||||
.ds-table--sticky thead th {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: var(--ds-z-sticky);
|
||||
background: var(--ds-surface);
|
||||
}
|
||||
|
||||
.ds-table th[aria-sort="ascending"]::after,
|
||||
.ds-table th[aria-sort="descending"]::after {
|
||||
margin-inline-start: var(--ds-space-1);
|
||||
color: var(--ds-text-subtle);
|
||||
}
|
||||
|
||||
.ds-table th[aria-sort="ascending"]::after {
|
||||
content: "↑";
|
||||
}
|
||||
|
||||
.ds-table th[aria-sort="descending"]::after {
|
||||
content: "↓";
|
||||
}
|
||||
|
||||
.ds-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-space-1);
|
||||
min-height: 1.5rem;
|
||||
padding-inline: var(--ds-space-2);
|
||||
border: var(--ds-border-thin) solid transparent;
|
||||
border-radius: var(--ds-radius-full);
|
||||
background: var(--ds-surface-sunken);
|
||||
color: var(--ds-text-muted);
|
||||
font-size: var(--ds-text-xs);
|
||||
font-weight: var(--ds-weight-medium);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.ds-badge--success {
|
||||
background: var(--ds-success-surface);
|
||||
border-color: var(--ds-success-border);
|
||||
color: var(--ds-success);
|
||||
}
|
||||
|
||||
.ds-badge--warning {
|
||||
background: var(--ds-warning-surface);
|
||||
border-color: var(--ds-warning-border);
|
||||
color: var(--ds-warning);
|
||||
}
|
||||
|
||||
.ds-badge--danger {
|
||||
background: var(--ds-danger-surface);
|
||||
border-color: var(--ds-danger-border);
|
||||
color: var(--ds-danger);
|
||||
}
|
||||
|
||||
.ds-badge--info {
|
||||
background: var(--ds-info-surface);
|
||||
border-color: var(--ds-info-border);
|
||||
color: var(--ds-info);
|
||||
}
|
||||
|
||||
.ds-alert {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--ds-space-3);
|
||||
padding: var(--ds-space-3) var(--ds-space-4);
|
||||
border: var(--ds-border-thin) solid var(--ds-info-border);
|
||||
border-radius: var(--ds-radius-surface);
|
||||
background: var(--ds-info-surface);
|
||||
color: var(--ds-text);
|
||||
font-size: var(--ds-text-sm);
|
||||
}
|
||||
|
||||
.ds-alert__icon {
|
||||
width: var(--ds-icon-md);
|
||||
height: var(--ds-icon-md);
|
||||
color: var(--ds-info);
|
||||
}
|
||||
|
||||
.ds-alert__title {
|
||||
font-weight: var(--ds-weight-semibold);
|
||||
}
|
||||
|
||||
.ds-alert__text {
|
||||
color: var(--ds-text-muted);
|
||||
}
|
||||
|
||||
.ds-alert--success {
|
||||
background: var(--ds-success-surface);
|
||||
border-color: var(--ds-success-border);
|
||||
}
|
||||
|
||||
.ds-alert--success .ds-alert__icon {
|
||||
color: var(--ds-success);
|
||||
}
|
||||
|
||||
.ds-alert--warning {
|
||||
background: var(--ds-warning-surface);
|
||||
border-color: var(--ds-warning-border);
|
||||
}
|
||||
|
||||
.ds-alert--warning .ds-alert__icon {
|
||||
color: var(--ds-warning);
|
||||
}
|
||||
|
||||
.ds-alert--danger {
|
||||
background: var(--ds-danger-surface);
|
||||
border-color: var(--ds-danger-border);
|
||||
}
|
||||
|
||||
.ds-alert--danger .ds-alert__icon {
|
||||
color: var(--ds-danger);
|
||||
}
|
||||
|
||||
.ds-empty {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
gap: var(--ds-space-3);
|
||||
padding: var(--ds-space-12) var(--ds-space-6);
|
||||
border: var(--ds-border-strong) dashed var(--ds-border);
|
||||
border-radius: var(--ds-radius-surface);
|
||||
background: var(--ds-surface);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.ds-empty__icon {
|
||||
width: var(--ds-icon-xl);
|
||||
height: var(--ds-icon-xl);
|
||||
color: var(--ds-text-subtle);
|
||||
}
|
||||
|
||||
.ds-empty__title {
|
||||
font-size: var(--ds-text-lg);
|
||||
font-weight: var(--ds-weight-semibold);
|
||||
}
|
||||
|
||||
.ds-empty__text {
|
||||
max-width: var(--ds-measure);
|
||||
color: var(--ds-text-muted);
|
||||
font-size: var(--ds-text-sm);
|
||||
}
|
||||
|
||||
.ds-skeleton {
|
||||
background: var(--ds-border);
|
||||
border-radius: var(--ds-radius-sm);
|
||||
animation: ds-pulse 1.6s var(--ds-ease-standard) infinite;
|
||||
}
|
||||
|
||||
.ds-skeleton--text {
|
||||
height: 1em;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ds-skeleton--title {
|
||||
height: 1.5rem;
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
.ds-skeleton--block {
|
||||
height: 8rem;
|
||||
}
|
||||
|
||||
@keyframes ds-pulse {
|
||||
50% {
|
||||
opacity: 0.55;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.ds-skeleton {
|
||||
animation: none;
|
||||
opacity: 0.7;
|
||||
}
|
||||
}
|
||||
|
||||
.ds-progress {
|
||||
width: 100%;
|
||||
height: 0.5rem;
|
||||
overflow: hidden;
|
||||
background: var(--ds-surface-sunken);
|
||||
border-radius: var(--ds-radius-full);
|
||||
}
|
||||
|
||||
.ds-progress__bar {
|
||||
height: 100%;
|
||||
background: var(--ds-action-bg);
|
||||
border-radius: inherit;
|
||||
transition: width var(--ds-duration-base) var(--ds-ease-standard);
|
||||
}
|
||||
|
||||
.ds-card__footer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--ds-space-3);
|
||||
margin-top: var(--ds-space-3);
|
||||
padding-top: var(--ds-space-3);
|
||||
border-top: var(--ds-border-thin) solid var(--ds-border);
|
||||
}
|
||||
|
||||
.ds-card__meta {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-space-1);
|
||||
}
|
||||
|
||||
.ds-card__actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: var(--ds-space-2);
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.ds-card__actions > details[open] {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
@media (max-width: 48rem) {
|
||||
.ds-card__footer {
|
||||
align-items: flex-start;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ds-card__actions {
|
||||
justify-content: flex-start;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,317 @@
|
||||
.ds-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-space-1);
|
||||
max-width: 32rem;
|
||||
}
|
||||
|
||||
.ds-field__label {
|
||||
font-size: var(--ds-text-sm);
|
||||
font-weight: var(--ds-weight-medium);
|
||||
color: var(--ds-text);
|
||||
}
|
||||
|
||||
.ds-field__required {
|
||||
color: var(--ds-danger);
|
||||
margin-inline-start: var(--ds-space-1);
|
||||
}
|
||||
|
||||
.ds-field__hint {
|
||||
font-size: var(--ds-text-xs);
|
||||
color: var(--ds-text-muted);
|
||||
}
|
||||
|
||||
.ds-field__error {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--ds-space-1);
|
||||
font-size: var(--ds-text-xs);
|
||||
color: var(--ds-danger);
|
||||
}
|
||||
|
||||
.ds-field__error .ds-icon {
|
||||
width: var(--ds-icon-sm);
|
||||
height: var(--ds-icon-sm);
|
||||
margin-top: 0.125rem;
|
||||
}
|
||||
|
||||
.ds-input,
|
||||
.ds-textarea,
|
||||
.ds-select {
|
||||
width: 100%;
|
||||
min-height: var(--ds-control-md);
|
||||
padding: var(--ds-space-2) var(--ds-space-3);
|
||||
background: var(--ds-surface);
|
||||
border: var(--ds-border-thin) solid var(--ds-border-strong);
|
||||
border-radius: var(--ds-radius-control);
|
||||
color: var(--ds-text);
|
||||
font-size: var(--ds-text-sm);
|
||||
line-height: var(--ds-leading-normal);
|
||||
transition: border-color var(--ds-duration-fast) var(--ds-ease-standard);
|
||||
}
|
||||
|
||||
.ds-input::placeholder,
|
||||
.ds-textarea::placeholder {
|
||||
color: var(--ds-text-subtle);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.ds-input:hover:not(:disabled),
|
||||
.ds-textarea:hover:not(:disabled),
|
||||
.ds-select:hover:not(:disabled) {
|
||||
border-color: var(--ds-text-subtle);
|
||||
}
|
||||
|
||||
.ds-input:focus,
|
||||
.ds-textarea:focus,
|
||||
.ds-select:focus {
|
||||
border-color: var(--ds-border-focus);
|
||||
}
|
||||
|
||||
.ds-input:disabled,
|
||||
.ds-textarea:disabled,
|
||||
.ds-select:disabled {
|
||||
background: var(--ds-disabled-bg);
|
||||
border-color: var(--ds-disabled-border);
|
||||
color: var(--ds-disabled-text);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.ds-textarea {
|
||||
min-height: 6rem;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.ds-select {
|
||||
padding-inline-end: var(--ds-space-8);
|
||||
}
|
||||
|
||||
.ds-select-wrap {
|
||||
position: relative;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.ds-select-wrap > .ds-select {
|
||||
appearance: none;
|
||||
padding-inline-end: var(--ds-space-8);
|
||||
}
|
||||
|
||||
.ds-select__chevron {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
right: var(--ds-space-3);
|
||||
width: var(--ds-icon-sm);
|
||||
height: var(--ds-icon-sm);
|
||||
transform: translateY(-50%);
|
||||
color: var(--ds-text-muted);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.ds-field--invalid .ds-input,
|
||||
.ds-field--invalid .ds-textarea,
|
||||
.ds-field--invalid .ds-select,
|
||||
.ds-input[aria-invalid="true"],
|
||||
.ds-textarea[aria-invalid="true"],
|
||||
.ds-select[aria-invalid="true"] {
|
||||
border-color: var(--ds-danger);
|
||||
}
|
||||
|
||||
.ds-field--invalid .ds-input:focus,
|
||||
.ds-field--invalid .ds-textarea:focus,
|
||||
.ds-field--invalid .ds-select:focus,
|
||||
.ds-input[aria-invalid="true"]:focus,
|
||||
.ds-textarea[aria-invalid="true"]:focus,
|
||||
.ds-select[aria-invalid="true"]:focus {
|
||||
outline-color: var(--ds-danger);
|
||||
}
|
||||
|
||||
.ds-choice {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--ds-space-2);
|
||||
min-height: var(--ds-target-touch);
|
||||
padding-block: var(--ds-space-1);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ds-choice input {
|
||||
width: var(--ds-icon-md);
|
||||
height: var(--ds-icon-md);
|
||||
margin: 0;
|
||||
margin-top: 0.0625rem;
|
||||
accent-color: var(--ds-action-bg);
|
||||
cursor: pointer;
|
||||
flex: none;
|
||||
}
|
||||
|
||||
.ds-choice input:disabled {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.ds-choice__text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.125rem;
|
||||
}
|
||||
|
||||
.ds-choice__label {
|
||||
font-size: var(--ds-text-sm);
|
||||
color: var(--ds-text);
|
||||
}
|
||||
|
||||
.ds-choice__hint {
|
||||
font-size: var(--ds-text-xs);
|
||||
color: var(--ds-text-muted);
|
||||
}
|
||||
|
||||
.ds-fieldset {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.ds-fieldset__legend {
|
||||
padding: 0;
|
||||
margin-bottom: var(--ds-space-2);
|
||||
font-size: var(--ds-text-sm);
|
||||
font-weight: var(--ds-weight-medium);
|
||||
}
|
||||
|
||||
.ds-switch {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-space-3);
|
||||
min-height: var(--ds-target-touch);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ds-switch input {
|
||||
appearance: none;
|
||||
position: relative;
|
||||
width: 2.75rem;
|
||||
height: 1.5rem;
|
||||
margin: 0;
|
||||
background: var(--ds-border-strong);
|
||||
border: var(--ds-border-thin) solid transparent;
|
||||
border-radius: var(--ds-radius-full);
|
||||
cursor: pointer;
|
||||
flex: none;
|
||||
transition: background-color var(--ds-duration-fast) var(--ds-ease-standard);
|
||||
}
|
||||
|
||||
.ds-switch input::before {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: 0.125rem;
|
||||
left: 0.125rem;
|
||||
width: 1.125rem;
|
||||
height: 1.125rem;
|
||||
background: var(--ds-surface-raised);
|
||||
border-radius: var(--ds-radius-full);
|
||||
transition: transform var(--ds-duration-fast) var(--ds-ease-standard);
|
||||
}
|
||||
|
||||
.ds-switch input:checked {
|
||||
background: var(--ds-action-bg);
|
||||
}
|
||||
|
||||
.ds-switch input:checked::before {
|
||||
transform: translateX(1.25rem);
|
||||
}
|
||||
|
||||
.ds-switch input:disabled {
|
||||
background: var(--ds-disabled-bg);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.ds-switch input:checked:disabled {
|
||||
background: var(--ds-disabled-border);
|
||||
}
|
||||
|
||||
.ds-switch__label {
|
||||
font-size: var(--ds-text-sm);
|
||||
color: var(--ds-text);
|
||||
}
|
||||
|
||||
.ds-form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: var(--ds-space-4);
|
||||
}
|
||||
|
||||
@media (min-width: 48rem) {
|
||||
.ds-form-grid--2 {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (pointer: coarse) {
|
||||
.ds-input,
|
||||
.ds-textarea,
|
||||
.ds-select {
|
||||
min-height: var(--ds-target-touch);
|
||||
}
|
||||
}
|
||||
|
||||
.ds-choice-chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--ds-space-2);
|
||||
}
|
||||
|
||||
.ds-choice-chip {
|
||||
display: inline-flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
justify-content: center;
|
||||
gap: 0.125rem;
|
||||
min-height: var(--ds-target-touch);
|
||||
padding: var(--ds-space-2) var(--ds-space-3);
|
||||
border: var(--ds-border-thin) solid var(--ds-border-strong);
|
||||
border-radius: var(--ds-radius-control);
|
||||
background: var(--ds-surface);
|
||||
color: var(--ds-text);
|
||||
font-size: var(--ds-text-sm);
|
||||
line-height: var(--ds-leading-snug);
|
||||
text-align: left;
|
||||
cursor: pointer;
|
||||
transition: background-color var(--ds-duration-fast) var(--ds-ease-standard),
|
||||
border-color var(--ds-duration-fast) var(--ds-ease-standard),
|
||||
color var(--ds-duration-fast) var(--ds-ease-standard);
|
||||
}
|
||||
|
||||
.ds-choice-chip:hover:not(:disabled) {
|
||||
background: var(--ds-surface-hover);
|
||||
}
|
||||
|
||||
.ds-choice-chip[aria-pressed="true"] {
|
||||
border-color: var(--ds-action-bg);
|
||||
background: var(--ds-action-bg);
|
||||
color: var(--ds-action-text);
|
||||
}
|
||||
|
||||
.ds-choice-chip:disabled {
|
||||
background: var(--ds-disabled-bg);
|
||||
color: var(--ds-disabled-text);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.ds-choice-chip__mark {
|
||||
display: none;
|
||||
margin-inline-end: var(--ds-space-1);
|
||||
font-size: var(--ds-text-xs);
|
||||
}
|
||||
|
||||
.ds-choice-chip[aria-pressed="true"] .ds-choice-chip__mark {
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.ds-choice-chip__hint {
|
||||
color: var(--ds-text-muted);
|
||||
font-size: var(--ds-text-xs);
|
||||
}
|
||||
|
||||
.ds-choice-chip[aria-pressed="true"] .ds-choice-chip__hint {
|
||||
color: inherit;
|
||||
opacity: 0.85;
|
||||
}
|
||||
@@ -0,0 +1,354 @@
|
||||
<!doctype html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Design System — Komponenten</title>
|
||||
<link rel="stylesheet" href="../tokens/index.css">
|
||||
<link rel="stylesheet" href="index.css">
|
||||
<style>
|
||||
.demo-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--ds-space-4);
|
||||
padding-block: var(--ds-space-6);
|
||||
border-bottom: var(--ds-border-thin) solid var(--ds-border);
|
||||
margin-bottom: var(--ds-space-8);
|
||||
}
|
||||
.demo-title { font-size: var(--ds-text-3xl); font-weight: var(--ds-weight-bold); }
|
||||
.demo-section { margin-bottom: var(--ds-space-12); }
|
||||
.demo-section > h2 {
|
||||
font-size: var(--ds-text-2xl);
|
||||
margin-bottom: var(--ds-space-4);
|
||||
}
|
||||
.demo-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
|
||||
gap: var(--ds-space-4);
|
||||
}
|
||||
.demo-block {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-space-4);
|
||||
padding: var(--ds-space-4);
|
||||
border: var(--ds-border-thin) solid var(--ds-border);
|
||||
border-radius: var(--ds-radius-surface);
|
||||
background: var(--ds-surface);
|
||||
}
|
||||
.demo-label {
|
||||
font-size: var(--ds-text-xs);
|
||||
font-weight: var(--ds-weight-semibold);
|
||||
color: var(--ds-text-muted);
|
||||
}
|
||||
.demo-block > .ds-button {
|
||||
align-self: flex-start;
|
||||
}
|
||||
.demo-nav-layout {
|
||||
display: grid;
|
||||
grid-template-columns: 15rem minmax(0, 1fr);
|
||||
gap: var(--ds-space-6);
|
||||
}
|
||||
@media (max-width: 47.99rem) {
|
||||
.demo-nav-layout { grid-template-columns: 1fr; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="ds-container">
|
||||
<header class="demo-header">
|
||||
<div>
|
||||
<h1 class="demo-title">Design System</h1>
|
||||
<p style="color: var(--ds-text-muted)">Komponenten, Varianten und Zustände.</p>
|
||||
</div>
|
||||
<button class="ds-button ds-button--secondary" id="theme-toggle" type="button">Dunkel</button>
|
||||
</header>
|
||||
|
||||
<section class="demo-section">
|
||||
<h2>Knöpfe</h2>
|
||||
<div class="demo-grid">
|
||||
<div class="demo-block">
|
||||
<span class="demo-label">Varianten</span>
|
||||
<div class="ds-button-group">
|
||||
<button class="ds-button" type="button">Speichern</button>
|
||||
<button class="ds-button ds-button--secondary" type="button">Abbrechen</button>
|
||||
<button class="ds-button ds-button--ghost" type="button">Mehr</button>
|
||||
<button class="ds-button ds-button--danger" type="button">
|
||||
<svg class="ds-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M3 6h18"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"/><path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>
|
||||
Löschen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo-block">
|
||||
<span class="demo-label">Grössen</span>
|
||||
<div class="ds-row">
|
||||
<button class="ds-button ds-button--sm" type="button">Klein</button>
|
||||
<button class="ds-button" type="button">Mittel</button>
|
||||
<button class="ds-button ds-button--lg" type="button">Gross</button>
|
||||
</div>
|
||||
<div class="ds-row">
|
||||
<button class="ds-button ds-button--icon" type="button" aria-label="Hinzufügen">
|
||||
<svg class="ds-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M5 12h14"/><path d="M12 5v14"/></svg>
|
||||
</button>
|
||||
<button class="ds-button ds-button--secondary ds-button--icon" type="button" aria-label="Suchen">
|
||||
<svg class="ds-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo-block">
|
||||
<span class="demo-label">Zustände</span>
|
||||
<div class="ds-row">
|
||||
<button class="ds-button" type="button" data-loading="true" aria-busy="true">
|
||||
<span class="ds-spinner" aria-hidden="true"></span>
|
||||
Speichert
|
||||
</button>
|
||||
<button class="ds-button" type="button" disabled>Deaktiviert</button>
|
||||
<button class="ds-button ds-button--secondary" type="button" aria-disabled="true">Gesperrt</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="demo-section">
|
||||
<h2>Formulare</h2>
|
||||
<div class="demo-grid">
|
||||
<div class="demo-block ds-stack">
|
||||
<div class="ds-field">
|
||||
<label class="ds-field__label" for="demo-name">Name <span class="ds-field__required" aria-hidden="true">*</span></label>
|
||||
<input class="ds-input" id="demo-name" type="text" placeholder="Vor- und Nachname" required>
|
||||
<span class="ds-field__hint">Wie auf dem Ausweis.</span>
|
||||
</div>
|
||||
<div class="ds-field ds-field--invalid">
|
||||
<label class="ds-field__label" for="demo-mail">E-Mail</label>
|
||||
<input class="ds-input" id="demo-mail" type="email" value="falsch@" aria-invalid="true" aria-describedby="demo-mail-error">
|
||||
<span class="ds-field__error" id="demo-mail-error">
|
||||
<svg class="ds-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10"/><path d="M12 8v4"/><path d="M12 16h.01"/></svg>
|
||||
Bitte eine gültige Adresse eingeben.
|
||||
</span>
|
||||
</div>
|
||||
<div class="ds-field">
|
||||
<label class="ds-field__label" for="demo-role">Rolle</label>
|
||||
<select class="ds-select" id="demo-role">
|
||||
<option>Betrachter</option>
|
||||
<option>Bearbeiter</option>
|
||||
<option>Administrator</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ds-field">
|
||||
<label class="ds-field__label" for="demo-note">Notiz</label>
|
||||
<textarea class="ds-textarea" id="demo-note" placeholder="Kurz beschreiben …"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="demo-block ds-stack">
|
||||
<fieldset class="ds-fieldset">
|
||||
<legend class="ds-fieldset__legend">Benachrichtigungen</legend>
|
||||
<label class="ds-choice">
|
||||
<input type="checkbox" checked>
|
||||
<span class="ds-choice__text">
|
||||
<span class="ds-choice__label">E-Mail</span>
|
||||
<span class="ds-choice__hint">Täglich zusammengefasst.</span>
|
||||
</span>
|
||||
</label>
|
||||
<label class="ds-choice">
|
||||
<input type="checkbox">
|
||||
<span class="ds-choice__text">
|
||||
<span class="ds-choice__label">Push</span>
|
||||
<span class="ds-choice__hint">Nur bei wichtigen Ereignissen.</span>
|
||||
</span>
|
||||
</label>
|
||||
</fieldset>
|
||||
<fieldset class="ds-fieldset">
|
||||
<legend class="ds-fieldset__legend">Anzeige</legend>
|
||||
<label class="ds-choice">
|
||||
<input type="radio" name="demo-view" checked>
|
||||
<span class="ds-choice__text"><span class="ds-choice__label">Liste</span></span>
|
||||
</label>
|
||||
<label class="ds-choice">
|
||||
<input type="radio" name="demo-view">
|
||||
<span class="ds-choice__text"><span class="ds-choice__label">Raster</span></span>
|
||||
</label>
|
||||
</fieldset>
|
||||
<label class="ds-switch">
|
||||
<input type="checkbox" checked>
|
||||
<span class="ds-switch__label">Dunkelmodus folgen</span>
|
||||
</label>
|
||||
<label class="ds-switch">
|
||||
<input type="checkbox" disabled>
|
||||
<span class="ds-switch__label">Nicht verfügbar</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="demo-section">
|
||||
<h2>Daten</h2>
|
||||
<div class="demo-block" style="margin-bottom: var(--ds-space-4)">
|
||||
<div class="ds-table-wrap">
|
||||
<table class="ds-table ds-table--sticky">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Name</th>
|
||||
<th scope="col" aria-sort="ascending">Status</th>
|
||||
<th scope="col" class="ds-table__num">Betrag</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td>Nordlicht</td><td><span class="ds-badge ds-badge--success">Aktiv</span></td><td class="ds-table__num">1.240,00 €</td></tr>
|
||||
<tr><td>Hanseblick</td><td><span class="ds-badge ds-badge--warning">Wartet</span></td><td class="ds-table__num">860,50 €</td></tr>
|
||||
<tr><td>Speicherstadt</td><td><span class="ds-badge ds-badge--danger">Überfällig</span></td><td class="ds-table__num">120,00 €</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo-grid">
|
||||
<div class="demo-block">
|
||||
<span class="demo-label">Hinweise</span>
|
||||
<div class="ds-alert">
|
||||
<svg class="ds-icon ds-alert__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/></svg>
|
||||
<div><p class="ds-alert__title">Synchronisierung läuft</p><p class="ds-alert__text">Letzte Änderung vor 2 Minuten.</p></div>
|
||||
</div>
|
||||
<div class="ds-alert ds-alert--success">
|
||||
<svg class="ds-icon ds-alert__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M20 6 9 17l-5-5"/></svg>
|
||||
<div><p class="ds-alert__title">Gespeichert</p><p class="ds-alert__text">Alle Änderungen sind übernommen.</p></div>
|
||||
</div>
|
||||
<div class="ds-alert ds-alert--danger">
|
||||
<svg class="ds-icon ds-alert__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 20h16a2 2 0 0 0 1.73-2Z"/><path d="M12 9v4"/><path d="M12 17h.01"/></svg>
|
||||
<div><p class="ds-alert__title">Nicht gespeichert</p><p class="ds-alert__text">Die Verbindung wurde unterbrochen.</p></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo-block">
|
||||
<span class="demo-label">Kennzahl & Ladezustand</span>
|
||||
<div>
|
||||
<p class="ds-stat__value">12.480</p>
|
||||
<p class="ds-stat__label">Aktive Konten</p>
|
||||
<p class="ds-stat__meta">+8,2 % zum Vormonat</p>
|
||||
</div>
|
||||
<div class="ds-stack" aria-hidden="true">
|
||||
<span class="ds-skeleton ds-skeleton--title"></span>
|
||||
<span class="ds-skeleton ds-skeleton--text"></span>
|
||||
<span class="ds-skeleton ds-skeleton--text" style="width: 80%"></span>
|
||||
</div>
|
||||
<div class="ds-progress" role="progressbar" aria-valuenow="64" aria-valuemin="0" aria-valuemax="100" aria-label="Fortschritt">
|
||||
<div class="ds-progress__bar" style="width: 64%"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo-block">
|
||||
<span class="demo-label">Leerzustand</span>
|
||||
<div class="ds-empty">
|
||||
<svg class="ds-empty__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><polyline points="22 12 16 12 14 15 10 15 8 12 2 12"/><path d="M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"/></svg>
|
||||
<p class="ds-empty__title">Noch keine Einträge</p>
|
||||
<p class="ds-empty__text">Lege den ersten Eintrag an, um hier etwas zu sehen.</p>
|
||||
<button class="ds-button" type="button">Eintrag anlegen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="demo-section">
|
||||
<h2>Überlagerungen</h2>
|
||||
<div class="demo-grid">
|
||||
<div class="demo-block">
|
||||
<span class="demo-label">Dialog</span>
|
||||
<button class="ds-button" type="button" onclick="document.getElementById('demo-dialog').showModal()">Dialog öffnen</button>
|
||||
<dialog class="ds-dialog" id="demo-dialog" aria-labelledby="demo-dialog-title">
|
||||
<div class="ds-dialog__header">
|
||||
<h2 class="ds-dialog__title" id="demo-dialog-title">Eintrag löschen?</h2>
|
||||
<button class="ds-button ds-button--ghost ds-button--icon" type="button" aria-label="Schliessen" onclick="document.getElementById('demo-dialog').close()">
|
||||
<svg class="ds-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>
|
||||
</button>
|
||||
</div>
|
||||
<div class="ds-dialog__body">
|
||||
<p>Der Eintrag wird endgültig entfernt. Das lässt sich nicht rückgängig machen.</p>
|
||||
</div>
|
||||
<div class="ds-dialog__footer">
|
||||
<button class="ds-button ds-button--secondary" type="button" onclick="document.getElementById('demo-dialog').close()">Abbrechen</button>
|
||||
<button class="ds-button ds-button--danger" type="button" onclick="document.getElementById('demo-dialog').close()">Endgültig löschen</button>
|
||||
</div>
|
||||
</dialog>
|
||||
</div>
|
||||
<div class="demo-block">
|
||||
<span class="demo-label">Menü</span>
|
||||
<div class="ds-menu" role="menu" aria-label="Demo-Menü" style="max-width: 14rem">
|
||||
<a class="ds-menu__item" href="#" role="menuitem">Bearbeiten</a>
|
||||
<a class="ds-menu__item" href="#" role="menuitem">Duplizieren</a>
|
||||
<div class="ds-menu__separator" role="separator"></div>
|
||||
<span class="ds-menu__item" role="menuitem" aria-disabled="true">Archiviert</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="demo-block">
|
||||
<span class="demo-label">Toasts</span>
|
||||
<div class="ds-toast" role="status">
|
||||
<div><p class="ds-toast__title">Gespeichert</p><p class="ds-toast__text">Änderungen übernommen.</p></div>
|
||||
</div>
|
||||
<div class="ds-toast ds-toast--danger" role="alert">
|
||||
<div><p class="ds-toast__title">Fehlgeschlagen</p><p class="ds-toast__text">Bitte erneut versuchen.</p></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="demo-section">
|
||||
<h2>Navigation</h2>
|
||||
<div class="demo-nav-layout">
|
||||
<div class="demo-block">
|
||||
<span class="demo-label">Seitennavigation</span>
|
||||
<nav class="ds-nav" aria-label="Demo">
|
||||
<a class="ds-nav__item" href="#" aria-current="page">Übersicht</a>
|
||||
<a class="ds-nav__item" href="#">Berichte</a>
|
||||
<a class="ds-nav__item" href="#">Einstellungen</a>
|
||||
</nav>
|
||||
</div>
|
||||
<div class="demo-block">
|
||||
<span class="demo-label">Brotkrümel</span>
|
||||
<nav class="ds-breadcrumb" aria-label="Brotkrümel">
|
||||
<ol>
|
||||
<li><a href="#">Start</a><span class="ds-breadcrumb__sep" aria-hidden="true">/</span></li>
|
||||
<li><a href="#">Projekte</a><span class="ds-breadcrumb__sep" aria-hidden="true">/</span></li>
|
||||
<li><span aria-current="page">Nordlicht</span></li>
|
||||
</ol>
|
||||
</nav>
|
||||
<span class="demo-label">Register</span>
|
||||
<div class="ds-tabs" role="tablist" aria-label="Demo">
|
||||
<button class="ds-tab" type="button" role="tab" aria-selected="true">Übersicht</button>
|
||||
<button class="ds-tab" type="button" role="tab" aria-selected="false">Verlauf</button>
|
||||
<button class="ds-tab" type="button" role="tab" aria-selected="false">Dateien</button>
|
||||
</div>
|
||||
<span class="demo-label">Seiten</span>
|
||||
<nav class="ds-pagination" aria-label="Seiten">
|
||||
<span class="ds-pagination__item" aria-disabled="true">Zurück</span>
|
||||
<a class="ds-pagination__item" href="#" aria-current="page">1</a>
|
||||
<a class="ds-pagination__item" href="#">2</a>
|
||||
<a class="ds-pagination__item" href="#">3</a>
|
||||
<a class="ds-pagination__item" href="#">Weiter</a>
|
||||
</nav>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const toggle = document.getElementById('theme-toggle');
|
||||
const root = document.documentElement;
|
||||
const skin = new URLSearchParams(location.search).get('skin');
|
||||
if (skin) {
|
||||
const link = document.createElement('link');
|
||||
link.rel = 'stylesheet';
|
||||
link.href = '../tokens/themes/' + encodeURIComponent(skin) + '.css';
|
||||
document.head.appendChild(link);
|
||||
}
|
||||
if (new URLSearchParams(location.search).get('theme') === 'dark') {
|
||||
root.dataset.theme = 'dark';
|
||||
toggle.textContent = 'Hell';
|
||||
}
|
||||
toggle.addEventListener('click', () => {
|
||||
const dark = root.dataset.theme === 'dark';
|
||||
root.dataset.theme = dark ? '' : 'dark';
|
||||
toggle.textContent = dark ? 'Dunkel' : 'Hell';
|
||||
});
|
||||
if (new URLSearchParams(location.search).get('dialog') === 'open') {
|
||||
document.getElementById('demo-dialog').showModal();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,7 @@
|
||||
@import "base.css";
|
||||
@import "button.css";
|
||||
@import "form.css";
|
||||
@import "data.css";
|
||||
@import "overlay.css";
|
||||
@import "navigation.css";
|
||||
@import "print.css";
|
||||
@@ -0,0 +1,145 @@
|
||||
.ds-skip {
|
||||
position: fixed;
|
||||
top: var(--ds-space-2);
|
||||
left: var(--ds-space-2);
|
||||
z-index: var(--ds-z-toast);
|
||||
padding: var(--ds-space-2) var(--ds-space-4);
|
||||
border-radius: var(--ds-radius-control);
|
||||
background: var(--ds-action-bg);
|
||||
color: var(--ds-action-text);
|
||||
font-size: var(--ds-text-sm);
|
||||
text-decoration: none;
|
||||
transform: translateY(-200%);
|
||||
}
|
||||
|
||||
.ds-skip:focus {
|
||||
transform: none;
|
||||
}
|
||||
|
||||
.ds-nav {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-space-1);
|
||||
}
|
||||
|
||||
.ds-nav__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-space-2);
|
||||
min-height: var(--ds-target-touch);
|
||||
padding-inline: var(--ds-space-3);
|
||||
border-radius: var(--ds-radius-control);
|
||||
color: var(--ds-text-muted);
|
||||
font-size: var(--ds-text-sm);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.ds-nav__item:hover {
|
||||
background: var(--ds-surface-hover);
|
||||
color: var(--ds-text);
|
||||
}
|
||||
|
||||
.ds-nav__item[aria-current="page"] {
|
||||
background: var(--ds-selection-bg);
|
||||
color: var(--ds-selection-text);
|
||||
font-weight: var(--ds-weight-semibold);
|
||||
}
|
||||
|
||||
.ds-tabs {
|
||||
display: flex;
|
||||
gap: var(--ds-space-1);
|
||||
overflow-x: auto;
|
||||
border-bottom: var(--ds-border-thin) solid var(--ds-border);
|
||||
}
|
||||
|
||||
.ds-tab {
|
||||
min-height: var(--ds-target-touch);
|
||||
padding-inline: var(--ds-space-3);
|
||||
border: 0;
|
||||
border-bottom: var(--ds-border-strong) solid transparent;
|
||||
background: none;
|
||||
color: var(--ds-text-muted);
|
||||
font-size: var(--ds-text-sm);
|
||||
font-weight: var(--ds-weight-medium);
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ds-tab:hover {
|
||||
color: var(--ds-text);
|
||||
}
|
||||
|
||||
.ds-tab[aria-selected="true"] {
|
||||
color: var(--ds-text);
|
||||
border-bottom-color: var(--ds-action-bg);
|
||||
}
|
||||
|
||||
.ds-breadcrumb ol {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: var(--ds-space-1);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
font-size: var(--ds-text-sm);
|
||||
}
|
||||
|
||||
.ds-breadcrumb li {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-space-1);
|
||||
}
|
||||
|
||||
.ds-breadcrumb a {
|
||||
color: var(--ds-text-muted);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.ds-breadcrumb a:hover {
|
||||
color: var(--ds-text);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.ds-breadcrumb__sep {
|
||||
color: var(--ds-text-subtle);
|
||||
}
|
||||
|
||||
.ds-breadcrumb [aria-current="page"] {
|
||||
color: var(--ds-text);
|
||||
}
|
||||
|
||||
.ds-pagination {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-space-1);
|
||||
}
|
||||
|
||||
.ds-pagination__item {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: var(--ds-target-touch);
|
||||
min-height: var(--ds-target-touch);
|
||||
padding-inline: var(--ds-space-2);
|
||||
border: var(--ds-border-thin) solid transparent;
|
||||
border-radius: var(--ds-radius-control);
|
||||
color: var(--ds-text);
|
||||
font-size: var(--ds-text-sm);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.ds-pagination__item:hover {
|
||||
background: var(--ds-surface-hover);
|
||||
}
|
||||
|
||||
.ds-pagination__item[aria-current="page"] {
|
||||
background: var(--ds-action-bg);
|
||||
color: var(--ds-action-text);
|
||||
font-weight: var(--ds-weight-semibold);
|
||||
}
|
||||
|
||||
.ds-pagination__item[aria-disabled="true"] {
|
||||
color: var(--ds-text-disabled);
|
||||
pointer-events: none;
|
||||
}
|
||||
@@ -0,0 +1,136 @@
|
||||
.ds-dialog {
|
||||
width: min(calc(100vw - var(--ds-space-8)), var(--ds-container-md));
|
||||
max-height: calc(100dvh - var(--ds-space-12));
|
||||
margin: auto;
|
||||
padding: 0;
|
||||
overflow: hidden;
|
||||
border: var(--ds-border-thin) solid var(--ds-border);
|
||||
border-radius: var(--ds-radius-overlay);
|
||||
background: var(--ds-surface-raised);
|
||||
color: var(--ds-text);
|
||||
box-shadow: var(--ds-shadow-3);
|
||||
}
|
||||
|
||||
.ds-dialog::backdrop {
|
||||
background: var(--ds-overlay);
|
||||
}
|
||||
|
||||
.ds-dialog__header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: var(--ds-space-4);
|
||||
padding: var(--ds-space-4) var(--ds-space-6);
|
||||
border-bottom: var(--ds-border-thin) solid var(--ds-border);
|
||||
}
|
||||
|
||||
.ds-dialog__title {
|
||||
font-size: var(--ds-text-2xl);
|
||||
font-weight: var(--ds-weight-semibold);
|
||||
}
|
||||
|
||||
.ds-dialog__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-space-4);
|
||||
max-height: 60dvh;
|
||||
padding: var(--ds-space-6);
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.ds-dialog__footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
gap: var(--ds-space-2);
|
||||
padding: var(--ds-space-4) var(--ds-space-6);
|
||||
border-top: var(--ds-border-thin) solid var(--ds-border);
|
||||
}
|
||||
|
||||
.ds-menu {
|
||||
min-width: 12rem;
|
||||
padding: var(--ds-space-1);
|
||||
background: var(--ds-surface-raised);
|
||||
border: var(--ds-border-thin) solid var(--ds-border);
|
||||
border-radius: var(--ds-radius-overlay);
|
||||
box-shadow: var(--ds-shadow-2);
|
||||
}
|
||||
|
||||
.ds-menu__item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: var(--ds-space-2);
|
||||
min-height: var(--ds-control-md);
|
||||
padding-inline: var(--ds-space-3);
|
||||
border-radius: var(--ds-radius-control);
|
||||
color: var(--ds-text);
|
||||
font-size: var(--ds-text-sm);
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ds-menu__item:hover,
|
||||
.ds-menu__item:focus-visible {
|
||||
background: var(--ds-surface-hover);
|
||||
}
|
||||
|
||||
.ds-menu__item[aria-disabled="true"] {
|
||||
color: var(--ds-text-disabled);
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.ds-menu__item .ds-icon {
|
||||
width: var(--ds-icon-sm);
|
||||
height: var(--ds-icon-sm);
|
||||
color: var(--ds-text-muted);
|
||||
}
|
||||
|
||||
.ds-menu__separator {
|
||||
height: var(--ds-border-thin);
|
||||
margin-block: var(--ds-space-1);
|
||||
background: var(--ds-border);
|
||||
}
|
||||
|
||||
.ds-toast-region {
|
||||
position: fixed;
|
||||
inset-block-end: var(--ds-space-4);
|
||||
inset-inline-end: var(--ds-space-4);
|
||||
z-index: var(--ds-z-toast);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ds-space-2);
|
||||
width: min(24rem, calc(100vw - var(--ds-space-8)));
|
||||
}
|
||||
|
||||
.ds-toast {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--ds-space-2);
|
||||
padding: var(--ds-space-3) var(--ds-space-4);
|
||||
border: var(--ds-border-thin) solid var(--ds-border);
|
||||
border-inline-start: var(--ds-space-1) solid var(--ds-info);
|
||||
border-radius: var(--ds-radius-surface);
|
||||
background: var(--ds-surface-raised);
|
||||
box-shadow: var(--ds-shadow-2);
|
||||
font-size: var(--ds-text-sm);
|
||||
}
|
||||
|
||||
.ds-toast__title {
|
||||
font-weight: var(--ds-weight-semibold);
|
||||
}
|
||||
|
||||
.ds-toast__text {
|
||||
color: var(--ds-text-muted);
|
||||
}
|
||||
|
||||
.ds-toast--success {
|
||||
border-inline-start-color: var(--ds-success);
|
||||
}
|
||||
|
||||
.ds-toast--warning {
|
||||
border-inline-start-color: var(--ds-warning);
|
||||
}
|
||||
|
||||
.ds-toast--danger {
|
||||
border-inline-start-color: var(--ds-danger);
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
.ds-print-only {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media print {
|
||||
@page {
|
||||
margin: 16mm;
|
||||
}
|
||||
|
||||
:root {
|
||||
color-scheme: light;
|
||||
|
||||
--ds-bg: var(--ds-print-bg);
|
||||
--ds-surface: var(--ds-print-bg);
|
||||
--ds-surface-raised: var(--ds-print-bg);
|
||||
--ds-surface-sunken: var(--ds-print-bg);
|
||||
--ds-surface-hover: var(--ds-print-bg);
|
||||
|
||||
--ds-text: var(--ds-print-text);
|
||||
--ds-text-muted: var(--ds-print-muted);
|
||||
--ds-text-subtle: var(--ds-print-muted);
|
||||
--ds-text-disabled: var(--ds-print-muted);
|
||||
--ds-text-on-accent: var(--ds-print-bg);
|
||||
|
||||
--ds-border: var(--ds-print-border);
|
||||
--ds-border-strong: var(--ds-print-text);
|
||||
--ds-border-focus: var(--ds-print-text);
|
||||
|
||||
--ds-action-bg: var(--ds-print-text);
|
||||
--ds-action-bg-hover: var(--ds-print-text);
|
||||
--ds-action-bg-active: var(--ds-print-text);
|
||||
--ds-action-text: var(--ds-print-bg);
|
||||
--ds-action-border: transparent;
|
||||
|
||||
--ds-action2-bg: var(--ds-print-bg);
|
||||
--ds-action2-bg-hover: var(--ds-print-bg);
|
||||
--ds-action2-text: var(--ds-print-text);
|
||||
--ds-action2-border: var(--ds-print-text);
|
||||
--ds-action2-border-hover: var(--ds-print-text);
|
||||
|
||||
--ds-action3-text: var(--ds-print-muted);
|
||||
--ds-action3-bg-hover: var(--ds-print-bg);
|
||||
|
||||
--ds-danger-action-bg: var(--ds-print-text);
|
||||
--ds-danger-action-bg-hover: var(--ds-print-text);
|
||||
--ds-danger-action-bg-active: var(--ds-print-text);
|
||||
--ds-danger-action-text: var(--ds-print-bg);
|
||||
--ds-danger-action-border: transparent;
|
||||
|
||||
--ds-focus-ring: var(--ds-print-text);
|
||||
|
||||
--ds-success: var(--ds-print-text);
|
||||
--ds-success-surface: var(--ds-print-bg);
|
||||
--ds-success-border: var(--ds-print-border);
|
||||
--ds-warning: var(--ds-print-text);
|
||||
--ds-warning-surface: var(--ds-print-bg);
|
||||
--ds-warning-border: var(--ds-print-border);
|
||||
--ds-danger: var(--ds-print-text);
|
||||
--ds-danger-surface: var(--ds-print-bg);
|
||||
--ds-danger-border: var(--ds-print-border);
|
||||
--ds-info: var(--ds-print-text);
|
||||
--ds-info-surface: var(--ds-print-bg);
|
||||
--ds-info-border: var(--ds-print-border);
|
||||
|
||||
--ds-selection-bg: var(--ds-print-bg);
|
||||
--ds-selection-text: var(--ds-print-text);
|
||||
--ds-link: var(--ds-print-text);
|
||||
--ds-link-hover: var(--ds-print-text);
|
||||
|
||||
--ds-disabled-bg: var(--ds-print-bg);
|
||||
--ds-disabled-text: var(--ds-print-muted);
|
||||
--ds-disabled-border: var(--ds-print-border);
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--ds-print-bg);
|
||||
color: var(--ds-print-text);
|
||||
font-size: 11pt;
|
||||
}
|
||||
|
||||
.ds-no-print,
|
||||
.ds-skip,
|
||||
.ds-toast-region {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.ds-print-only {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.ds-print-only--flex {
|
||||
display: flex !important;
|
||||
}
|
||||
|
||||
.ds-container {
|
||||
max-width: none;
|
||||
padding-inline: 0;
|
||||
}
|
||||
|
||||
a {
|
||||
color: var(--ds-print-text);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.ds-card,
|
||||
.ds-alert,
|
||||
.ds-empty,
|
||||
.ds-table-wrap {
|
||||
background: transparent;
|
||||
border-color: var(--ds-print-border);
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.ds-card {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.ds-table-wrap {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.ds-table {
|
||||
font-size: 10pt;
|
||||
}
|
||||
|
||||
.ds-table thead {
|
||||
display: table-header-group;
|
||||
}
|
||||
|
||||
.ds-table tfoot {
|
||||
display: table-footer-group;
|
||||
}
|
||||
|
||||
.ds-table tr,
|
||||
.ds-card,
|
||||
.ds-alert,
|
||||
.ds-empty {
|
||||
break-inside: avoid;
|
||||
}
|
||||
|
||||
.ds-table th,
|
||||
.ds-table td {
|
||||
height: auto;
|
||||
padding-block: 4pt;
|
||||
border-color: var(--ds-print-border);
|
||||
color: var(--ds-print-text);
|
||||
}
|
||||
|
||||
.ds-table th {
|
||||
color: var(--ds-print-muted);
|
||||
}
|
||||
|
||||
.ds-table tbody tr:hover {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.ds-badge,
|
||||
.ds-badge--success,
|
||||
.ds-badge--warning,
|
||||
.ds-badge--danger,
|
||||
.ds-badge--info {
|
||||
background: transparent;
|
||||
border-color: var(--ds-print-border);
|
||||
color: var(--ds-print-text);
|
||||
}
|
||||
|
||||
.ds-skeleton,
|
||||
.ds-progress,
|
||||
.ds-spinner {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.ds-print-break {
|
||||
break-before: page;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
/* ───────────────────────────────────────────────────────────────────────────
|
||||
Design System — Einstiegspunkt
|
||||
|
||||
Reihenfolge ist bindend:
|
||||
1. primitives.css — Rohwerte
|
||||
2. semantic.css — Rollen (hell + dunkel)
|
||||
3. themes/<name>.css — optional, überschreibt nur Rollen
|
||||
|
||||
Beispiel AImighty:
|
||||
<link rel="stylesheet" href="tokens/index.css">
|
||||
<link rel="stylesheet" href="tokens/themes/aimighty.css">
|
||||
─────────────────────────────────────────────────────────────────────────── */
|
||||
|
||||
@import "primitives.css";
|
||||
@import "semantic.css";
|
||||
@@ -0,0 +1,163 @@
|
||||
/* ───────────────────────────────────────────────────────────────────────────
|
||||
Design System — Primitive (Rohwerte)
|
||||
|
||||
Markenfrei. Alle Werte sind der Vorrat, aus dem semantic.css Rollen bildet.
|
||||
Komponenten greifen NIEMALS hierauf zu, nur auf --ds-* Rollen.
|
||||
|
||||
Raster: 4px-Basis, strikt. In rem notiert (16px Wurzel = 4px), damit das
|
||||
Raster bei Standardgröße exakt ist und bei Nutzer-Zoom mitwächst.
|
||||
Keine Dichte-Skalierung: Dichte ist eine Theme-Eigenheit, kein Primitive.
|
||||
─────────────────────────────────────────────────────────────────────────── */
|
||||
|
||||
:root {
|
||||
/* Abstand — 4 · 8 · 12 · 16 · 24 · 32 · 48 · 64 · 96 · 128 */
|
||||
--ds-space-0: 0;
|
||||
--ds-space-1: 0.25rem; /* 4px */
|
||||
--ds-space-2: 0.5rem; /* 8px */
|
||||
--ds-space-3: 0.75rem; /* 12px */
|
||||
--ds-space-4: 1rem; /* 16px */
|
||||
--ds-space-6: 1.5rem; /* 24px */
|
||||
--ds-space-8: 2rem; /* 32px */
|
||||
--ds-space-12: 3rem; /* 48px */
|
||||
--ds-space-16: 4rem; /* 64px */
|
||||
--ds-space-24: 6rem; /* 96px */
|
||||
--ds-space-32: 8rem; /* 128px */
|
||||
|
||||
/* Schriftgrad — praktische Leiter */
|
||||
--ds-text-2xs: 0.6875rem; /* 11px */
|
||||
--ds-text-xs: 0.75rem; /* 12px */
|
||||
--ds-text-sm: 0.875rem; /* 14px */
|
||||
--ds-text-md: 1rem; /* 16px — Grundgrad */
|
||||
--ds-text-lg: 1.125rem; /* 18px */
|
||||
--ds-text-xl: 1.25rem; /* 20px */
|
||||
--ds-text-2xl: 1.5rem; /* 24px */
|
||||
--ds-text-3xl: 1.875rem; /* 30px */
|
||||
--ds-text-4xl: 2.25rem; /* 36px */
|
||||
--ds-text-5xl: 3rem; /* 48px */
|
||||
|
||||
/* Zeilenhöhe */
|
||||
--ds-leading-tight: 1.2;
|
||||
--ds-leading-snug: 1.35;
|
||||
--ds-leading-normal: 1.5;
|
||||
--ds-leading-relaxed: 1.65;
|
||||
|
||||
/* Laufweite */
|
||||
--ds-tracking-tight: -0.01em;
|
||||
--ds-tracking-normal: 0;
|
||||
--ds-tracking-wide: 0.02em;
|
||||
|
||||
/* Schriftgewicht */
|
||||
--ds-weight-regular: 400;
|
||||
--ds-weight-medium: 500;
|
||||
--ds-weight-semibold: 600;
|
||||
--ds-weight-bold: 700;
|
||||
|
||||
/* Schriftfamilien — neutraler System-Stack, kein Fremd-CDN */
|
||||
--ds-font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
|
||||
"Helvetica Neue", Arial, sans-serif;
|
||||
--ds-font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas,
|
||||
"Liberation Mono", monospace;
|
||||
|
||||
/* Radius */
|
||||
--ds-radius-none: 0;
|
||||
--ds-radius-sm: 0.25rem; /* 4px */
|
||||
--ds-radius-md: 0.5rem; /* 8px */
|
||||
--ds-radius-lg: 0.75rem; /* 12px */
|
||||
--ds-radius-xl: 1rem; /* 16px */
|
||||
--ds-radius-full: 999px;
|
||||
|
||||
/* Randstärke */
|
||||
--ds-border-thin: 1px;
|
||||
--ds-border-strong: 2px;
|
||||
|
||||
/* Bediengrößen — Berührungsziel nie unter 44px */
|
||||
--ds-control-sm: 2rem; /* 32px — nur Zeiger */
|
||||
--ds-control-md: 2.5rem; /* 40px — nur Zeiger */
|
||||
--ds-control-lg: 2.75rem; /* 44px — Berührung */
|
||||
--ds-target-touch: 2.75rem; /* 44px, ohne Ausnahme */
|
||||
--ds-target-gap: 0.5rem;
|
||||
|
||||
/* Symbolgrößen */
|
||||
--ds-icon-sm: 1rem; /* 16px */
|
||||
--ds-icon-md: 1.25rem; /* 20px */
|
||||
--ds-icon-lg: 1.5rem; /* 24px */
|
||||
--ds-icon-xl: 2rem; /* 32px */
|
||||
|
||||
/* Bewegung */
|
||||
--ds-duration-fast: 120ms;
|
||||
--ds-duration-base: 200ms;
|
||||
--ds-duration-slow: 320ms;
|
||||
--ds-ease-standard: cubic-bezier(0.2, 0, 0, 1);
|
||||
--ds-ease-out: cubic-bezier(0, 0, 0.2, 1);
|
||||
--ds-ease-in: cubic-bezier(0.4, 0, 1, 1);
|
||||
|
||||
/* Ebenen */
|
||||
--ds-z-base: 0;
|
||||
--ds-z-raised: 10;
|
||||
--ds-z-sticky: 20;
|
||||
--ds-z-nav: 40;
|
||||
--ds-z-header: 50;
|
||||
--ds-z-menu: 60;
|
||||
--ds-z-overlay: 90;
|
||||
--ds-z-dialog: 100;
|
||||
--ds-z-toast: 200;
|
||||
|
||||
/* Container / Lesemaß */
|
||||
--ds-container-sm: 40rem; /* 640px */
|
||||
--ds-container-md: 48rem; /* 768px */
|
||||
--ds-container-lg: 64rem; /* 1024px */
|
||||
--ds-container-xl: 80rem; /* 1280px */
|
||||
--ds-measure: 65ch; /* 60–75 Zeichen */
|
||||
|
||||
/* ── Farbe: Neutrals (kühl, markenfrei) ───────────────────────────────── */
|
||||
--ds-gray-25: #fcfcfd;
|
||||
--ds-gray-50: #f8fafc;
|
||||
--ds-gray-100: #f1f5f9;
|
||||
--ds-gray-200: #e2e8f0;
|
||||
--ds-gray-300: #cbd5e1;
|
||||
--ds-gray-400: #94a3b8;
|
||||
--ds-gray-500: #64748b;
|
||||
--ds-gray-600: #475569;
|
||||
--ds-gray-700: #334155;
|
||||
--ds-gray-800: #1e293b;
|
||||
--ds-gray-900: #0f172a;
|
||||
--ds-gray-950: #020617;
|
||||
|
||||
/* ── Farbe: Akzent (der EINE Akzent) ─────────────────────────────────── */
|
||||
--ds-accent-50: #eff6ff;
|
||||
--ds-accent-100: #dbeafe;
|
||||
--ds-accent-200: #bfdbfe;
|
||||
--ds-accent-300: #93c5fd;
|
||||
--ds-accent-400: #60a5fa;
|
||||
--ds-accent-500: #3b82f6;
|
||||
--ds-accent-600: #2563eb;
|
||||
--ds-accent-700: #1d4ed8;
|
||||
--ds-accent-800: #1e40af;
|
||||
--ds-accent-900: #1e3a8a;
|
||||
--ds-accent-950: #172554;
|
||||
|
||||
/* ── Farbe: Zustand ───────────────────────────────────────────────────── */
|
||||
--ds-red-50: #fef2f2;
|
||||
--ds-red-200: #fecaca;
|
||||
--ds-red-500: #ef4444;
|
||||
--ds-red-600: #dc2626;
|
||||
--ds-red-700: #b91c1c;
|
||||
|
||||
--ds-amber-50: #fffbeb;
|
||||
--ds-amber-200: #fde68a;
|
||||
--ds-amber-500: #f59e0b;
|
||||
--ds-amber-600: #d97706;
|
||||
--ds-amber-700: #b45309;
|
||||
|
||||
--ds-green-50: #f0fdf4;
|
||||
--ds-green-200: #bbf7d0;
|
||||
--ds-green-500: #22c55e;
|
||||
--ds-green-600: #16a34a;
|
||||
--ds-green-700: #15803d;
|
||||
|
||||
/* Druck — neutral, unabhängig von Theme und Modus */
|
||||
--ds-print-bg: #ffffff;
|
||||
--ds-print-text: #111111;
|
||||
--ds-print-muted: #444444;
|
||||
--ds-print-border: #999999;
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
/* ───────────────────────────────────────────────────────────────────────────
|
||||
Design System — Semantik (Rollen)
|
||||
|
||||
Gemappte Rollen: was eine Fläche, ein Text, eine Handlung IST — nicht welche
|
||||
Farbe sie hat. Komponenten benutzen ausschliesslich diese Ebene.
|
||||
|
||||
Hell ist die Vorgabe. Dunkel schaltet :root[data-theme="dark"] oder .dark.
|
||||
color-scheme wird mitgesetzt, damit Formularelemente mitziehen.
|
||||
─────────────────────────────────────────────────────────────────────────── */
|
||||
|
||||
:root {
|
||||
color-scheme: light;
|
||||
|
||||
/* ── Flächen ──────────────────────────────────────────────────────────── */
|
||||
--ds-bg: var(--ds-gray-25);
|
||||
--ds-surface: #ffffff;
|
||||
--ds-surface-raised: #ffffff;
|
||||
--ds-surface-sunken: var(--ds-gray-100);
|
||||
--ds-surface-hover: var(--ds-gray-50);
|
||||
|
||||
/* ── Text ─────────────────────────────────────────────────────────────── */
|
||||
--ds-text: var(--ds-gray-900);
|
||||
--ds-text-muted: var(--ds-gray-600);
|
||||
--ds-text-subtle: var(--ds-gray-500);
|
||||
--ds-text-disabled: var(--ds-gray-400);
|
||||
--ds-text-on-accent: #ffffff;
|
||||
|
||||
/* ── Linien ───────────────────────────────────────────────────────────── */
|
||||
--ds-border: var(--ds-gray-200);
|
||||
--ds-border-strong: var(--ds-gray-500); /* >= 3:1, für bedienbare Ränder */
|
||||
--ds-border-focus: var(--ds-accent-600);
|
||||
|
||||
/* ── Form (Radius) — eine Formsprache pro App, modusunabhängig ────────── */
|
||||
/* Komponenten greifen nur auf diese drei Rollen zu, nie auf --ds-radius-*. */
|
||||
--ds-radius-control: var(--ds-radius-md); /* Buttons, Inputs, Selects */
|
||||
--ds-radius-surface: var(--ds-radius-lg); /* Karten, Panels, Tabellen */
|
||||
--ds-radius-overlay: var(--ds-radius-xl); /* Dialog, Menü, Popover */
|
||||
|
||||
/* ── Handlung: primär ─────────────────────────────────────────────────── */
|
||||
--ds-action-bg: var(--ds-accent-600);
|
||||
--ds-action-bg-hover: var(--ds-accent-700);
|
||||
--ds-action-bg-active: var(--ds-accent-800);
|
||||
--ds-action-text: var(--ds-text-on-accent);
|
||||
--ds-action-border: transparent;
|
||||
|
||||
/* ── Handlung: sekundär ───────────────────────────────────────────────── */
|
||||
--ds-action2-bg: var(--ds-surface);
|
||||
--ds-action2-bg-hover: var(--ds-gray-50);
|
||||
--ds-action2-text: var(--ds-text);
|
||||
--ds-action2-border: var(--ds-border-strong);
|
||||
--ds-action2-border-hover: var(--ds-gray-600);
|
||||
|
||||
/* ── Handlung: still / tertiär ────────────────────────────────────────── */
|
||||
--ds-action3-text: var(--ds-text-muted);
|
||||
--ds-action3-bg-hover: var(--ds-gray-100);
|
||||
|
||||
/* ── Handlung: endgültig löschend ─────────────────────────────────────── */
|
||||
--ds-danger-action-bg: var(--ds-red-600);
|
||||
--ds-danger-action-bg-hover: var(--ds-red-700);
|
||||
--ds-danger-action-bg-active: #991b1b;
|
||||
--ds-danger-action-text: #ffffff;
|
||||
--ds-danger-action-border: transparent;
|
||||
|
||||
/* ── Fokus ────────────────────────────────────────────────────────────── */
|
||||
--ds-focus-ring: var(--ds-accent-600);
|
||||
--ds-focus-width: 2px;
|
||||
--ds-focus-offset: 2px;
|
||||
|
||||
/* ── Zustand (Text / Rand / Fläche) ───────────────────────────────────── */
|
||||
--ds-success: var(--ds-green-700);
|
||||
--ds-success-surface: var(--ds-green-50);
|
||||
--ds-success-border: var(--ds-green-200);
|
||||
|
||||
--ds-warning: var(--ds-amber-700);
|
||||
--ds-warning-surface: var(--ds-amber-50);
|
||||
--ds-warning-border: var(--ds-amber-200);
|
||||
|
||||
--ds-danger: var(--ds-red-700);
|
||||
--ds-danger-surface: var(--ds-red-50);
|
||||
--ds-danger-border: var(--ds-red-200);
|
||||
|
||||
--ds-info: var(--ds-accent-700);
|
||||
--ds-info-surface: var(--ds-accent-50);
|
||||
--ds-info-border: var(--ds-accent-200);
|
||||
|
||||
/* ── Auswahl / Verweis / Überlagerung ─────────────────────────────────── */
|
||||
--ds-selection-bg: var(--ds-accent-100);
|
||||
--ds-selection-text: var(--ds-gray-900);
|
||||
--ds-link: var(--ds-accent-700);
|
||||
--ds-link-hover: var(--ds-accent-800);
|
||||
--ds-overlay: rgb(2 6 23 / 60%);
|
||||
|
||||
/* ── Deaktiviert ──────────────────────────────────────────────────────── */
|
||||
--ds-disabled-bg: var(--ds-gray-100);
|
||||
--ds-disabled-text: var(--ds-gray-400);
|
||||
--ds-disabled-border: var(--ds-gray-200);
|
||||
|
||||
/* ── Schatten (nur für Schwebendes: Menü, Popover, Dialog) ────────────── */
|
||||
--ds-shadow-1: 0 1px 2px rgb(2 6 23 / 6%), 0 1px 3px rgb(2 6 23 / 10%);
|
||||
--ds-shadow-2: 0 4px 12px rgb(2 6 23 / 12%), 0 1px 2px rgb(2 6 23 / 8%);
|
||||
--ds-shadow-3: 0 12px 32px rgb(2 6 23 / 18%), 0 2px 6px rgb(2 6 23 / 10%);
|
||||
}
|
||||
|
||||
:root[data-theme="dark"],
|
||||
.dark {
|
||||
color-scheme: dark;
|
||||
|
||||
/* ── Flächen ──────────────────────────────────────────────────────────── */
|
||||
--ds-bg: var(--ds-gray-950);
|
||||
--ds-surface: var(--ds-gray-900);
|
||||
--ds-surface-raised: var(--ds-gray-800);
|
||||
--ds-surface-sunken: #000000;
|
||||
--ds-surface-hover: var(--ds-gray-800);
|
||||
|
||||
/* ── Text ─────────────────────────────────────────────────────────────── */
|
||||
--ds-text: var(--ds-gray-100);
|
||||
--ds-text-muted: var(--ds-gray-300);
|
||||
--ds-text-subtle: var(--ds-gray-400);
|
||||
--ds-text-disabled: var(--ds-gray-600);
|
||||
--ds-text-on-accent: var(--ds-gray-950);
|
||||
|
||||
/* ── Linien ───────────────────────────────────────────────────────────── */
|
||||
--ds-border: var(--ds-gray-800);
|
||||
--ds-border-strong: var(--ds-gray-500); /* >= 3:1 auf dunklem Grund */
|
||||
--ds-border-focus: var(--ds-accent-400);
|
||||
|
||||
/* ── Handlung: primär — auf dunklem Grund hell, Text dunkel ───────────── */
|
||||
--ds-action-bg: var(--ds-accent-400);
|
||||
--ds-action-bg-hover: var(--ds-accent-300);
|
||||
--ds-action-bg-active: var(--ds-accent-500);
|
||||
--ds-action-text: var(--ds-gray-950);
|
||||
--ds-action-border: transparent;
|
||||
|
||||
/* ── Handlung: sekundär ───────────────────────────────────────────────── */
|
||||
--ds-action2-bg: transparent;
|
||||
--ds-action2-bg-hover: var(--ds-gray-800);
|
||||
--ds-action2-text: var(--ds-text);
|
||||
--ds-action2-border: var(--ds-border-strong);
|
||||
--ds-action2-border-hover: var(--ds-gray-400);
|
||||
|
||||
/* ── Handlung: still / tertiär ────────────────────────────────────────── */
|
||||
--ds-action3-text: var(--ds-text-muted);
|
||||
--ds-action3-bg-hover: var(--ds-gray-800);
|
||||
|
||||
/* ── Handlung: endgültig löschend ─────────────────────────────────────── */
|
||||
--ds-danger-action-bg: var(--ds-red-600);
|
||||
--ds-danger-action-bg-hover: var(--ds-red-700);
|
||||
--ds-danger-action-bg-active: #7f1d1d;
|
||||
--ds-danger-action-text: #ffffff;
|
||||
--ds-danger-action-border: transparent;
|
||||
|
||||
/* ── Fokus ────────────────────────────────────────────────────────────── */
|
||||
--ds-focus-ring: var(--ds-accent-400);
|
||||
|
||||
/* ── Zustand ──────────────────────────────────────────────────────────── */
|
||||
--ds-success: #4ade80;
|
||||
--ds-success-surface: #052e16;
|
||||
--ds-success-border: #166534;
|
||||
|
||||
--ds-warning: #fbbf24;
|
||||
--ds-warning-surface: #351a04;
|
||||
--ds-warning-border: #92400e;
|
||||
|
||||
--ds-danger: #f87171;
|
||||
--ds-danger-surface: #3f0f0f;
|
||||
--ds-danger-border: #991b1b;
|
||||
|
||||
--ds-info: var(--ds-accent-300);
|
||||
--ds-info-surface: #0b2547;
|
||||
--ds-info-border: #1e40af;
|
||||
|
||||
/* ── Auswahl / Verweis / Überlagerung ─────────────────────────────────── */
|
||||
--ds-selection-bg: var(--ds-accent-900);
|
||||
--ds-selection-text: var(--ds-gray-50);
|
||||
--ds-link: var(--ds-accent-300);
|
||||
--ds-link-hover: var(--ds-accent-200);
|
||||
--ds-overlay: rgb(0 0 0 / 70%);
|
||||
|
||||
/* ── Deaktiviert ──────────────────────────────────────────────────────── */
|
||||
--ds-disabled-bg: var(--ds-gray-800);
|
||||
--ds-disabled-text: var(--ds-gray-600);
|
||||
--ds-disabled-border: var(--ds-gray-800);
|
||||
|
||||
/* ── Schatten ─────────────────────────────────────────────────────────── */
|
||||
--ds-shadow-1: 0 1px 2px rgb(0 0 0 / 30%), 0 1px 3px rgb(0 0 0 / 40%);
|
||||
--ds-shadow-2: 0 4px 12px rgb(0 0 0 / 45%), 0 1px 2px rgb(0 0 0 / 30%);
|
||||
--ds-shadow-3: 0 12px 32px rgb(0 0 0 / 55%), 0 2px 6px rgb(0 0 0 / 35%);
|
||||
}
|
||||
|
||||
/* ── Bewegung aus, wenn das System es verlangt ───────────────────────────── */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
:root {
|
||||
--ds-duration-fast: 1ms;
|
||||
--ds-duration-base: 1ms;
|
||||
--ds-duration-slow: 1ms;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
/* ───────────────────────────────────────────────────────────────────────────
|
||||
Theme: AImighty (Brücke, nicht Quelle)
|
||||
|
||||
Setzt die markenfreien --ds-*-Rollen auf Hanseatenblau/Gold.
|
||||
Die verbindliche Quelle bleibt tech-stack/docs/standard-design-guide.md
|
||||
(--am-*). Dieses Theme existiert nur, damit generische Komponenten in einer
|
||||
AImighty-App richtig aussehen. Wer nur AImighty baut, nimmt weiterhin --am-*.
|
||||
|
||||
Abweichungen, die hier bewusst NICHT nachgebildet werden:
|
||||
- Dichte (--am-skalierung 1.1) → das generische System bleibt auf striktem
|
||||
4px-Raster. AImighty-Apps setzen ihre Dichte weiter über --am-*.
|
||||
- Bewegung, Ebenen, Ziele: identisch genug, bleiben aus semantic.css.
|
||||
─────────────────────────────────────────────────────────────────────────── */
|
||||
|
||||
:root {
|
||||
color-scheme: light;
|
||||
|
||||
/* Flächen */
|
||||
--ds-bg: #ffffff;
|
||||
--ds-surface: #f5f9fc; /* --am-flaeche-1 */
|
||||
--ds-surface-raised: #ffffff;
|
||||
--ds-surface-sunken: #e3eaf3; /* --am-flaeche-3 */
|
||||
--ds-surface-hover: #eff4f9; /* --am-flaeche-2 */
|
||||
|
||||
/* Text */
|
||||
--ds-text: #051729; /* --am-text-primaer */
|
||||
--ds-text-muted: #335578; /* --am-text-sekundaer */
|
||||
--ds-text-subtle: #4f6c8a; /* --am-text-gedaempft */
|
||||
--ds-text-disabled: #819bb7;
|
||||
--ds-text-on-accent: #ffffff;
|
||||
|
||||
/* Linien */
|
||||
--ds-border: #cfdbe7;
|
||||
--ds-border-strong: #587898; /* --am-rand-betont-farbe, 3:1 */
|
||||
--ds-border-focus: #002f56;
|
||||
|
||||
/* Form — AImighty: dezent/weich (klein 4 · mittel 8 · gross 12) */
|
||||
--ds-radius-control: 0.5rem; /* mittel 8px */
|
||||
--ds-radius-surface: 0.5rem; /* mittel 8px */
|
||||
--ds-radius-overlay: 0.75rem; /* gross 12px */
|
||||
|
||||
/* Handlung: primär — im Hellen Blau */
|
||||
--ds-action-bg: #002f56; /* --am-handlung-ruhend */
|
||||
--ds-action-bg-hover: #104472; /* --am-handlung-hover */
|
||||
--ds-action-bg-active: #002140; /* --am-handlung-aktiv */
|
||||
--ds-action-text: #ffffff;
|
||||
--ds-action-border: transparent;
|
||||
|
||||
/* Handlung: sekundär */
|
||||
--ds-action2-bg: #ffffff;
|
||||
--ds-action2-bg-hover: #eff4f9;
|
||||
--ds-action2-text: #051729;
|
||||
--ds-action2-border: #587898;
|
||||
--ds-action2-border-hover: #335578;
|
||||
|
||||
/* Handlung: still */
|
||||
--ds-action3-text: #335578;
|
||||
--ds-action3-bg-hover: #eff4f9;
|
||||
|
||||
/* Handlung: endgültig löschend */
|
||||
--ds-danger-action-bg: #ad3f38;
|
||||
--ds-danger-action-bg-hover: #b9584f;
|
||||
--ds-danger-action-bg-active: #8f332d;
|
||||
--ds-danger-action-text: #ffffff;
|
||||
--ds-danger-action-border: transparent;
|
||||
|
||||
/* Fokus */
|
||||
--ds-focus-ring: #002f56;
|
||||
|
||||
/* Zustand */
|
||||
--ds-success: #007e46;
|
||||
--ds-success-surface: #e7f6eb;
|
||||
--ds-success-border: #b5dcc1;
|
||||
--ds-warning: #9f5100;
|
||||
--ds-warning-surface: #feeee4;
|
||||
--ds-warning-border: #eec8af;
|
||||
--ds-danger: #ad3f38;
|
||||
--ds-danger-surface: #ffedeb;
|
||||
--ds-danger-border: #f3c4be;
|
||||
--ds-info: #066bb8;
|
||||
--ds-info-surface: #e8f3ff;
|
||||
--ds-info-border: #b6d5f4;
|
||||
|
||||
/* Auswahl / Verweis / Überlagerung */
|
||||
--ds-selection-bg: #ebddbd;
|
||||
--ds-selection-text: #051729;
|
||||
--ds-link: #8c6c1f; /* --am-gold-beschriftung, 4,91:1 */
|
||||
--ds-link-hover: #71560f;
|
||||
--ds-overlay: rgb(5 23 41 / 60%);
|
||||
|
||||
/* Deaktiviert */
|
||||
--ds-disabled-bg: #eff4f9;
|
||||
--ds-disabled-text: #819bb7;
|
||||
--ds-disabled-border: #cfdbe7;
|
||||
|
||||
/* Schatten */
|
||||
--ds-shadow-1: 0 1px 2px rgb(5 23 41 / 8%);
|
||||
--ds-shadow-2: 0 8px 24px rgb(5 23 41 / 12%), 0 1px 2px rgb(5 23 41 / 8%);
|
||||
--ds-shadow-3: 0 12px 32px rgb(5 23 41 / 18%), 0 2px 6px rgb(5 23 41 / 10%);
|
||||
}
|
||||
|
||||
:root[data-theme="dark"],
|
||||
.dark {
|
||||
color-scheme: dark;
|
||||
|
||||
/* Flächen */
|
||||
--ds-bg: #051729;
|
||||
--ds-surface: #0a2238;
|
||||
--ds-surface-raised: #142e47;
|
||||
--ds-surface-sunken: #010c1a;
|
||||
--ds-surface-hover: #142e47;
|
||||
|
||||
/* Text */
|
||||
--ds-text: #eef2f6;
|
||||
--ds-text-muted: #cfdbe7;
|
||||
--ds-text-subtle: #afc0d2;
|
||||
--ds-text-disabled: #819bb7;
|
||||
--ds-text-on-accent: #051729;
|
||||
|
||||
/* Linien */
|
||||
--ds-border: #142e47;
|
||||
--ds-border-strong: #819bb7;
|
||||
--ds-border-focus: #caa960;
|
||||
|
||||
/* Handlung: primär — auf dunklem Grund Gold */
|
||||
--ds-action-bg: #caa960;
|
||||
--ds-action-bg-hover: #d7ba7b;
|
||||
--ds-action-bg-active: #b7974e;
|
||||
--ds-action-text: #051729;
|
||||
--ds-action-border: transparent;
|
||||
|
||||
/* Handlung: sekundär — nie Gold */
|
||||
--ds-action2-bg: transparent;
|
||||
--ds-action2-bg-hover: #142e47;
|
||||
--ds-action2-text: #eef2f6;
|
||||
--ds-action2-border: #819bb7;
|
||||
--ds-action2-border-hover: #afc0d2;
|
||||
|
||||
/* Handlung: still */
|
||||
--ds-action3-text: #cfdbe7;
|
||||
--ds-action3-bg-hover: #142e47;
|
||||
|
||||
/* Handlung: endgültig löschend — auf dunklem Grund hell, Text dunkel */
|
||||
--ds-danger-action-bg: #f6857a;
|
||||
--ds-danger-action-bg-hover: #f9948a;
|
||||
--ds-danger-action-bg-active: #e0655c;
|
||||
--ds-danger-action-text: #051729;
|
||||
--ds-danger-action-border: transparent;
|
||||
|
||||
/* Fokus */
|
||||
--ds-focus-ring: #caa960;
|
||||
|
||||
/* Zustand */
|
||||
--ds-success: #55c483;
|
||||
--ds-success-surface: #102a1a;
|
||||
--ds-success-border: #1f4d31;
|
||||
--ds-warning: #ed914c;
|
||||
--ds-warning-surface: #351e0d;
|
||||
--ds-warning-border: #5f371a;
|
||||
--ds-danger: #f6857a;
|
||||
--ds-danger-surface: #371b18;
|
||||
--ds-danger-border: #62332e;
|
||||
--ds-info: #60b0ff;
|
||||
--ds-info-surface: #122539;
|
||||
--ds-info-border: #234566;
|
||||
|
||||
/* Auswahl / Verweis / Überlagerung */
|
||||
--ds-selection-bg: #142e47;
|
||||
--ds-selection-text: #eef2f6;
|
||||
--ds-link: #caa960;
|
||||
--ds-link-hover: #dfc896;
|
||||
--ds-overlay: rgb(5 23 41 / 70%);
|
||||
|
||||
/* Deaktiviert */
|
||||
--ds-disabled-bg: #142e47;
|
||||
--ds-disabled-text: #819bb7;
|
||||
--ds-disabled-border: #142e47;
|
||||
|
||||
/* Schatten */
|
||||
--ds-shadow-1: 0 1px 2px rgb(0 0 0 / 30%);
|
||||
--ds-shadow-2: 0 8px 24px rgb(0 0 0 / 40%), 0 1px 2px rgb(0 0 0 / 30%);
|
||||
--ds-shadow-3: 0 12px 32px rgb(0 0 0 / 55%), 0 2px 6px rgb(0 0 0 / 35%);
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
/* ───────────────────────────────────────────────────────────────────────────
|
||||
Theme: plan (sport-dark, Platzhalter-Marke)
|
||||
|
||||
Rollen-Ebene, nicht Rampen: Die Palette ist mehrfarbig (Tiefgrün, Mint,
|
||||
Lime, Violett). Kein DFB-Logo, keine DFB Sans Pro — nur der Look.
|
||||
Farbwerte aus dem Style-Tile, später exakt austauschbar.
|
||||
|
||||
Dunkel ist der Grundton; hell ist eine Mint-Seite mit gebrochenem Weiß für Karten. Lime trägt die primäre
|
||||
Handlung (dunkler Text), Violett ist Zweitakzent/Auswahl und nie Fliesstext.
|
||||
─────────────────────────────────────────────────────────────────────────── */
|
||||
|
||||
:root {
|
||||
color-scheme: light;
|
||||
|
||||
/* Flächen — Mint-Seite, Karten in gebrochenem Weiß */
|
||||
--ds-bg: #d8e9dc;
|
||||
--ds-surface: #fbfaf6;
|
||||
--ds-surface-raised: #ffffff;
|
||||
--ds-surface-sunken: #c7dccb;
|
||||
--ds-surface-hover: #f2efe7;
|
||||
|
||||
/* Text */
|
||||
--ds-text: #071512;
|
||||
--ds-text-muted: #2e4a3e;
|
||||
--ds-text-subtle: #456356;
|
||||
--ds-text-disabled: #8aa899;
|
||||
--ds-text-on-accent: #eaf6ec;
|
||||
|
||||
/* Linien */
|
||||
--ds-border: #b9c9bd;
|
||||
--ds-border-strong: #4e6b5c;
|
||||
--ds-border-focus: #0c2a22;
|
||||
|
||||
/* Form — scharf */
|
||||
--ds-radius-control: 0.25rem;
|
||||
--ds-radius-surface: 0.5rem;
|
||||
--ds-radius-overlay: 0.75rem;
|
||||
|
||||
/* Handlung: primär — dunkles Grün auf Mint */
|
||||
--ds-action-bg: #0c2a22;
|
||||
--ds-action-bg-hover: #164a3a;
|
||||
--ds-action-bg-active: #071512;
|
||||
--ds-action-text: #eaf6ec;
|
||||
--ds-action-border: transparent;
|
||||
|
||||
/* Handlung: sekundär */
|
||||
--ds-action2-bg: #f4f2eb;
|
||||
--ds-action2-bg-hover: #ebe7de;
|
||||
--ds-action2-text: #071512;
|
||||
--ds-action2-border: #4e6b5c;
|
||||
--ds-action2-border-hover: #2e4a3e;
|
||||
|
||||
/* Handlung: still */
|
||||
--ds-action3-text: #2e4a3e;
|
||||
--ds-action3-bg-hover: #dcebdf;
|
||||
|
||||
/* Handlung: endgültig löschend */
|
||||
--ds-danger-action-bg: #b3261e;
|
||||
--ds-danger-action-bg-hover: #d13b31;
|
||||
--ds-danger-action-bg-active: #8e1d17;
|
||||
--ds-danger-action-text: #ffffff;
|
||||
--ds-danger-action-border: transparent;
|
||||
|
||||
/* Fokus */
|
||||
--ds-focus-ring: #0c2a22;
|
||||
|
||||
/* Zustand */
|
||||
--ds-success: #0f6b4a;
|
||||
--ds-success-surface: #ddf2e7;
|
||||
--ds-success-border: #9ccdb6;
|
||||
--ds-warning: #8a5a00;
|
||||
--ds-warning-surface: #fff1d6;
|
||||
--ds-warning-border: #e5c58a;
|
||||
--ds-danger: #a3261e;
|
||||
--ds-danger-surface: #fbe3e1;
|
||||
--ds-danger-border: #e7a9a3;
|
||||
--ds-info: #4a1fb8;
|
||||
--ds-info-surface: #e9e3ff;
|
||||
--ds-info-border: #b9a7ff;
|
||||
|
||||
/* Auswahl / Verweis / Überlagerung */
|
||||
--ds-selection-bg: #5b2be0;
|
||||
--ds-selection-text: #ffffff;
|
||||
--ds-link: #4a1fb8;
|
||||
--ds-link-hover: #3a1690;
|
||||
--ds-overlay: rgb(7 21 18 / 60%);
|
||||
|
||||
/* Deaktiviert */
|
||||
--ds-disabled-bg: #dcebdf;
|
||||
--ds-disabled-text: #8aa899;
|
||||
--ds-disabled-border: #b9c9bd;
|
||||
|
||||
/* Schatten */
|
||||
--ds-shadow-1: 0 1px 2px rgb(7 21 18 / 8%);
|
||||
--ds-shadow-2: 0 8px 24px rgb(7 21 18 / 14%), 0 1px 2px rgb(7 21 18 / 8%);
|
||||
--ds-shadow-3: 0 12px 32px rgb(7 21 18 / 20%), 0 2px 6px rgb(7 21 18 / 12%);
|
||||
}
|
||||
|
||||
:root[data-theme="dark"],
|
||||
.dark {
|
||||
color-scheme: dark;
|
||||
|
||||
/* Flächen — Tiefgrün */
|
||||
--ds-bg: #071512;
|
||||
--ds-surface: #0c211b;
|
||||
--ds-surface-raised: #123027;
|
||||
--ds-surface-sunken: #04100d;
|
||||
--ds-surface-hover: #123027;
|
||||
|
||||
/* Text */
|
||||
--ds-text: #d8e9dc;
|
||||
--ds-text-muted: #a9c2b3;
|
||||
--ds-text-subtle: #8aa899;
|
||||
--ds-text-disabled: #4f6b5f;
|
||||
--ds-text-on-accent: #071512;
|
||||
|
||||
/* Linien */
|
||||
--ds-border: #1e3b31;
|
||||
--ds-border-strong: #6e8f7e;
|
||||
--ds-border-focus: #d6ff3e;
|
||||
|
||||
/* Handlung: primär — Lime auf Dunkel */
|
||||
--ds-action-bg: #d6ff3e;
|
||||
--ds-action-bg-hover: #e4ff76;
|
||||
--ds-action-bg-active: #b8e22e;
|
||||
--ds-action-text: #071512;
|
||||
--ds-action-border: transparent;
|
||||
|
||||
/* Handlung: sekundär — nie Lime */
|
||||
--ds-action2-bg: transparent;
|
||||
--ds-action2-bg-hover: #123027;
|
||||
--ds-action2-text: #d8e9dc;
|
||||
--ds-action2-border: #6e8f7e;
|
||||
--ds-action2-border-hover: #a9c2b3;
|
||||
|
||||
/* Handlung: still */
|
||||
--ds-action3-text: #a9c2b3;
|
||||
--ds-action3-bg-hover: #123027;
|
||||
|
||||
/* Handlung: endgültig löschend — auf Dunkel hell, Text dunkel */
|
||||
--ds-danger-action-bg: #ff6b6b;
|
||||
--ds-danger-action-bg-hover: #ff8a8a;
|
||||
--ds-danger-action-bg-active: #e04f4f;
|
||||
--ds-danger-action-text: #071512;
|
||||
--ds-danger-action-border: transparent;
|
||||
|
||||
/* Fokus */
|
||||
--ds-focus-ring: #d6ff3e;
|
||||
|
||||
/* Zustand */
|
||||
--ds-success: #5fe0b0;
|
||||
--ds-success-surface: #0a2a20;
|
||||
--ds-success-border: #1f5c46;
|
||||
--ds-warning: #ffc857;
|
||||
--ds-warning-surface: #2e2107;
|
||||
--ds-warning-border: #6b4e12;
|
||||
--ds-danger: #ff8a8a;
|
||||
--ds-danger-surface: #33100f;
|
||||
--ds-danger-border: #6b2626;
|
||||
--ds-info: #b9a7ff;
|
||||
--ds-info-surface: #1b1233;
|
||||
--ds-info-border: #3a2a6b;
|
||||
|
||||
/* Auswahl / Verweis / Überlagerung */
|
||||
--ds-selection-bg: #5b2be0;
|
||||
--ds-selection-text: #ffffff;
|
||||
--ds-link: #d6ff3e;
|
||||
--ds-link-hover: #e4ff76;
|
||||
--ds-overlay: rgb(4 16 13 / 70%);
|
||||
|
||||
/* Deaktiviert */
|
||||
--ds-disabled-bg: #123027;
|
||||
--ds-disabled-text: #4f6b5f;
|
||||
--ds-disabled-border: #1e3b31;
|
||||
|
||||
/* Schatten */
|
||||
--ds-shadow-1: 0 1px 2px rgb(0 0 0 / 30%);
|
||||
--ds-shadow-2: 0 8px 24px rgb(0 0 0 / 45%), 0 1px 2px rgb(0 0 0 / 30%);
|
||||
--ds-shadow-3: 0 12px 32px rgb(0 0 0 / 55%), 0 2px 6px rgb(0 0 0 / 35%);
|
||||
}
|
||||
Reference in new issue
Block a user