From d1d654ebac2d51e3841675faeb56480e440f622f Mon Sep 17 00:00:00 2001
From: Wolfgang Müller
Date: Tue, 5 Mar 2024 18:08:09 +0100
Subject: Initial commit

---
 frontend/src/lib/tabs/ComicDelete.svelte | 34 ++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
 create mode 100644 frontend/src/lib/tabs/ComicDelete.svelte

(limited to 'frontend/src/lib/tabs/ComicDelete.svelte')

diff --git a/frontend/src/lib/tabs/ComicDelete.svelte b/frontend/src/lib/tabs/ComicDelete.svelte
new file mode 100644
index 0000000..a10f6b2
--- /dev/null
+++ b/frontend/src/lib/tabs/ComicDelete.svelte
@@ -0,0 +1,34 @@
+<script lang="ts">
+	import { goto } from '$app/navigation';
+	import { deleteComics } from '$gql/Mutations';
+	import type { FullComicFragment } from '$gql/graphql';
+	import { toastFinally } from '$lib/Toasts';
+	import { confirmDeletion } from '$lib/Utils';
+	import DeleteButton from '$lib/components/DeleteButton.svelte';
+	import { getContextClient } from '@urql/svelte';
+
+	const client = getContextClient();
+
+	export let comic: FullComicFragment;
+
+	function deleteComic() {
+		confirmDeletion('Comic', comic.title, () => {
+			deleteComics(client, { ids: comic.id })
+				.then(() => goto('/comics/'))
+				.catch(toastFinally);
+		});
+	}
+</script>
+
+<div class="flex flex-col gap-2">
+	<div>
+		<p>
+			Deleting this comic will make all of its pages available again for allocation. All of its
+			metadata will be lost.
+		</p>
+		<p class="mt-2 font-medium">This action is irrevocable.</p>
+	</div>
+	<div class="flex">
+		<DeleteButton prominent on:click={deleteComic} />
+	</div>
+</div>
-- 
cgit v1.2.3-2-gb3c3

