<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>