Release 2.4.0: bulk download rework, toasts and Sakani polish

- ZIP download from the Merkzettel: every photo is a new usage by
  default; only already downloaded photos offer "Neu / Bereits genutzt"
  (SegmentedControl), with thumbnails and a cost summary. "Bild
  auslassen" is gone.
- Toasts (Sakani Toaster) for admin saves, deletes and errors; billing
  errors are readable and use router.refresh instead of reloads. Errors
  inside modal dialogs stay inline (a toast would sit behind the
  backdrop).
- Album overview in blog-listing style, Sakani Pagination for albums,
  search and usage history, skeleton loading states.
- Registration stepper; verification mail lands on step 3.
- Editorials as a searchable, filterable table; audit log with event
  picker, German labels and collapsible details.
- Release notes 2.4.0 seeded (migration 0009).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Leon TonhäuserandClaude Opus 5.5 committed 2026-12-01 00:09:37 +01:00
1 parent 2775b406bf
commit cba70310f9
48 files changed
+3474 -454

No files matched your search

@@ -1,6 +1,6 @@
// @vitest-environment jsdom
import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";
import { cleanup, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
import { afterEach, expect, test, vi } from "vitest";
import { DownloadLightboxForm } from "./DownloadLightboxForm";
@@ -12,33 +12,45 @@ afterEach(() => {
vi.unstubAllGlobals();
});
test("confirms new and previous uses separately and preserves the keys after a failed request", async () => {
const fetch = vi.fn().mockRejectedValue(new Error("connection lost"));
vi.stubGlobal("fetch", fetch);
render(<DownloadLightboxForm
photos={[
{ assetId: "first", albumId: "allowed", filename: "first.jpg" },
{ assetId: "second", albumId: "allowed", filename: "second.jpg" },
]}
options={{
priceCents: 1500,
collabEnabled: false,
priorUsagesByAsset: {
second: [{ id: "prior", purpose: "Früherer Artikel", createdAt: "2026-11-01T12:00:00Z" }],
},
}}
/>);
fireEvent.click(screen.getByRole("button", { name: "ZIP-Download vorbereiten" }));
expect((screen.getByRole("button", { name: "ZIP herunterladen" }) as HTMLButtonElement).disabled).toBe(true);
const photos = [
{ assetId: "first", albumId: "allowed", filename: "first.jpg" },
{ assetId: "second", albumId: "allowed", filename: "second.jpg" },
];
const options = {
priceCents: 1500,
collabEnabled: false,
priorUsagesByAsset: {
second: [{ id: "prior", purpose: "Früherer Artikel", createdAt: "2026-11-01T12:00:00Z" }],
},
};
test("books every photo as a new usage and offers a choice only for already downloaded ones", () => {
render(<DownloadLightboxForm options={options} photos={photos} />);
fireEvent.click(screen.getByRole("button", { name: "ZIP-Download vorbereiten" }));
expect(screen.queryByText("Bild auslassen")).toBeNull();
const [firstRow, secondRow] = screen.getAllByRole("listitem");
expect(within(firstRow).queryByText("Bereits genutzt")).toBeNull();
expect(within(secondRow).getByText("Bereits genutzt")).toBeTruthy();
fireEvent.change(screen.getByRole("combobox", { name: "first.jpg" }), { target: { value: "new" } });
fireEvent.change(screen.getByRole("combobox", { name: "second.jpg" }), { target: { value: "prior" } });
const submit = screen.getByRole<HTMLButtonElement>("button", { name: "Nutzungen bestätigen und laden" });
expect(submit.disabled).toBe(true);
fireEvent.change(screen.getByLabelText("Gemeinsamer Zweck für neue Nutzungen"), {
target: { value: "Neuer Artikel" },
});
expect(screen.getByRole("status").textContent).toMatch(/1 neue Nutzung.*15,00/);
fireEvent.change(screen.getByLabelText("Verwendungszweck"), { target: { value: "Neuer Artikel" } });
expect(submit.disabled).toBe(false);
expect(screen.getByRole("status").textContent).toMatch(/2 neue Nutzungen.*30,00/);
});
test("switching to 'Bereits genutzt' repeats the earlier usage and keeps keys after a failed request", async () => {
const fetch = vi.fn().mockRejectedValue(new Error("connection lost"));
vi.stubGlobal("fetch", fetch);
render(<DownloadLightboxForm options={options} photos={photos} />);
fireEvent.click(screen.getByRole("button", { name: "ZIP-Download vorbereiten" }));
fireEvent.click(within(screen.getAllByRole("listitem")[1]).getByText("Bereits genutzt"));
fireEvent.change(screen.getByLabelText("Verwendungszweck"), { target: { value: "Neuer Artikel" } });
expect(screen.getByRole("status").textContent).toMatch(/1 neue Nutzung.*1 kostenlos erneut.*15,00/);
const submit = screen.getByRole<HTMLButtonElement>("button", { name: "Nutzungen bestätigen und laden" });
fireEvent.click(submit);
await waitFor(() => expect(submit.disabled).toBe(false));
fireEvent.click(submit);