diff --git a/web/src/lib/components/forms/library-import-paths-form.svelte b/web/src/lib/components/forms/library-import-paths-form.svelte index 5acaaf2a8c3..d664f3f6350 100644 --- a/web/src/lib/components/forms/library-import-paths-form.svelte +++ b/web/src/lib/components/forms/library-import-paths-form.svelte @@ -1,6 +1,8 @@ -{#if addImportPath} - { - addImportPath = false; - importPathToAdd = null; - }} - /> -{/if} - -{#if editImportPath != undefined} - (editImportPath = null)} - /> -{/if} -
@@ -204,10 +193,7 @@ icon={mdiPencilOutline} title={$t('edit_import_path')} size="16" - onclick={() => { - editImportPath = listIndex; - editedImportPath = validatedPath.importPath; - }} + onclick={() => onEditImportPath(listIndex)} /> @@ -221,7 +207,7 @@ {/if} diff --git a/web/src/lib/components/forms/library-import-path-form.svelte b/web/src/lib/modals/LibraryImportPathModal.svelte similarity index 82% rename from web/src/lib/components/forms/library-import-path-form.svelte rename to web/src/lib/modals/LibraryImportPathModal.svelte index ee2a273708c..56a5449fef8 100644 --- a/web/src/lib/components/forms/library-import-path-form.svelte +++ b/web/src/lib/modals/LibraryImportPathModal.svelte @@ -11,9 +11,7 @@ cancelText?: string; submitText?: string; isEditing?: boolean; - onCancel: () => void; - onSubmit: (importPath: string | null) => void; - onDelete?: () => void; + onClose: (data?: { action: 'delete' } | { action: 'submit'; importPath: string | null }) => void; } let { @@ -23,9 +21,7 @@ cancelText = $t('cancel'), submitText = $t('save'), isEditing = false, - onCancel, - onSubmit, - onDelete, + onClose, }: Props = $props(); onMount(() => { @@ -40,12 +36,12 @@ const onsubmit = (event: Event) => { event.preventDefault(); if (canSubmit) { - onSubmit(importPath); + onClose({ action: 'submit', importPath }); } }; - +

{$t('admin.library_import_path_description')}

@@ -65,13 +61,15 @@
- + {#if isEditing} - + {/if} - +
diff --git a/web/src/lib/components/forms/library-rename-form.svelte b/web/src/lib/modals/LibraryRenameModal.svelte similarity index 73% rename from web/src/lib/components/forms/library-rename-form.svelte rename to web/src/lib/modals/LibraryRenameModal.svelte index 0c04c77da10..9ba8048316e 100644 --- a/web/src/lib/components/forms/library-rename-form.svelte +++ b/web/src/lib/modals/LibraryRenameModal.svelte @@ -6,21 +6,20 @@ interface Props { library: Partial; - onCancel: () => void; - onSubmit: (library: Partial) => void; + onClose: (library?: Partial) => void; } - let { library, onCancel, onSubmit }: Props = $props(); + let { library, onClose }: Props = $props(); let newName = $state(library.name); const onsubmit = (event: Event) => { event.preventDefault(); - onSubmit({ ...library, name: newName }); + onClose({ ...library, name: newName }); }; - + @@ -31,7 +30,7 @@
- +
diff --git a/web/src/lib/components/forms/library-user-picker-form.svelte b/web/src/lib/modals/LibraryUserPickerModal.svelte similarity index 82% rename from web/src/lib/components/forms/library-user-picker-form.svelte rename to web/src/lib/modals/LibraryUserPickerModal.svelte index 43b3eb69f16..52cde12921a 100644 --- a/web/src/lib/components/forms/library-user-picker-form.svelte +++ b/web/src/lib/modals/LibraryUserPickerModal.svelte @@ -8,11 +8,10 @@ import { t } from 'svelte-i18n'; interface Props { - onCancel: () => void; - onSubmit: (ownerId: string) => void; + onClose: (ownerId?: string) => void; } - let { onCancel, onSubmit }: Props = $props(); + let { onClose }: Props = $props(); let ownerId: string = $state($user.id); @@ -25,11 +24,11 @@ const onsubmit = (event: Event) => { event.preventDefault(); - onSubmit(ownerId); + onClose(ownerId); }; - +

{$t('admin.note_cannot_be_changed_later')}

@@ -40,7 +39,7 @@
- +
diff --git a/web/src/routes/admin/library-management/+page.svelte b/web/src/routes/admin/library-management/+page.svelte index 401a8900140..ed968a7df46 100644 --- a/web/src/routes/admin/library-management/+page.svelte +++ b/web/src/routes/admin/library-management/+page.svelte @@ -1,9 +1,6 @@
- +