diff --git a/web/src/lib/components/admin-page/delete-confirm-dialoge.svelte b/web/src/lib/components/admin-page/delete-confirm-dialoge.svelte index 90246eb82b..63065a0d99 100644 --- a/web/src/lib/components/admin-page/delete-confirm-dialoge.svelte +++ b/web/src/lib/components/admin-page/delete-confirm-dialoge.svelte @@ -10,6 +10,7 @@ const dispatch = createEventDispatcher<{ success: void; fail: void; + cancel: void; }>(); const handleDeleteUser = async () => { @@ -27,7 +28,12 @@ }; - + dispatch('cancel')} +>

diff --git a/web/src/lib/components/admin-page/jobs/jobs-panel.svelte b/web/src/lib/components/admin-page/jobs/jobs-panel.svelte index edf5c48300..15b91c98b0 100644 --- a/web/src/lib/components/admin-page/jobs/jobs-panel.svelte +++ b/web/src/lib/components/admin-page/jobs/jobs-panel.svelte @@ -148,8 +148,8 @@ {#if confirmJob} (confirmJob = null)} + {onConfirm} + onClose={() => (confirmJob = null)} /> {/if} diff --git a/web/src/lib/components/admin-page/restore-dialoge.svelte b/web/src/lib/components/admin-page/restore-dialoge.svelte index c585d60e93..d9a8ed3bc0 100644 --- a/web/src/lib/components/admin-page/restore-dialoge.svelte +++ b/web/src/lib/components/admin-page/restore-dialoge.svelte @@ -8,6 +8,7 @@ const dispatch = createEventDispatcher<{ success: void; fail: void; + cancel: void; }>(); const handleRestoreUser = async () => { @@ -24,8 +25,8 @@ title="Restore User" confirmText="Continue" confirmColor="green" - on:confirm={handleRestoreUser} - on:cancel + onConfirm={handleRestoreUser} + onClose={() => dispatch('cancel')} >

{user.name}'s account will be restored.

diff --git a/web/src/lib/components/admin-page/settings/confirm-disable-login.svelte b/web/src/lib/components/admin-page/settings/confirm-disable-login.svelte index b0c3e650d0..e57d25398f 100644 --- a/web/src/lib/components/admin-page/settings/confirm-disable-login.svelte +++ b/web/src/lib/components/admin-page/settings/confirm-disable-login.svelte @@ -1,8 +1,11 @@ - +

Are you sure you want to disable all login methods? Login will be completely disabled.

diff --git a/web/src/lib/components/admin-page/settings/oauth/oauth-settings.svelte b/web/src/lib/components/admin-page/settings/oauth/oauth-settings.svelte index 217017447a..387d7e470e 100644 --- a/web/src/lib/components/admin-page/settings/oauth/oauth-settings.svelte +++ b/web/src/lib/components/admin-page/settings/oauth/oauth-settings.svelte @@ -56,7 +56,7 @@ {#if isConfirmOpen} - handleConfirm(false)} on:confirm={() => handleConfirm(true)} /> + handleConfirm(false)} onConfirm={() => handleConfirm(true)} /> {/if}
diff --git a/web/src/lib/components/admin-page/settings/password-login/password-login-settings.svelte b/web/src/lib/components/admin-page/settings/password-login/password-login-settings.svelte index 8dc7323cf9..2d3344dbeb 100644 --- a/web/src/lib/components/admin-page/settings/password-login/password-login-settings.svelte +++ b/web/src/lib/components/admin-page/settings/password-login/password-login-settings.svelte @@ -41,7 +41,7 @@ {#if isConfirmOpen} - handleConfirm(false)} on:confirm={() => handleConfirm(true)} /> + handleConfirm(false)} onConfirm={() => handleConfirm(true)} /> {/if}
diff --git a/web/src/lib/components/album-page/album-options.svelte b/web/src/lib/components/album-page/album-options.svelte index 4d576aa2fa..6cbce418ba 100644 --- a/web/src/lib/components/album-page/album-options.svelte +++ b/web/src/lib/components/album-page/album-options.svelte @@ -19,7 +19,7 @@ }>(); - dispatch('close')}> + dispatch('close')}>
(selectedRemoveUser = null)} + onConfirm={handleRemoveUser} + onClose={() => (selectedRemoveUser = null)} /> {/if} @@ -139,7 +139,7 @@ title="Remove User?" prompt="Are you sure you want to remove {selectedRemoveUser.name}" confirmText="Remove" - on:confirm={handleRemoveUser} - on:cancel={() => (selectedRemoveUser = null)} + onConfirm={handleRemoveUser} + onClose={() => (selectedRemoveUser = null)} /> {/if} diff --git a/web/src/lib/components/faces-page/merge-face-selector.svelte b/web/src/lib/components/faces-page/merge-face-selector.svelte index 7b075405ca..9fa8628ddc 100644 --- a/web/src/lib/components/faces-page/merge-face-selector.svelte +++ b/web/src/lib/components/faces-page/merge-face-selector.svelte @@ -158,8 +158,8 @@ (isShowConfirmation = false)} + onConfirm={handleMerge} + onClose={() => (isShowConfirmation = false)} >

