feat: add cross-album search, auto-rules, album UI redesign, editorial archiving and pdf download
This commit is contained in:
1 parent
9c0d43b1ec
commit
375e5b8b7d
23 files changed
+1153
-43
No files matched your search
@@ -0,0 +1,49 @@
|
||||
"use client";
|
||||
|
||||
import { useState, useTransition } from "react";
|
||||
|
||||
import { archiveEditorialAction } from "@/app/admin/redaktionen/[id]/actions";
|
||||
|
||||
type DangerZoneProps = {
|
||||
editorialId: string;
|
||||
editorialName: string;
|
||||
};
|
||||
|
||||
export function DangerZone({ editorialId, editorialName }: DangerZoneProps) {
|
||||
const [confirmText, setConfirmText] = useState("");
|
||||
const [isPending, startTransition] = useTransition();
|
||||
const isConfirmed = confirmText === editorialName;
|
||||
|
||||
function handleArchive() {
|
||||
if (!isConfirmed) return;
|
||||
startTransition(async () => {
|
||||
await archiveEditorialAction(editorialId);
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<section className="danger-zone" aria-labelledby="danger-title">
|
||||
<h2 id="danger-title">Gefahrenzone</h2>
|
||||
<p>Alle Albumrechte werden widerrufen und der Login wird deaktiviert. Abrechnungsdaten bleiben erhalten.</p>
|
||||
<label>
|
||||
<span>Redaktionsname zur Bestätigung eingeben:</span>
|
||||
<input
|
||||
type="text"
|
||||
value={confirmText}
|
||||
onChange={(e) => setConfirmText(e.target.value)}
|
||||
placeholder={editorialName}
|
||||
className="danger-zone-input"
|
||||
disabled={isPending}
|
||||
/>
|
||||
</label>
|
||||
<button
|
||||
type="button"
|
||||
className="action-button action-button--danger"
|
||||
disabled={!isConfirmed || isPending}
|
||||
onClick={handleArchive}
|
||||
>
|
||||
{isPending ? "Wird archiviert…" : "Redaktion archivieren"}
|
||||
</button>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user