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/dialogs/AddNamespace.svelte | 26 +++++++++-----------------
 1 file changed, 9 insertions(+), 17 deletions(-)

(limited to 'frontend/src/lib/dialogs/AddNamespace.svelte')

diff --git a/frontend/src/lib/dialogs/AddNamespace.svelte b/frontend/src/lib/dialogs/AddNamespace.svelte
index e81b22a..45183f4 100644
--- a/frontend/src/lib/dialogs/AddNamespace.svelte
+++ b/frontend/src/lib/dialogs/AddNamespace.svelte
@@ -1,30 +1,22 @@
 <script lang="ts">
-	import { addNamespace, type NamespaceInput } from '$gql/Mutations';
+	import type { AddNamespaceInput } from '$gql/graphql';
+	import { addNamespace } from '$gql/Mutations';
 	import Dialog from '$lib/components/Dialog.svelte';
-	import SubmitButton from '$lib/components/SubmitButton.svelte';
 	import NamespaceForm from '$lib/forms/NamespaceForm.svelte';
 	import { toastFinally } from '$lib/Toasts';
 	import { getContextClient } from '@urql/svelte';
-	import { closeModal } from 'svelte-modals';
+	import type { ModalProps } from 'svelte-modals';
 
 	const client = getContextClient();
 
-	export let isOpen: boolean;
+	let modal: ModalProps = $props();
+	const initial = { name: '' };
 
-	let namespace = { name: '' };
-
-	function add(event: CustomEvent<NamespaceInput>) {
-		addNamespace(client, { input: event.detail }).then(closeModal).catch(toastFinally);
+	function submit(input: AddNamespaceInput) {
+		addNamespace(client, { input }).then(modal.close).catch(toastFinally);
 	}
 </script>
 
-<Dialog {isOpen}>
-	<svelte:fragment slot="header">
-		<h2>Add Namespace</h2>
-	</svelte:fragment>
-	<NamespaceForm bind:namespace on:submit={add}>
-		<div class="flex justify-end gap-4">
-			<SubmitButton active={namespace.name.length > 0} />
-		</div>
-	</NamespaceForm>
+<Dialog title="Add Namespace" {...modal}>
+	<NamespaceForm {initial} {submit} />
 </Dialog>
-- 
cgit v1.2.3-2-gb3c3