Are you sure you want merge these people ?

(); - const handleKeyboardPress = (event: KeyboardEvent) => { - switch (event.key) { - case 'Escape': { - dispatch('close'); - return; - } - } - }; - const changePersonToMerge = (newperson: PersonResponseDto) => { const index = potentialMergePeople.indexOf(newperson); [potentialMergePeople[index], personMerge2] = [personMerge2, potentialMergePeople[index]]; @@ -39,9 +30,7 @@ }; - - - dispatch('close')}> + dispatch('close')}>
- handleCancel()}> +
diff --git a/web/src/lib/components/forms/api-key-form.svelte b/web/src/lib/components/forms/api-key-form.svelte index 62034d651c..15d2aefc66 100644 --- a/web/src/lib/components/forms/api-key-form.svelte +++ b/web/src/lib/components/forms/api-key-form.svelte @@ -29,7 +29,7 @@ }; - +
diff --git a/web/src/lib/components/forms/edit-user-form.svelte b/web/src/lib/components/forms/edit-user-form.svelte index f55d341a71..13a797a9c8 100644 --- a/web/src/lib/components/forms/edit-user-form.svelte +++ b/web/src/lib/components/forms/edit-user-form.svelte @@ -147,8 +147,8 @@ (isShowResetPasswordConfirmation = false)} + onConfirm={resetPassword} + onClose={() => (isShowResetPasswordConfirmation = false)} >

diff --git a/web/src/lib/components/forms/library-exclusion-pattern-form.svelte b/web/src/lib/components/forms/library-exclusion-pattern-form.svelte index 439ae2b368..c94a458094 100644 --- a/web/src/lib/components/forms/library-exclusion-pattern-form.svelte +++ b/web/src/lib/components/forms/library-exclusion-pattern-form.svelte @@ -29,7 +29,7 @@ const handleSubmit = () => dispatch('submit', { excludePattern: exclusionPattern }); - handleCancel()}> +

diff --git a/web/src/lib/components/forms/library-import-path-form.svelte b/web/src/lib/components/forms/library-import-path-form.svelte index 06a5f63ea5..1c9f693862 100644 --- a/web/src/lib/components/forms/library-import-path-form.svelte +++ b/web/src/lib/components/forms/library-import-path-form.svelte @@ -31,7 +31,7 @@ const handleSubmit = () => dispatch('submit', { importPath }); - handleCancel()}> +
diff --git a/web/src/lib/components/forms/library-user-picker-form.svelte b/web/src/lib/components/forms/library-user-picker-form.svelte index b3c70adb6d..cc1d31b884 100644 --- a/web/src/lib/components/forms/library-user-picker-form.svelte +++ b/web/src/lib/components/forms/library-user-picker-form.svelte @@ -28,7 +28,7 @@ const handleSubmit = () => dispatch('submit', { ownerId }); - handleCancel()}> +
diff --git a/web/src/lib/components/map-page/map-settings-modal.svelte b/web/src/lib/components/map-page/map-settings-modal.svelte index 49d841116a..aa95714b46 100644 --- a/web/src/lib/components/map-page/map-settings-modal.svelte +++ b/web/src/lib/components/map-page/map-settings-modal.svelte @@ -21,7 +21,7 @@ const handleClose = () => dispatch('close'); - +
diff --git a/web/src/lib/components/photos-page/actions/remove-from-album.svelte b/web/src/lib/components/photos-page/actions/remove-from-album.svelte index a2a10297d6..8fbc5e6ad0 100644 --- a/web/src/lib/components/photos-page/actions/remove-from-album.svelte +++ b/web/src/lib/components/photos-page/actions/remove-from-album.svelte @@ -59,8 +59,8 @@ (isShowConfirmation = false)} + onConfirm={removeFromAlbum} + onClose={() => (isShowConfirmation = false)} >

