${content}
+ ${button ? `` : ''} +{album.assetCount} Fotos
-
>
);
diff --git a/src/modules/editorials/DangerZone.tsx b/src/modules/editorials/DangerZone.tsx
index ab17aff..5d01ff6 100644
--- a/src/modules/editorials/DangerZone.tsx
+++ b/src/modules/editorials/DangerZone.tsx
@@ -2,7 +2,7 @@
import { useState, useTransition } from "react";
-import { archiveEditorialAction } from "@/app/admin/redaktionen/[id]/actions";
+import { archiveEditorialAction, hardDeleteEditorialAction } from "@/app/admin/redaktionen/[id]/actions";
import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";
@@ -15,6 +15,7 @@ type DangerZoneProps = {
export function DangerZone({ editorialId, editorialName }: DangerZoneProps) {
const [confirmText, setConfirmText] = useState("");
const [isPending, startTransition] = useTransition();
+ const [isDeleting, setIsDeleting] = useState(false);
const isConfirmed = confirmText === editorialName;
function handleArchive() {
@@ -24,12 +25,21 @@ export function DangerZone({ editorialId, editorialName }: DangerZoneProps) {
});
}
+ function handleDelete() {
+ if (!isConfirmed) return;
+ setIsDeleting(true);
+ startTransition(async () => {
+ await hardDeleteEditorialAction(editorialId);
+ });
+ }
+
return (
+
+