summaryrefslogblamecommitdiffstatshomepage
path: root/frontend/src/lib/tabs/ArchiveDelete.svelte
blob: d2b2465ee1dd1e5c0d7b87feaa5cf8c383d33eab (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11










                                                                       
                                                                     










                                                                   





                                                                                                           
                          
                                                                  

              
<script lang="ts">
	import { goto } from '$app/navigation';
	import { deleteArchives } from '$gql/Mutations';
	import type { FullArchiveFragment } 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();

	let { archive }: { archive: FullArchiveFragment } = $props();

	function deleteArchive() {
		confirmDeletion('Archive', archive.name, () => {
			deleteArchives(client, { ids: archive.id })
				.then(() => goto('/archives/'))
				.catch(toastFinally);
		});
	}
</script>

<div class="flex flex-col gap-2">
	<p>
		Deleting this archive will remove all of its comics as well as the
		<span class="cursor-help font-medium underline" title={archive.path}>archive file</span> on
		disk.
		<span class="font-medium">This action is irrevocable.</span>
	</p>
	<div class="flex">
		<DeleteButton prominent onclick={deleteArchive} />
	</div>
</div>