diff --git a/web/src/lib/components/photos-page/actions/remove-from-shared-link.svelte b/web/src/lib/components/photos-page/actions/remove-from-shared-link.svelte index f870ac3d35..001cabf655 100644 --- a/web/src/lib/components/photos-page/actions/remove-from-shared-link.svelte +++ b/web/src/lib/components/photos-page/actions/remove-from-shared-link.svelte @@ -53,7 +53,7 @@ title="Remove Assets?" prompt="Are you sure you want to remove {getAssets().size} asset(s) from this shared link?" confirmText="Remove" - on:confirm={() => handleRemove()} - on:cancel={() => (removing = false)} + onConfirm={() => handleRemove()} + onClose={() => (removing = false)} /> {/if} diff --git a/web/src/lib/components/photos-page/delete-asset-dialog.svelte b/web/src/lib/components/photos-page/delete-asset-dialog.svelte index 0f2e1b611f..5e58042429 100644 --- a/web/src/lib/components/photos-page/delete-asset-dialog.svelte +++ b/web/src/lib/components/photos-page/delete-asset-dialog.svelte @@ -27,9 +27,8 @@ dispatch('cancel')} - on:escape={() => dispatch('cancel')} + onConfirm={handleConfirm} + onClose={() => dispatch('cancel')} >

diff --git a/web/src/lib/components/shared-components/change-date.svelte b/web/src/lib/components/shared-components/change-date.svelte index f4c45c1e03..51d6611b5a 100644 --- a/web/src/lib/components/shared-components/change-date.svelte +++ b/web/src/lib/components/shared-components/change-date.svelte @@ -68,8 +68,8 @@ title="Edit date & time" prompt="Please select a new date:" disabled={!date.isValid} - on:confirm={handleConfirm} - on:cancel={handleCancel} + onConfirm={handleConfirm} + onClose={handleCancel} >

