From dc4db405d2991d3ec6a114f3b08d3fccd057d3ee Mon Sep 17 00:00:00 2001
From: Wolfgang Müller
Date: Thu, 13 Feb 2025 17:52:16 +0100
Subject: frontend: Migrate to Svelte 5

---
 frontend/src/lib/toolbar/DeleteSelection.svelte | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

(limited to 'frontend/src/lib/toolbar/DeleteSelection.svelte')

diff --git a/frontend/src/lib/toolbar/DeleteSelection.svelte b/frontend/src/lib/toolbar/DeleteSelection.svelte
index 7459a87..7b37313 100644
--- a/frontend/src/lib/toolbar/DeleteSelection.svelte
+++ b/frontend/src/lib/toolbar/DeleteSelection.svelte
@@ -1,26 +1,28 @@
 <script lang="ts">
 	import type { DeleteMutation } from '$gql/Mutations';
-	import { getSelectionContext } from '$lib/Selection';
+	import DeleteButton from '$lib/components/DeleteButton.svelte';
+	import { getSelectionContext } from '$lib/selection/Selection.svelte';
 	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();
-	const selection = getSelectionContext();
 
-	export let mutation: DeleteMutation;
-	export let warning: string | undefined = undefined;
+	interface Props {
+		mutation: DeleteMutation;
+		warning?: string;
+	}
+
+	let { mutation, warning = undefined }: Props = $props();
+	let selection = getSelectionContext();
 
-	function remove() {
+	function onclick() {
 		const mutate = () => {
-			mutation(client, { ids: $selection.ids })
-				.then(() => ($selection = $selection.clear()))
-				.catch(toastFinally);
+			mutation(client, { ids: selection.ids }).then(selection.clear).catch(toastFinally);
 		};
 
-		confirmDeletion($selection.typename, $selection.names, mutate, warning);
+		confirmDeletion(selection.typename, selection.names, mutate, warning);
 	}
 </script>
 
-<DeleteButton on:click={remove} />
+<DeleteButton {onclick} />
-- 
cgit v1.2.3-2-gb3c3

