Release 2.2.1: quarterly billing and Sakani form polish
- Billing is always quarterly: the billing page opens the current quarter, the month view is gone, old ?month= links land in their quarter and invalid quarters no longer throw. - Calendar and release-note forms and the RSVP buttons use Sakani components (Card, Input, Textarea, FormSelect, Button, Alert). - Sidebar logo stays visible in dark mode (Sakani's logo tile is light). - Release notes for 2.2.1 seeded via custom migration 0004; popup version bumped. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c0c2425dda
commit
71110208a9
16 files changed
+2629
-250
No files matched your search
@@ -24,7 +24,8 @@ Bei jedem neuen Feature, jeder Änderung und jedem Fix im Portal:
|
||||
|
||||
Aktueller Stand: siehe neueste Einträge in `release_notes` (Basis `2.0.0`,
|
||||
Kalender/Selbstbedienung/Sortierung/Beschreibung: `2.1.0`,
|
||||
Dateiname-Suche: `2.1.1`, Statistik/Collab/Rechnungsversand: `2.2.0`).
|
||||
Dateiname-Suche: `2.1.1`, Statistik/Collab/Rechnungsversand: `2.2.0`,
|
||||
Quartalsabrechnung + Sakani-Formulare: `2.2.1`).
|
||||
|
||||
## Sicherheit (bei jeder Änderung mitprüfen)
|
||||
|
||||
|
||||
@@ -79,4 +79,5 @@ Redaktionen können Bilder durchsuchen, einen Leuchtkasten verwenden, Bilder her
|
||||
- **Fingerprint-Kompatibilität (WICHTIG):** `requestFingerprint` für `new_usage` DARF nicht um neue Felder (z. B. collab) erweitert werden — die historischen Migrationen 0001/0002 rekonstruieren Legacy-Fingerprints aus der alten Payload-Form. Tests in `tests/db/accounting-migration.test.ts` prüfen das.
|
||||
- **Rechnungsversand (2.2.0):** Finalisieren verschickt KEINE E-Mail mehr (Nutzungsnachweis dient der Prüfung; Korrekturen via Collab-Toggle oder Storno + Neu-Finalisierung). Admin lädt die Rechnungs-PDF unter Abrechnungen hoch (`POST /api/billing-reports/[reportId]/invoice`, multipart, %PDF-Magic, max 20 MB, Rate-Limit `invoiceUploadPolicy`). Der Upload speichert (`invoice_pdf`, `invoice_pdf_sha256`, …) und sendet automatisch GEBÜNDELT Rechnung + Nutzungsnachweis (`emailService.sendInvoiceBundle`, Vorlage `invoice-message.ts`). Status `invoice_email_status` (not_sent/sent/failed) + `invoice_email_sent_at`/`invoice_email_error`; „Erneut senden" via `POST …/invoice/resend`, Download via `GET …/invoice`. Audit: `invoice_uploaded`, `invoice_email_sent`, `invoice_email_failed`.
|
||||
- **Activity-Tracking (2.2.0):** `activity_events` (album_view/search/lightbox_view) nur für Browsing; Downloads bleiben in `download_events`. Server-Hooks in den Albumseiten, Lightbox-Beacon `POST /api/activity` (nur lightbox_view). `recordActivity` ist fire-and-forget: validiert, rate-limited (`activityPolicy` 240/60s), schluckt alle Fehler. Statistikseite `/admin/statistiken` (`src/modules/stats/queries.ts`, Zeitraum 7/30/90 Tage via `zeitraum`): KPI-Karten mit Trend-Pills (Vorperiode), Recharts Area/Bar (lazy, ssr:false, Theme-Farben), Top-Redaktionen/Alben, offene Umsätze, letzte Aktivitäten. SakaniUI-Elemente: Pill-Segmented-Control, Uppercase-Muted-Labels, Tabular-Nums, Hover-Shadow.
|
||||
- **Quartalsabrechnung (2.2.1):** Abgerechnet wird immer quartalsweise. `resolvePeriod` (`src/app/admin/abrechnungen/[editorialId]/page-content.ts`) liefert nur Quartale; alte `?month=`-Links landen im passenden Quartal, ungültige Werte im aktuellen. Die Billing-APIs akzeptieren weiter `month`, das UI sendet nur `quarter`. Mail-Betreff: `Ihre Rechnung für Q4 2026`. Seed der Versionshinweise: `drizzle/0004_release_notes_2_2_1.sql` (Custom-Migration ohne Schemaänderung).
|
||||
- **Lokale Verifikation (tmp/, gitignored):** Dev-Server `NEXT_DISABLE_TURBOPACK=1 next dev` (Port 3000), Mock-Immich :2283 (inkl. `/original`), Mock-SMTP :587 (`tmp/mock-smtp.mjs`, loggt nach `tmp/mock-smtp.log`), DB-Container `portal-clickthrough-db` :5433. BetterAuth-Sign-In-Limit 5/15min liegt IM SPEICHER des Dev-Servers — vor jedem Click-Through-Lauf Dev-Server neu starten; die Spec cached Session-Cookies nach dem ersten Login (`loginCached`). `tmp/dev-seed.ts` ist idempotent: User per E-Mail auflösen (signUp mit existierender E-Mail liefert Phantom-User ohne Persistenz!), 2FA-Setup überspringen wenn verified, Rechnungsadresse anlegen. Click-Through: `node_modules/.bin/playwright test --config tmp/playwright.config.ts` (7 Tests, Reset via beforeAll, FK-Reihenfolge beachten: items → download_events → usages → billing_reports).
|
||||
@@ -0,0 +1,6 @@
|
||||
-- Custom SQL migration file, put your code below! --
|
||||
INSERT INTO "release_notes" ("version", "audience", "body", "created_by_user_id")
|
||||
VALUES
|
||||
('2.2.1', 'admin', 'Abrechnungen laufen jetzt immer quartalsweise: Die Abrechnungsseite öffnet direkt das aktuelle Quartal, die Monatsansicht entfällt. Das Logo in der Seitenleiste ist im dunklen Design wieder sichtbar. Die Formulare für Kalender und Versionshinweise nutzen jetzt das einheitliche Portal-Design.', NULL),
|
||||
('2.2.1', 'editorial', 'Die Rückmeldung zu Kalender-Terminen (Bin da / Bin nicht da) passt sich jetzt dem hellen und dunklen Design an, und das Logo in der Seitenleiste ist im dunklen Design wieder sichtbar.', NULL)
|
||||
ON CONFLICT ("version", "audience") DO NOTHING;
|
||||
File diff suppressed because it is too large.
Load diff
@@ -29,6 +29,13 @@
|
||||
"when": 1796067598623,
|
||||
"tag": "0003_collab_invoice_activity",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 4,
|
||||
"version": "7",
|
||||
"when": 1796073940910,
|
||||
"tag": "0004_release_notes_2_2_1",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -70,10 +70,8 @@ const defaultProps = {
|
||||
editorialId: "e1",
|
||||
repeatDownloads: [] as RepeatDownloadPosition[],
|
||||
year: 2026,
|
||||
month: 8 as number | null,
|
||||
quarter: null as number | null,
|
||||
isQuarter: false,
|
||||
periodLabel: "August 2026",
|
||||
quarter: 3,
|
||||
periodLabel: "Q3 2026",
|
||||
reports: [] as FinalizedReportSummary[],
|
||||
};
|
||||
|
||||
@@ -110,7 +108,7 @@ test("disables the checkbox for billed positions and shows report reference", ()
|
||||
expect(screen.getByText(/RE-2026-042/)).toBeTruthy();
|
||||
});
|
||||
|
||||
test("selects all open positions via Alle offenen im Monat", () => {
|
||||
test("selects all open positions via Alle offenen im Quartal", () => {
|
||||
render(
|
||||
<BillingSelection
|
||||
{...defaultProps}
|
||||
@@ -118,7 +116,7 @@ test("selects all open positions via Alle offenen im Monat", () => {
|
||||
/>,
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: /Alle offenen im Monat/i }));
|
||||
fireEvent.click(screen.getByRole("button", { name: /Alle offenen im Quartal/i }));
|
||||
|
||||
expect(getCheckbox("jubel.jpg").checked).toBe(true);
|
||||
expect(getCheckbox("redaktion.jpg").checked).toBe(true);
|
||||
@@ -149,7 +147,7 @@ test("displays selected count and cents-derived EUR total", () => {
|
||||
/>,
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: /Alle offenen im Monat/i }));
|
||||
fireEvent.click(screen.getByRole("button", { name: /Alle offenen im Quartal/i }));
|
||||
|
||||
const summary = container.querySelector(".billing-summary");
|
||||
expect(summary?.textContent ?? "").toMatch(/2 Nutzungen ausgewählt/);
|
||||
@@ -180,30 +178,11 @@ test("shows empty state when no billable positions exist", () => {
|
||||
expect(screen.getByText(/Keine abrechenbaren Nutzungen/)).toBeTruthy();
|
||||
});
|
||||
|
||||
test("links to quarter view from month view", () => {
|
||||
render(
|
||||
<BillingSelection
|
||||
{...defaultProps}
|
||||
positions={[openPosition]}
|
||||
/>,
|
||||
);
|
||||
test("offers only quarterly periods", () => {
|
||||
render(<BillingSelection {...defaultProps} positions={[openPosition]} />);
|
||||
|
||||
const quarterLink = screen.getByRole("link", { name: /Ganzes Quartal/i });
|
||||
expect(quarterLink.getAttribute("href") ?? "").toContain("quarter=3");
|
||||
});
|
||||
|
||||
test("links to month view from quarter view", () => {
|
||||
render(
|
||||
<BillingSelection
|
||||
{...defaultProps}
|
||||
positions={[openPosition]}
|
||||
month={null}
|
||||
quarter={3}
|
||||
isQuarter={true}
|
||||
periodLabel="Q3 2026"
|
||||
/>,
|
||||
);
|
||||
|
||||
const monthLink = screen.getByRole("link", { name: /Monatsansicht/i });
|
||||
expect(monthLink.getAttribute("href") ?? "").toContain("month=");
|
||||
expect(screen.queryByRole("link", { name: /Monatsansicht/i })).toBeNull();
|
||||
expect(screen.queryByText("Monat")).toBeNull();
|
||||
expect(screen.getByText("Quartal")).toBeTruthy();
|
||||
expect(screen.getByText(/Zeitraum: Q3 2026/)).toBeTruthy();
|
||||
});
|
||||
@@ -1,7 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { useMemo, useState } from "react";
|
||||
import Link from "next/link";
|
||||
import { Alert, Badge, Checkbox, EmptyState, Table, Textarea } from "@sakaniui/react";
|
||||
import { IconDownload, IconFileText } from "@sakaniui/react/icons";
|
||||
|
||||
@@ -17,28 +16,11 @@ type BillingSelectionProps = {
|
||||
positions: BillingPosition[];
|
||||
repeatDownloads: RepeatDownloadPosition[];
|
||||
year: number;
|
||||
month: number | null;
|
||||
quarter: number | null;
|
||||
isQuarter: boolean;
|
||||
quarter: number;
|
||||
periodLabel: string;
|
||||
reports: FinalizedReportSummary[];
|
||||
};
|
||||
|
||||
const MONTHS = [
|
||||
"Januar",
|
||||
"Februar",
|
||||
"März",
|
||||
"April",
|
||||
"Mai",
|
||||
"Juni",
|
||||
"Juli",
|
||||
"August",
|
||||
"September",
|
||||
"Oktober",
|
||||
"November",
|
||||
"Dezember",
|
||||
];
|
||||
|
||||
const STATUS_LABELS: Record<BillingPosition["status"], string> = {
|
||||
open: "Offen",
|
||||
billed: "Abgerechnet",
|
||||
@@ -62,9 +44,7 @@ export function BillingSelection({
|
||||
positions,
|
||||
repeatDownloads,
|
||||
year,
|
||||
month,
|
||||
quarter,
|
||||
isQuarter,
|
||||
periodLabel,
|
||||
reports,
|
||||
}: BillingSelectionProps) {
|
||||
@@ -107,7 +87,7 @@ export function BillingSelection({
|
||||
setSelectedIds(new Set());
|
||||
}
|
||||
|
||||
const periodPayload = { year, ...(isQuarter ? { quarter: quarter ?? 1 } : { month: month ?? 1 }) };
|
||||
const periodPayload = { year, quarter };
|
||||
|
||||
async function handlePreview() {
|
||||
if (selectedIds.size === 0) return;
|
||||
@@ -195,22 +175,14 @@ export function BillingSelection({
|
||||
}
|
||||
}
|
||||
|
||||
const quarterParam = isQuarter ? null : Math.ceil((month ?? 1) / 3);
|
||||
const quarterHref = quarter
|
||||
? `/admin/abrechnungen/${editorialId}?year=${year}&quarter=${quarter}`
|
||||
: `/admin/abrechnungen/${editorialId}?year=${year}&quarter=${quarterParam}`;
|
||||
const monthHref = `/admin/abrechnungen/${editorialId}?year=${year}&month=${month ?? (quarter ? (quarter - 1) * 3 + 1 : new Date().getUTCMonth() + 1)}`;
|
||||
|
||||
return (
|
||||
<>
|
||||
<PeriodSelector year={year} month={month} quarter={quarter} isQuarter={isQuarter} />
|
||||
<PeriodSelector year={year} quarter={quarter} />
|
||||
|
||||
<div className="flex flex-wrap items-center gap-3">
|
||||
<Button type="button" variant="secondary" onClick={selectAllOpen} disabled={selectablePositions.length === 0}>
|
||||
{isQuarter ? "Alle offenen im Quartal" : "Alle offenen im Monat"}
|
||||
</Button>
|
||||
<Button asChild variant="outline">
|
||||
{isQuarter ? <Link href={monthHref}>Monatsansicht</Link> : <Link href={quarterHref}>Ganzes Quartal</Link>}
|
||||
Alle offenen im Quartal
|
||||
</Button>
|
||||
<Button type="button" variant="ghost" onClick={clearSelection} disabled={selectedCount === 0}>
|
||||
Auswahl aufheben
|
||||
@@ -223,7 +195,7 @@ export function BillingSelection({
|
||||
<section className="flex flex-col gap-3" aria-labelledby="positions-title">
|
||||
<h2 id="positions-title" className="text-lg font-semibold">Abrechenbare Nutzungen</h2>
|
||||
{positions.length === 0 ? (
|
||||
<EmptyState title="Keine abrechenbaren Nutzungen in diesem Zeitraum." description="Wählen Sie oben einen anderen Monat oder ein Quartal." />
|
||||
<EmptyState title="Keine abrechenbaren Nutzungen in diesem Zeitraum." description="Wählen Sie oben ein anderes Quartal." />
|
||||
) : (
|
||||
<Table<BillingPosition>
|
||||
rowKey={(position) => position.id}
|
||||
@@ -426,12 +398,10 @@ export function BillingSelection({
|
||||
|
||||
type PeriodSelectorProps = {
|
||||
year: number;
|
||||
month: number | null;
|
||||
quarter: number | null;
|
||||
isQuarter: boolean;
|
||||
quarter: number;
|
||||
};
|
||||
|
||||
function PeriodSelector({ year, month, quarter, isQuarter }: PeriodSelectorProps) {
|
||||
function PeriodSelector({ year, quarter }: PeriodSelectorProps) {
|
||||
const years = [2025, 2026, 2027];
|
||||
|
||||
return (
|
||||
@@ -440,25 +410,14 @@ function PeriodSelector({ year, month, quarter, isQuarter }: PeriodSelectorProps
|
||||
<div className="w-32">
|
||||
<FormSelect name="year" label="Jahr" defaultValue={String(year)} options={years.map((y) => ({ label: String(y), value: String(y) }))} />
|
||||
</div>
|
||||
{isQuarter ? (
|
||||
<div className="w-32">
|
||||
<FormSelect
|
||||
name="quarter"
|
||||
label="Quartal"
|
||||
defaultValue={String(quarter ?? 1)}
|
||||
defaultValue={String(quarter)}
|
||||
options={[1, 2, 3, 4].map((q) => ({ label: `Q${q}`, value: String(q) }))}
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div className="w-40">
|
||||
<FormSelect
|
||||
name="month"
|
||||
label="Monat"
|
||||
defaultValue={String(month ?? 8)}
|
||||
options={MONTHS.map((name, index) => ({ label: name, value: String(index + 1) }))}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
<Button type="submit" variant="secondary">Zeitraum laden</Button>
|
||||
</form>
|
||||
</Card>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { expect, test } from "vitest";
|
||||
|
||||
import { resolvePeriod } from "./page-content";
|
||||
|
||||
test("resolvePeriod is always quarterly", () => {
|
||||
expect(resolvePeriod({ year: "2026", quarter: "4" })).toMatchObject({ year: 2026, quarter: 4, periodLabel: "Q4 2026" });
|
||||
// Old month links land in their quarter.
|
||||
expect(resolvePeriod({ year: "2026", month: "8" })).toMatchObject({ quarter: 3, periodLabel: "Q3 2026" });
|
||||
// Invalid quarters fall back to the current one instead of throwing.
|
||||
const current = Math.floor(new Date().getUTCMonth() / 3) + 1;
|
||||
expect(resolvePeriod({ year: "2026", quarter: "7" }).quarter).toBe(current);
|
||||
expect(resolvePeriod({}).quarter).toBe(current);
|
||||
});
|
||||
@@ -5,7 +5,7 @@ import { desc, eq } from "drizzle-orm";
|
||||
import { db } from "@/db/client";
|
||||
import { billingReports, editorialAccounts } from "@/db/schema";
|
||||
import { queries } from "@/modules/billing/queries";
|
||||
import { monthPeriod, quarterPeriod, type BillingPeriod } from "@/modules/billing/period";
|
||||
import { quarterPeriod, type BillingPeriod } from "@/modules/billing/period";
|
||||
import type { BillingPosition, RepeatDownloadPosition } from "@/modules/billing/queries";
|
||||
|
||||
export type FinalizedReportSummary = {
|
||||
@@ -25,10 +25,8 @@ export type BillingSelectionData = {
|
||||
editorial: { id: string; name: string };
|
||||
period: BillingPeriod;
|
||||
periodLabel: string;
|
||||
isQuarter: boolean;
|
||||
year: number;
|
||||
month: number | null;
|
||||
quarter: number | null;
|
||||
quarter: number;
|
||||
positions: BillingPosition[];
|
||||
repeatDownloads: RepeatDownloadPosition[];
|
||||
reports: FinalizedReportSummary[];
|
||||
@@ -45,7 +43,7 @@ export async function loadBillingSelection(
|
||||
.limit(1);
|
||||
if (!editorial) return null;
|
||||
|
||||
const { period, isQuarter, year, month, quarter, periodLabel } = resolvePeriod(searchParams);
|
||||
const { period, year, quarter, periodLabel } = resolvePeriod(searchParams);
|
||||
|
||||
const [positions, repeatDownloads, reportRows] = await Promise.all([
|
||||
queries.listBillablePositions(editorialId, period),
|
||||
@@ -72,9 +70,7 @@ export async function loadBillingSelection(
|
||||
editorial,
|
||||
period,
|
||||
periodLabel,
|
||||
isQuarter,
|
||||
year,
|
||||
month,
|
||||
quarter,
|
||||
positions,
|
||||
repeatDownloads,
|
||||
@@ -93,60 +89,26 @@ export async function loadBillingSelection(
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Billing is always quarterly. An old `?month=` link resolves to its quarter;
|
||||
* invalid values fall back to the current quarter.
|
||||
*/
|
||||
export function resolvePeriod(searchParams: Record<string, string | string[] | undefined>): {
|
||||
period: BillingPeriod;
|
||||
isQuarter: boolean;
|
||||
year: number;
|
||||
month: number | null;
|
||||
quarter: number | null;
|
||||
quarter: number;
|
||||
periodLabel: string;
|
||||
} {
|
||||
const now = new Date();
|
||||
const defaultYear = now.getUTCFullYear();
|
||||
const defaultMonth = now.getUTCMonth() + 1;
|
||||
|
||||
const year = parseNumberParam(searchParams.year, defaultYear);
|
||||
const quarterParam = firstParam(searchParams.quarter);
|
||||
|
||||
if (quarterParam !== undefined) {
|
||||
const quarter = parseNumberParam(searchParams.quarter, Math.floor((defaultMonth - 1) / 3) + 1);
|
||||
return {
|
||||
period: quarterPeriod(year, quarter),
|
||||
isQuarter: true,
|
||||
year,
|
||||
month: null,
|
||||
quarter,
|
||||
periodLabel: `Q${quarter} ${year}`,
|
||||
};
|
||||
}
|
||||
|
||||
const month = parseNumberParam(searchParams.month, defaultMonth);
|
||||
return {
|
||||
period: monthPeriod(year, month),
|
||||
isQuarter: false,
|
||||
year,
|
||||
month,
|
||||
quarter: null,
|
||||
periodLabel: monthLabel(year, month),
|
||||
};
|
||||
}
|
||||
|
||||
function monthLabel(year: number, month: number): string {
|
||||
const names = [
|
||||
"Januar",
|
||||
"Februar",
|
||||
"März",
|
||||
"April",
|
||||
"Mai",
|
||||
"Juni",
|
||||
"Juli",
|
||||
"August",
|
||||
"September",
|
||||
"Oktober",
|
||||
"November",
|
||||
"Dezember",
|
||||
];
|
||||
return `${names[month - 1]} ${year}`;
|
||||
const currentQuarter = Math.floor(now.getUTCMonth() / 3) + 1;
|
||||
const year = parseNumberParam(searchParams.year, now.getUTCFullYear());
|
||||
const month = parseNumberParam(searchParams.month, 0);
|
||||
const requested = parseNumberParam(
|
||||
searchParams.quarter,
|
||||
month >= 1 && month <= 12 ? Math.floor((month - 1) / 3) + 1 : currentQuarter,
|
||||
);
|
||||
const quarter = requested >= 1 && requested <= 4 ? requested : currentQuarter;
|
||||
return { period: quarterPeriod(year, quarter), year, quarter, periodLabel: `Q${quarter} ${year}` };
|
||||
}
|
||||
|
||||
function parseNumberParam(
|
||||
|
||||
@@ -32,9 +32,7 @@ export default async function BillingSelectionPage({
|
||||
positions={data.positions}
|
||||
repeatDownloads={data.repeatDownloads}
|
||||
year={data.year}
|
||||
month={data.month}
|
||||
quarter={data.quarter}
|
||||
isQuarter={data.isQuarter}
|
||||
periodLabel={data.periodLabel}
|
||||
reports={data.reports}
|
||||
/>
|
||||
|
||||
@@ -27,7 +27,7 @@ export default async function BillingOverviewPage() {
|
||||
kicker="Abrechnungen"
|
||||
title="Redaktionen"
|
||||
titleId="billing-title"
|
||||
description="Wählen Sie eine Redaktion, um deren abrechenbare Nutzungen für einen Monat oder ein Quartal auszuwählen."
|
||||
description="Wählen Sie eine Redaktion, um deren abrechenbare Nutzungen für ein Quartal auszuwählen."
|
||||
/>
|
||||
{editorials.length === 0 ? (
|
||||
<EmptyState title="Noch keine Redaktionen registriert." description="Registrierte Redaktionen erscheinen hier zur Abrechnung." />
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
import { useId, useState, useTransition } from "react";
|
||||
|
||||
import { Alert, Input } from "@sakaniui/react";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Card, FormSelect } from "@/components/ui/sakani";
|
||||
|
||||
import type { CalendarActionResult } from "./actions";
|
||||
|
||||
@@ -18,7 +20,6 @@ export function CalendarEventForm({
|
||||
}>) {
|
||||
const titleId = useId();
|
||||
const dateId = useId();
|
||||
const albumId = useId();
|
||||
const [state, setState] = useState<CalendarActionResult>({ ok: true, message: "" });
|
||||
const [pending, startTransition] = useTransition();
|
||||
const [title, setTitle] = useState("");
|
||||
@@ -34,66 +35,45 @@ export function CalendarEventForm({
|
||||
};
|
||||
|
||||
return (
|
||||
<form
|
||||
action={handleSubmit}
|
||||
className="bg-card p-4 rounded-xl border border-border shadow-sm space-y-4"
|
||||
>
|
||||
<div className="space-y-2">
|
||||
<label htmlFor={titleId} className="text-sm font-medium">
|
||||
Titel (Spielpaarung oder Event)
|
||||
</label>
|
||||
<Card title="Neuer Termin">
|
||||
<form action={handleSubmit} className="flex flex-col gap-4">
|
||||
<Input
|
||||
description="Ohne direkte Album-Auswahl wird automatisch verknüpft, sobald ein Album exakt „{Titel}“ oder „{Titel} | TT.MM.JJJJ“ heißt (Datum dieses Termins)."
|
||||
id={titleId}
|
||||
name="title"
|
||||
value={title}
|
||||
onChange={(event) => setTitle(event.target.value)}
|
||||
label="Titel (Spielpaarung oder Event)"
|
||||
maxLength={200}
|
||||
required
|
||||
name="title"
|
||||
onChange={(event) => setTitle(event.target.value)}
|
||||
placeholder="z. B. Hamburger SV - VfL Wolfsburg"
|
||||
required
|
||||
value={title}
|
||||
/>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
Ohne direkte Album-Auswahl wird automatisch verknüpft, sobald ein Album exakt
|
||||
{" „{Titel}“ "}oder{" „{Titel} | TT.MM.JJJJ“ "}heißt (Datum dieses Termins).
|
||||
</p>
|
||||
<div className="flex flex-col gap-4 sm:flex-row">
|
||||
<div className="sm:w-48">
|
||||
<Input defaultValue={defaultEventDate} id={dateId} label="Datum" name="eventDate" required type="date" />
|
||||
</div>
|
||||
<div className="flex flex-col sm:flex-row gap-4">
|
||||
<div className="space-y-2">
|
||||
<label htmlFor={dateId} className="text-sm font-medium">
|
||||
Datum
|
||||
</label>
|
||||
<Input id={dateId} type="date" name="eventDate" defaultValue={defaultEventDate} required className="sm:w-48" />
|
||||
</div>
|
||||
<div className="space-y-2 flex-1">
|
||||
<label htmlFor={albumId} className="text-sm font-medium">
|
||||
Album direkt verknüpfen (optional)
|
||||
</label>
|
||||
<select
|
||||
id={albumId}
|
||||
<div className="flex-1">
|
||||
<FormSelect
|
||||
label="Album direkt verknüpfen (optional)"
|
||||
name="immichAlbumId"
|
||||
defaultValue=""
|
||||
className="flex h-10 w-full rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500"
|
||||
>
|
||||
<option value="">Automatisch über den Namen</option>
|
||||
{albums.map((album) => (
|
||||
<option key={album.id} value={album.id}>
|
||||
{album.albumName}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
options={[
|
||||
{ label: "Automatisch über den Namen", value: "" },
|
||||
...albums.map((album) => ({ label: album.albumName, value: album.id })),
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<Button type="submit" disabled={pending}>
|
||||
{pending ? "Wird angelegt …" : "Termin anlegen"}
|
||||
</Button>
|
||||
</div>
|
||||
{state.message ? (
|
||||
<p
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
className={state.ok ? "text-sm text-green-600 dark:text-green-400" : "text-sm text-destructive"}
|
||||
>
|
||||
{state.message}
|
||||
</p>
|
||||
<div aria-live="polite">
|
||||
<Alert color={state.ok ? "success" : "danger"} description={state.message} />
|
||||
</div>
|
||||
) : null}
|
||||
</form>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -2,8 +2,10 @@
|
||||
|
||||
import { useId, useState, useTransition } from "react";
|
||||
|
||||
import { Alert, Input, Textarea } from "@sakaniui/react";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Card, FormSelect } from "@/components/ui/sakani";
|
||||
|
||||
import type { ReleaseNoteActionResult } from "./actions";
|
||||
|
||||
@@ -13,7 +15,6 @@ export function ReleaseNoteForm({
|
||||
action: (state: ReleaseNoteActionResult, formData: FormData) => Promise<ReleaseNoteActionResult>;
|
||||
}>) {
|
||||
const versionId = useId();
|
||||
const audienceId = useId();
|
||||
const bodyId = useId();
|
||||
const [state, setState] = useState<ReleaseNoteActionResult>({ ok: true, message: "" });
|
||||
const [pending, startTransition] = useTransition();
|
||||
@@ -30,62 +31,48 @@ export function ReleaseNoteForm({
|
||||
};
|
||||
|
||||
return (
|
||||
<form
|
||||
action={handleSubmit}
|
||||
className="bg-card p-4 rounded-xl border border-border shadow-sm space-y-4"
|
||||
>
|
||||
<div className="flex flex-col sm:flex-row gap-4">
|
||||
<div className="space-y-2">
|
||||
<label htmlFor={versionId} className="text-sm font-medium">
|
||||
Version
|
||||
</label>
|
||||
<Input id={versionId} name="version" placeholder="z. B. 2.1.1" required className="sm:w-36" />
|
||||
<Card title="Neuer Versionshinweis">
|
||||
<form action={handleSubmit} className="flex flex-col gap-4">
|
||||
<div className="flex flex-col gap-4 sm:flex-row">
|
||||
<div className="sm:w-36">
|
||||
<Input id={versionId} label="Version" name="version" placeholder="z. B. 2.1.1" required />
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label htmlFor={audienceId} className="text-sm font-medium">
|
||||
Zielgruppe
|
||||
</label>
|
||||
<select
|
||||
id={audienceId}
|
||||
name="audience"
|
||||
<div className="sm:w-48">
|
||||
<FormSelect
|
||||
defaultValue="editorial"
|
||||
className="flex h-10 w-full sm:w-48 rounded-md border border-border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary-500"
|
||||
>
|
||||
<option value="editorial">Redaktionen</option>
|
||||
<option value="admin">Admins</option>
|
||||
<option value="both">Beide</option>
|
||||
</select>
|
||||
label="Zielgruppe"
|
||||
name="audience"
|
||||
options={[
|
||||
{ label: "Redaktionen", value: "editorial" },
|
||||
{ label: "Admins", value: "admin" },
|
||||
{ label: "Beide", value: "both" },
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div className="space-y-2">
|
||||
<label htmlFor={bodyId} className="text-sm font-medium">
|
||||
Hinweis
|
||||
</label>
|
||||
<textarea
|
||||
<Textarea
|
||||
description={`${body.length}/2000 Zeichen`}
|
||||
id={bodyId}
|
||||
name="body"
|
||||
rows={4}
|
||||
label="Hinweis"
|
||||
maxLength={2000}
|
||||
required
|
||||
value={body}
|
||||
name="body"
|
||||
onChange={(event) => setBody(event.target.value)}
|
||||
placeholder="Was ist neu in dieser Version?"
|
||||
className="flex w-full rounded-md border border-border bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50"
|
||||
required
|
||||
rows={4}
|
||||
value={body}
|
||||
/>
|
||||
<p className="text-xs text-muted-foreground">{body.length}/2000 Zeichen</p>
|
||||
</div>
|
||||
<div>
|
||||
<Button type="submit" disabled={pending}>
|
||||
{pending ? "Wird veröffentlicht …" : "Hinweis veröffentlichen"}
|
||||
</Button>
|
||||
</div>
|
||||
{state.message ? (
|
||||
<p
|
||||
role="status"
|
||||
aria-live="polite"
|
||||
className={state.ok ? "text-sm text-green-600 dark:text-green-400" : "text-sm text-destructive"}
|
||||
>
|
||||
{state.message}
|
||||
</p>
|
||||
<div aria-live="polite">
|
||||
<Alert color={state.ok ? "success" : "danger"} description={state.message} />
|
||||
</div>
|
||||
) : null}
|
||||
</form>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useTransition } from "react";
|
||||
import { Button } from "@sakaniui/react";
|
||||
|
||||
import type { EventResponseStatus } from "@/modules/calendar/service";
|
||||
|
||||
@@ -34,35 +35,30 @@ export function EventRsvpButtons({
|
||||
});
|
||||
};
|
||||
|
||||
const base =
|
||||
"min-h-11 rounded-md border px-4 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500 disabled:cursor-not-allowed disabled:opacity-50";
|
||||
const active = "border-primary-600 bg-primary-600 text-white";
|
||||
const inactive = "border-border bg-background hover:bg-accent";
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="flex flex-wrap gap-2" role="group" aria-label="Rückmeldung zu diesem Termin">
|
||||
<button
|
||||
<Button
|
||||
type="button"
|
||||
className={`${base} ${response === "attending" ? active : inactive}`}
|
||||
variant={response === "attending" ? "primary" : "outline"}
|
||||
aria-pressed={response === "attending"}
|
||||
disabled={pending}
|
||||
onClick={() => respond("attending")}
|
||||
>
|
||||
Bin da
|
||||
</button>
|
||||
<button
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
className={`${base} ${response === "not_attending" ? active : inactive}`}
|
||||
variant={response === "not_attending" ? "primary" : "outline"}
|
||||
aria-pressed={response === "not_attending"}
|
||||
disabled={pending}
|
||||
onClick={() => respond("not_attending")}
|
||||
>
|
||||
Bin nicht da
|
||||
</button>
|
||||
</Button>
|
||||
</div>
|
||||
{error ? (
|
||||
<p role="alert" className="text-xs text-destructive">
|
||||
<p role="alert" className="text-xs text-[var(--color-danger-fg)]">
|
||||
{error}
|
||||
</p>
|
||||
) : null}
|
||||
|
||||
@@ -132,11 +132,9 @@ export function AppShell({
|
||||
subtitle="Leon Tonhäuser Sportfotografie"
|
||||
logo={
|
||||
// Decorative: the header title next to it names the portal.
|
||||
// brand-logo-light/-dark only toggle display via the .dark class.
|
||||
<>
|
||||
<img alt="" className="brand-logo-light" height={32} src="/brand/logo-black.png" width={32} />
|
||||
<img alt="" className="brand-logo-dark" height={32} src="/brand/logo-white.png" width={32} />
|
||||
</>
|
||||
// Sakani's logo tile is light in both themes (white in dark
|
||||
// mode), so the black logo is the visible one everywhere.
|
||||
<img alt="" height={32} src="/brand/logo-black.png" width={32} />
|
||||
}
|
||||
/>
|
||||
<div className="mt-4 flex flex-col gap-1">
|
||||
|
||||
@@ -8,7 +8,7 @@ import { IconCheck } from "@sakaniui/react/icons";
|
||||
// then sees the popup once more. ponytail: only the latest release is kept;
|
||||
// add a history list when users ask for older notes.
|
||||
export const RELEASE = {
|
||||
version: "2.2",
|
||||
version: "2.2.1",
|
||||
title: "Kalender, Statistiken, Collab und Rechnungen",
|
||||
notes: {
|
||||
redaktion: [
|
||||
@@ -24,6 +24,7 @@ export const RELEASE = {
|
||||
"Kalender unter /admin/kalender: Termine anlegen, Alben verknüpfen, Zusagen der Redaktionen einsehen.",
|
||||
"Collab-Nutzung je Redaktion freischalten; Collab-Positionen erscheinen mit 0,00 € in der Abrechnung und lassen sich dort korrigieren.",
|
||||
"Rechnungs-PDF je Abrechnung hochladen: danach geht die Rechnung gebündelt mit dem Nutzungsnachweis automatisch per E-Mail raus. Der Nutzungsnachweis wird beim Finalisieren nicht mehr automatisch verschickt.",
|
||||
"Abrechnungen laufen immer quartalsweise: Die Abrechnungsseite öffnet direkt das aktuelle Quartal.",
|
||||
"Versionshinweise werden unter /admin/versionen gepflegt.",
|
||||
],
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user