diff --git a/web/src/lib/components/shared-components/change-location.svelte b/web/src/lib/components/shared-components/change-location.svelte index a31bd6cc2f..786e8721b5 100644 --- a/web/src/lib/components/shared-components/change-location.svelte +++ b/web/src/lib/components/shared-components/change-location.svelte @@ -144,8 +144,8 @@ cancelColor="secondary" title="Change Location" width={800} - on:confirm={handleConfirm} - on:cancel={handleCancel} + onConfirm={handleConfirm} + onClose={handleCancel} >
(hideSuggestion = true)}> diff --git a/web/src/lib/components/shared-components/confirm-dialogue.svelte b/web/src/lib/components/shared-components/confirm-dialogue.svelte index 6ae10b30a8..a63efccd0d 100644 --- a/web/src/lib/components/shared-components/confirm-dialogue.svelte +++ b/web/src/lib/components/shared-components/confirm-dialogue.svelte @@ -1,5 +1,4 @@ - handleEscape()}> +
{#if !hideCancelButton} - {/if} diff --git a/web/src/lib/components/shared-components/full-screen-modal.svelte b/web/src/lib/components/shared-components/full-screen-modal.svelte index d263d0b317..3ca3717ef4 100644 --- a/web/src/lib/components/shared-components/full-screen-modal.svelte +++ b/web/src/lib/components/shared-components/full-screen-modal.svelte @@ -1,12 +1,8 @@
-
dispatch('clickOutside')} - on:escape={() => dispatch('escape')} - > +
diff --git a/web/src/lib/components/shared-components/navigation-bar/avatar-selector.svelte b/web/src/lib/components/shared-components/navigation-bar/avatar-selector.svelte index 3ba5745ae2..c6b00adc4d 100644 --- a/web/src/lib/components/shared-components/navigation-bar/avatar-selector.svelte +++ b/web/src/lib/components/shared-components/navigation-bar/avatar-selector.svelte @@ -15,7 +15,7 @@ const colors: UserAvatarColor[] = Object.values(UserAvatarColor); - dispatch('close')} on:escape={() => dispatch('close')}> + dispatch('close')}>
(); - dispatch('close')} on:escape={() => dispatch('close')}> + dispatch('close')}>
{#if showModal} - (showModal = false)}> + (showModal = false)}>
diff --git a/web/src/lib/components/slideshow-settings.svelte b/web/src/lib/components/slideshow-settings.svelte index 70c893c4ed..eec2f83e37 100644 --- a/web/src/lib/components/slideshow-settings.svelte +++ b/web/src/lib/components/slideshow-settings.svelte @@ -30,7 +30,7 @@ }; - +
diff --git a/web/src/lib/components/user-settings-page/device-list.svelte b/web/src/lib/components/user-settings-page/device-list.svelte index 080e79145d..2cf00f9f72 100644 --- a/web/src/lib/components/user-settings-page/device-list.svelte +++ b/web/src/lib/components/user-settings-page/device-list.svelte @@ -50,16 +50,16 @@ {#if deleteDevice} handleDelete()} - on:cancel={() => (deleteDevice = null)} + onConfirm={() => handleDelete()} + onClose={() => (deleteDevice = null)} /> {/if} {#if deleteAll} handleDeleteAll()} - on:cancel={() => (deleteAll = false)} + onConfirm={() => handleDeleteAll()} + onClose={() => (deleteAll = false)} /> {/if} diff --git a/web/src/lib/components/user-settings-page/partner-settings.svelte b/web/src/lib/components/user-settings-page/partner-settings.svelte index fbe5efa58a..70803f7753 100644 --- a/web/src/lib/components/user-settings-page/partner-settings.svelte +++ b/web/src/lib/components/user-settings-page/partner-settings.svelte @@ -190,7 +190,7 @@ (removePartnerDto = null)} - on:confirm={() => handleRemovePartner()} + onClose={() => (removePartnerDto = null)} + onConfirm={() => handleRemovePartner()} /> {/if} diff --git a/web/src/lib/components/user-settings-page/user-api-key-list.svelte b/web/src/lib/components/user-settings-page/user-api-key-list.svelte index 9eca630bf6..a51d623813 100644 --- a/web/src/lib/components/user-settings-page/user-api-key-list.svelte +++ b/web/src/lib/components/user-settings-page/user-api-key-list.svelte @@ -105,8 +105,8 @@ {#if deleteKey} handleDelete()} - on:cancel={() => (deleteKey = null)} + onConfirm={() => handleDelete()} + onClose={() => (deleteKey = null)} /> {/if} diff --git a/web/src/lib/utils/click-outside.ts b/web/src/lib/utils/click-outside.ts index d028ca5b1f..f7a83c0b3a 100644 --- a/web/src/lib/utils/click-outside.ts +++ b/web/src/lib/utils/click-outside.ts @@ -1,20 +1,42 @@ import type { ActionReturn } from 'svelte/action'; interface Attributes { + /** @deprecated */ 'on:outclick'?: (e: CustomEvent) => void; + /** @deprecated **/ 'on:escape'?: (e: CustomEvent) => void; } -export function clickOutside(node: HTMLElement): ActionReturn { +interface Options { + onOutclick?: () => void; + onEscape?: () => void; +} + +export function clickOutside(node: HTMLElement, options: Options = {}): ActionReturn { + const { onOutclick, onEscape } = options; + const handleClick = (event: MouseEvent) => { const targetNode = event.target as Node | null; - if (!node.contains(targetNode)) { + if (node.contains(targetNode)) { + return; + } + + if (onOutclick) { + onOutclick(); + } else { node.dispatchEvent(new CustomEvent('outclick')); } }; const handleKey = (event: KeyboardEvent) => { - if (event.key === 'Escape') { + if (event.key !== 'Escape') { + return; + } + + if (onEscape) { + event.stopPropagation(); + onEscape(); + } else { node.dispatchEvent(new CustomEvent('escape')); } }; diff --git a/web/src/routes/(user)/albums/+page.svelte b/web/src/routes/(user)/albums/+page.svelte index 4f1cccbb0b..d14be267e2 100644 --- a/web/src/routes/(user)/albums/+page.svelte +++ b/web/src/routes/(user)/albums/+page.svelte @@ -236,7 +236,7 @@ {#if shouldShowEditUserForm} - (shouldShowEditUserForm = false)}> + (shouldShowEditUserForm = false)}> successModifyAlbum()} @@ -399,8 +399,8 @@ (albumToDelete = null)} + onConfirm={deleteSelectedAlbum} + onClose={() => (albumToDelete = null)} >

Are you sure you want to delete the album {albumToDelete.albumName}?

diff --git a/web/src/routes/(user)/albums/[albumId]/+page.svelte b/web/src/routes/(user)/albums/[albumId]/+page.svelte index f0daba676e..279054d915 100644 --- a/web/src/routes/(user)/albums/[albumId]/+page.svelte +++ b/web/src/routes/(user)/albums/[albumId]/+page.svelte @@ -692,8 +692,8 @@ (viewMode = ViewMode.VIEW)} + onConfirm={handleRemoveAlbum} + onClose={() => (viewMode = ViewMode.VIEW)} >

