Release 2.2.2: version history linked from the release popup

- ReleaseHistory groups release notes by version (sorted by version
  number, newest marked "Aktuell") and renders them as Sakani cards on
  /redaktion/neuigkeiten and /admin/versionen (with audience + delete).
- The "Was ist neu?" popup links to the history ("Frühere Änderungen
  ansehen") and closes on navigation.
- Release notes for 2.2.2 seeded via custom migration 0005; popup
  version bumped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Leon TonhäuserandClaude Opus 5.5 committed 2026-11-30 22:45:37 +01:00
1 parent 71110208a9
commit d479e1e79b
9 files changed
+2671 -70

No files matched your search

+5 -2
View File
@@ -25,7 +25,7 @@ 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`,
Quartalsabrechnung + Sakani-Formulare: `2.2.1`).
Quartalsabrechnung + Sakani-Formulare: `2.2.1`, Versionshistorie: `2.2.2`).
## Sicherheit (bei jeder Änderung mitprüfen)
@@ -54,7 +54,10 @@ Quartalsabrechnung + Sakani-Formulare: `2.2.1`).
- Navigation lebt in `src/components/layout/app-shell.tsx` (AREAS), nicht in
den Layouts. Release-Popup: `src/components/layout/release-notes.tsx`
(RELEASE.version bei jedem Release bumpen); die pflegbare Historie liegt
in `release_notes` (/admin/versionen, /redaktion/neuigkeiten).
in `release_notes` und wird über `ReleaseHistory`
(`src/modules/releases/release-history.tsx`, nach Version gruppiert)
unter /admin/versionen und /redaktion/neuigkeiten angezeigt; das Popup
verlinkt mit „Frühere Änderungen ansehen“ dorthin.
- Header-Logo: `/brand/logo-black.png` / `logo-white.png` (AppShell/PublicShell).
Originale bleiben für Wasserzeichen/E-Mail/PDF unverändert.
+6
View File
@@ -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.2', 'admin', 'Versionshistorie: Unter /admin/versionen sind alle Hinweise jetzt nach Version gruppiert, neueste zuerst. Das Fenster „Was ist neu?“ verlinkt direkt auf die früheren Änderungen.', NULL),
('2.2.2', 'editorial', 'Neu: Unter Neuigkeiten steht die komplette Versionshistorie mit allen Änderungen seit Version 2.0. Das Fenster „Was ist neu?“ führt über „Frühere Änderungen ansehen“ direkt dorthin.', NULL)
ON CONFLICT ("version", "audience") DO NOTHING;
File diff suppressed because it is too large. Load diff
+7
View File
@@ -36,6 +36,13 @@
"when": 1796073940910,
"tag": "0004_release_notes_2_2_1",
"breakpoints": true
},
{
"idx": 5,
"version": "7",
"when": 1796074977959,
"tag": "0005_release_notes_2_2_2",
"breakpoints": true
}
]
}
+12 -40
View File
@@ -1,21 +1,16 @@
import { PageHeader } from "@/components/ui/page-header";
import { releaseNoteService, type ReleaseNoteAudience } from "@/modules/releases/service";
import { ReleaseHistory } from "@/modules/releases/release-history";
import { releaseNoteService } from "@/modules/releases/service";
import { DeleteReleaseNoteButton } from "./DeleteReleaseNoteButton";
import { ReleaseNoteForm } from "./ReleaseNoteForm";
import { createReleaseNoteAction, deleteReleaseNoteAction } from "./actions";
const audienceLabels: Record<ReleaseNoteAudience, string> = {
admin: "Admins",
editorial: "Redaktionen",
both: "Beide",
};
export default async function AdminVersionsPage() {
const notes = await releaseNoteService.listReleaseNotes();
return (
<div className="space-y-8 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500">
<section className="flex flex-col gap-6">
<PageHeader
kicker="Portal"
title="Versionshinweise"
@@ -24,43 +19,20 @@ export default async function AdminVersionsPage() {
<ReleaseNoteForm action={createReleaseNoteAction} />
<section className="space-y-4" aria-labelledby="release-notes-list-title">
<section className="flex flex-col gap-4" aria-labelledby="release-notes-list-title">
<div className="flex items-baseline justify-between">
<h2 id="release-notes-list-title" className="text-xl font-semibold">
Alle Hinweise
Versionshistorie
</h2>
<p className="text-sm text-muted-foreground">{notes.length} insgesamt</p>
<p className="text-sm text-[var(--color-fg-muted)]">{notes.length} Einträge</p>
</div>
{notes.length === 0 ? (
<p className="text-muted-foreground py-8 text-center">
Noch keine Versionshinweise vorhanden.
</p>
) : (
<ul className="space-y-3">
{notes.map((note) => (
<li
key={note.id}
className="bg-card p-4 rounded-xl border border-border shadow-sm flex flex-col sm:flex-row sm:items-start gap-4 justify-between"
>
<div className="space-y-1 min-w-0">
<p className="text-sm font-semibold">
Version {note.version}
<span className="ml-2 rounded-full bg-muted px-2.5 py-0.5 text-xs font-medium text-muted-foreground">
{audienceLabels[note.audience]}
</span>
</p>
<p className="text-sm whitespace-pre-line break-words">{note.body}</p>
<p className="text-xs text-muted-foreground">
{new Intl.DateTimeFormat("de-DE", { dateStyle: "medium" }).format(note.createdAt)}
</p>
</div>
<DeleteReleaseNoteButton action={deleteReleaseNoteAction} noteId={note.id} />
</li>
))}
</ul>
)}
<ReleaseHistory
notes={notes}
renderAction={(note) => <DeleteReleaseNoteButton action={deleteReleaseNoteAction} noteId={note.id} />}
showAudience
/>
</section>
</div>
</section>
);
}
+6 -24
View File
@@ -1,4 +1,5 @@
import { PageHeader } from "@/components/ui/page-header";
import { ReleaseHistory } from "@/modules/releases/release-history";
import { releaseNoteService } from "@/modules/releases/service";
import { requireEditorial } from "../access";
@@ -8,33 +9,14 @@ export default async function EditorialNewsPage() {
const notes = await releaseNoteService.listEditorialReleaseNotes();
return (
<div className="space-y-8 max-w-7xl animate-in fade-in slide-in-from-bottom-4 duration-500" aria-labelledby="news-title">
<section aria-labelledby="news-title" className="flex max-w-4xl flex-col gap-6">
<PageHeader
kicker="Portal · Versionshinweise"
kicker="Portal · Versionshistorie"
title="Neuigkeiten"
titleId="news-title"
description="Was sich im Redaktionsportal geändert hat, neueste Version zuerst."
description="Alle Änderungen am Redaktionsportal, neueste Version zuerst. So sehen Sie, was sich wann geändert hat."
/>
{notes.length === 0 ? (
<p className="text-muted-foreground text-center py-12">
Noch keine Versionshinweise vorhanden.
</p>
) : (
<ul className="space-y-3">
{notes.map((note) => (
<li key={note.id} className="bg-card p-4 rounded-xl border border-border shadow-sm space-y-1">
<p className="text-sm font-semibold">
Version {note.version}
<span className="ml-2 text-xs font-normal text-muted-foreground">
{new Intl.DateTimeFormat("de-DE", { dateStyle: "medium" }).format(note.createdAt)}
</span>
</p>
<p className="text-sm whitespace-pre-line break-words">{note.body}</p>
</li>
))}
</ul>
)}
</div>
<ReleaseHistory notes={notes} />
</section>
);
}
+18 -4
View File
@@ -1,6 +1,7 @@
"use client";
import { useEffect, useRef } from "react";
import Link from "next/link";
import { Button } from "@sakaniui/react";
import { IconCheck } from "@sakaniui/react/icons";
@@ -8,7 +9,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.1",
version: "2.2.2",
title: "Kalender, Statistiken, Collab und Rechnungen",
notes: {
redaktion: [
@@ -17,7 +18,7 @@ export const RELEASE = {
"Fotos lassen sich nach ältesten und neuesten sortieren; die Bildbeschreibung erscheint in der Großansicht.",
"Wenn Ihre Redaktion für Collab freigeschaltet ist, können Sie Downloads als kostenlose Collab-Nutzung markieren (auch für mehrere Bilder vom Merkzettel).",
"Rechnung und Nutzungsnachweis kommen gebündelt per E-Mail, sobald die Rechnung vorliegt.",
"Alle Versionshinweise finden Sie unter Neuigkeiten.",
"Unter Neuigkeiten steht jetzt die komplette Versionshistorie: alle Änderungen seit Version 2.0, neueste zuerst.",
],
admin: [
"Neue Statistik-Seite: Downloads, Datenmenge, Aufrufe, Suchen, Umsatz und Collab-Quote mit Zeitraum-Vergleich.",
@@ -25,13 +26,18 @@ export const RELEASE = {
"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.",
"Versionshinweise werden unter /admin/versionen gepflegt; dort steht jetzt auch die komplette Versionshistorie, gruppiert nach Version.",
],
},
} as const;
export type ReleaseArea = keyof typeof RELEASE.notes;
const HISTORY_HREF: Record<ReleaseArea, string> = {
redaktion: "/redaktion/neuigkeiten",
admin: "/admin/versionen",
};
const seenKey = (area: ReleaseArea) => `release-notes-seen:${area}`;
// Per browser, not per account: a courtesy popup, not a record of consent.
@@ -95,7 +101,15 @@ export function ReleaseNotesDialog({
</li>
))}
</ul>
<div className="flex justify-end">
<div className="flex flex-wrap items-center justify-between gap-3">
{/* The shell (and this dialog) survives client navigation, so close it here. */}
<Link
className="text-sm font-medium text-[var(--color-fg-default)] underline underline-offset-4 hover:text-[var(--color-fg-muted)]"
href={HISTORY_HREF[area]}
onClick={() => ref.current?.close()}
>
Frühere Änderungen ansehen
</Link>
<Button autoFocus onClick={() => ref.current?.close()} type="button">
Verstanden
</Button>
@@ -0,0 +1,38 @@
// @vitest-environment jsdom
import { cleanup, render, screen, within } from "@testing-library/react";
import { afterEach, expect, test } from "vitest";
import { groupReleaseNotes, ReleaseHistory } from "./release-history";
import type { ReleaseNote } from "./service";
afterEach(cleanup);
const at = new Date("2026-11-30T12:00:00.000Z");
const note = (id: string, version: string, audience: ReleaseNote["audience"], body = id): ReleaseNote => ({
id,
version,
audience,
body,
createdAt: at,
});
test("groups by version and sorts by version number, not by date", () => {
const groups = groupReleaseNotes([
note("a", "2.1.1", "editorial"),
note("b", "2.10.0", "admin"),
note("c", "2.2.0", "admin"),
note("d", "2.2.0", "editorial"),
note("e", "2.0.0", "both"),
]);
expect(groups.map((group) => group.version)).toEqual(["2.10.0", "2.2.0", "2.1.1", "2.0.0"]);
expect(groups[1].notes).toHaveLength(2);
});
test("marks only the newest version as current", () => {
render(<ReleaseHistory notes={[note("a", "2.2.1", "editorial", "Neu"), note("b", "2.0.0", "both", "Basis")]} />);
const items = within(screen.getByRole("list", { name: "Versionshistorie" })).getAllByRole("listitem");
expect(items[0].textContent).toContain("Version 2.2.1");
expect(items[0].textContent).toContain("Aktuell");
expect(items[1].textContent).not.toContain("Aktuell");
});
+88
View File
@@ -0,0 +1,88 @@
import type { ReactNode } from "react";
import { Badge, Card, EmptyState } from "@/components/ui/sakani";
import type { ReleaseNote, ReleaseNoteAudience } from "./service";
const audienceLabels: Record<ReleaseNoteAudience, string> = {
admin: "Admins",
editorial: "Redaktionen",
both: "Alle",
};
export type ReleaseGroup = { version: string; releasedAt: Date; notes: ReleaseNote[] };
function compareVersionsDesc(a: string, b: string): number {
const pa = a.split(".").map(Number);
const pb = b.split(".").map(Number);
for (let i = 0; i < 3; i++) {
const diff = (pb[i] ?? 0) - (pa[i] ?? 0);
if (diff !== 0) return diff;
}
return 0;
}
/**
* One group per version, newest version first. Sorted by version number, not
* by createdAt: seeds from the same migration share one timestamp.
*/
export function groupReleaseNotes(notes: ReleaseNote[]): ReleaseGroup[] {
const groups = new Map<string, ReleaseGroup>();
for (const note of notes) {
const group = groups.get(note.version);
if (!group) {
groups.set(note.version, { version: note.version, releasedAt: note.createdAt, notes: [note] });
continue;
}
group.notes.push(note);
if (note.createdAt < group.releasedAt) group.releasedAt = note.createdAt;
}
return [...groups.values()].sort((a, b) => compareVersionsDesc(a.version, b.version));
}
const dateFormat = new Intl.DateTimeFormat("de-DE", { dateStyle: "long" });
export function ReleaseHistory({
notes,
showAudience = false,
renderAction,
}: Readonly<{
notes: ReleaseNote[];
showAudience?: boolean;
renderAction?: (note: ReleaseNote) => ReactNode;
}>) {
const groups = groupReleaseNotes(notes);
if (groups.length === 0) {
return <EmptyState title="Noch keine Versionshinweise" description="Neue Versionen erscheinen hier mit einer kurzen Beschreibung." />;
}
return (
<ol aria-label="Versionshistorie" className="flex flex-col gap-4">
{groups.map((group, index) => (
<li key={group.version}>
<Card description={dateFormat.format(group.releasedAt)} title={`Version ${group.version}`}>
{/* Sakani's Card renders `actions` below the body, so the badge leads the body instead. */}
{index === 0 ? (
<div>
<Badge variant="accent">Aktuell</Badge>
</div>
) : null}
{group.notes.map((note) => (
<div className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between" key={note.id}>
<div className="flex min-w-0 flex-col gap-2">
{showAudience ? (
<div>
<Badge>{audienceLabels[note.audience]}</Badge>
</div>
) : null}
<p className="whitespace-pre-line break-words">{note.body}</p>
</div>
{renderAction?.(note)}
</div>
))}
</Card>
</li>
))}
</ol>
);
}