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

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

diff --git a/frontend/src/lib/dialogs/AddCircle.svelte b/frontend/src/lib/dialogs/AddCircle.svelte
index f0ef014..faffc63 100644
--- a/frontend/src/lib/dialogs/AddCircle.svelte
+++ b/frontend/src/lib/dialogs/AddCircle.svelte
@@ -1,30 +1,22 @@
 <script lang="ts">
-	import { addCircle, type CircleInput } from '$gql/Mutations';
+	import type { AddCircleInput } from '$gql/graphql';
+	import { addCircle } from '$gql/Mutations';
 	import Dialog from '$lib/components/Dialog.svelte';
-	import SubmitButton from '$lib/components/SubmitButton.svelte';
 	import CircleForm from '$lib/forms/CircleForm.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 circle = { name: '' };
-
-	function add(event: CustomEvent<CircleInput>) {
-		addCircle(client, { input: event.detail }).then(closeModal).catch(toastFinally);
+	function submit(input: AddCircleInput) {
+		addCircle(client, { input }).then(modal.close).catch(toastFinally);
 	}
 </script>
 
-<Dialog {isOpen}>
-	<svelte:fragment slot="header">
-		<h2>Add Circle</h2>
-	</svelte:fragment>
-	<CircleForm bind:circle on:submit={add}>
-		<div class="flex justify-end gap-4">
-			<SubmitButton active={circle.name.length > 0} />
-		</div>
-	</CircleForm>
+<Dialog title="Add Circle" {...modal}>
+	<CircleForm {initial} {submit} />
 </Dialog>
-- 
cgit v1.2.3-2-gb3c3