Are you sure you want to delete the album {album.albumName}?

diff --git a/web/src/routes/(user)/people/+page.svelte b/web/src/routes/(user)/people/+page.svelte index 6373b81fd5..22dc98ad3e 100644 --- a/web/src/routes/(user)/people/+page.svelte +++ b/web/src/routes/(user)/people/+page.svelte @@ -420,16 +420,14 @@ {#if showMergeModal} - (showMergeModal = false)}> - (showMergeModal = false)} - on:reject={() => changeName()} - on:confirm={(event) => handleMergeSamePerson(event.detail)} - /> - + (showMergeModal = false)} + on:reject={() => changeName()} + on:confirm={(event) => handleMergeSamePerson(event.detail)} + /> {/if} (showChangeNameModal = false)}> + (showChangeNameModal = false)}>
diff --git a/web/src/routes/(user)/sharing/sharedlinks/+page.svelte b/web/src/routes/(user)/sharing/sharedlinks/+page.svelte index 3a6ff6ac0a..d90a0a6c18 100644 --- a/web/src/routes/(user)/sharing/sharedlinks/+page.svelte +++ b/web/src/routes/(user)/sharing/sharedlinks/+page.svelte @@ -91,7 +91,7 @@ title="Delete Shared Link" prompt="Are you sure you want to delete this shared link?" confirmText="Delete" - on:confirm={() => handleDeleteLink()} - on:cancel={() => (deleteLinkId = null)} + onConfirm={() => handleDeleteLink()} + onClose={() => (deleteLinkId = null)} /> {/if} diff --git a/web/src/routes/(user)/trash/+page.svelte b/web/src/routes/(user)/trash/+page.svelte index cba8373b86..6ce6c54236 100644 --- a/web/src/routes/(user)/trash/+page.svelte +++ b/web/src/routes/(user)/trash/+page.svelte @@ -105,8 +105,8 @@ (isShowEmptyConfirmation = false)} + onConfirm={handleEmptyTrash} + onClose={() => (isShowEmptyConfirmation = false)} >

Are you sure you want to empty the trash? This will remove all the assets in trash permanently from Immich.

diff --git a/web/src/routes/admin/library-management/+page.svelte b/web/src/routes/admin/library-management/+page.svelte index e9ac41b83e..9f809409f4 100644 --- a/web/src/routes/admin/library-management/+page.svelte +++ b/web/src/routes/admin/library-management/+page.svelte @@ -307,8 +307,8 @@ (confirmDeleteLibrary = null)} + onConfirm={handleDelete} + onClose={() => (confirmDeleteLibrary = null)} /> {/if} diff --git a/web/src/routes/admin/user-management/+page.svelte b/web/src/routes/admin/user-management/+page.svelte index 84917d591e..c5d8874a45 100644 --- a/web/src/routes/admin/user-management/+page.svelte +++ b/web/src/routes/admin/user-management/+page.svelte @@ -103,19 +103,13 @@
{#if shouldShowCreateUserForm} - (shouldShowCreateUserForm = false)} - on:escape={() => (shouldShowCreateUserForm = false)} - > + (shouldShowCreateUserForm = false)}> (shouldShowCreateUserForm = false)} /> {/if} {#if shouldShowEditUserForm} - (shouldShowEditUserForm = false)} - on:escape={() => (shouldShowEditUserForm = false)} - > + (shouldShowEditUserForm = false)}> (shouldShowInfoPanel = false)} - on:escape={() => (shouldShowInfoPanel = false)} - > + (shouldShowInfoPanel = false)}>

Password reset success