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

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

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

