From 78640e80ac7b2b8262a1acd1baeab9255d48d985 Mon Sep 17 00:00:00 2001 From: Pranav-8bit Date: Thu, 26 Sep 2024 00:35:50 +0530 Subject: [PATCH 1/5] bug fix --- .../album-page/album-options.svelte | 81 +++++++++++++++++-- .../[[assetId=id]]/+page.svelte | 1 + 2 files changed, 74 insertions(+), 8 deletions(-) diff --git a/web/src/lib/components/album-page/album-options.svelte b/web/src/lib/components/album-page/album-options.svelte index ebcf835649070..27d99018023c3 100644 --- a/web/src/lib/components/album-page/album-options.svelte +++ b/web/src/lib/components/album-page/album-options.svelte @@ -1,7 +1,14 @@ @@ -77,22 +124,40 @@
{$t('invite_people')}
-
-
- + {#if currentUser} +
+
+
-
{user.name}
+
{currentUser.name}
{$t('owner')}
-
+
+ {/if} + {#each album.albumUsers as { user } (user.id)}
{user.name}
+ {#if user.id !== album.ownerId} + + handleMenuRemove(user)} text={$t('remove')} /> + + {/if}
{/each}
+ +{#if selectedRemoveUser} + (selectedRemoveUser = null)} + /> +{/if} diff --git a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte index cbdb38192e082..4b362ea7a1ac0 100644 --- a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -737,6 +737,7 @@ albumOrder = order; await setModeToView(); }} + onRemove={handleRemoveUser} onClose={() => (viewMode = ViewMode.VIEW)} onToggleEnabledActivity={handleToggleEnableActivity} onShowSelectSharedUser={() => (viewMode = ViewMode.SELECT_USERS)} From 07830f9802c7883aaaf5e401802b1e012eefdc2f Mon Sep 17 00:00:00 2001 From: Pranav-8bit Date: Sat, 28 Sep 2024 13:06:46 +0530 Subject: [PATCH 2/5] added few more type hint --- .../album-page/album-options.svelte | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/web/src/lib/components/album-page/album-options.svelte b/web/src/lib/components/album-page/album-options.svelte index 27d99018023c3..1e55c84f4e11f 100644 --- a/web/src/lib/components/album-page/album-options.svelte +++ b/web/src/lib/components/album-page/album-options.svelte @@ -1,7 +1,7 @@ +{#if !selectedRemoveUser}
@@ -123,12 +113,13 @@
{$t('invite_people')}
- {#if currentUser} + + {#if user}
- +
-
{currentUser.name}
+
{user.name}
{$t('owner')}
{/if} @@ -150,6 +141,7 @@
+{/if} {#if selectedRemoveUser} Date: Wed, 2 Oct 2024 23:04:01 +0530 Subject: [PATCH 4/5] user check removed and conflict in view mode resolved between option and share info modal --- .../album-page/album-options.svelte | 2 -- .../[[assetId=id]]/+page.svelte | 32 +++++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/web/src/lib/components/album-page/album-options.svelte b/web/src/lib/components/album-page/album-options.svelte index 96d17bb39a096..dd2d601338e75 100644 --- a/web/src/lib/components/album-page/album-options.svelte +++ b/web/src/lib/components/album-page/album-options.svelte @@ -114,7 +114,6 @@
{$t('invite_people')}
- {#if user}
@@ -122,7 +121,6 @@
{user.name}
{$t('owner')}
- {/if} {#each album.albumUsers as { user } (user.id)}
diff --git a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte index 99794bd3711c8..b2b628be1854b 100644 --- a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -345,19 +345,23 @@ } }; - const handleRemoveUser = async (userId: string) => { - if (userId == 'me' || userId === $user.id) { - await goto(backUrl); - return; - } + const handleRemoveUser = async (userId: string, nextViewMode: ViewMode) => { + if (userId == 'me' || userId === $user.id) { + await goto(backUrl); + return; + } + + try { + await refreshAlbum(); + + // Dynamically set the view mode based on the passed argument + viewMode = album.albumUsers.length > 0 ? nextViewMode : ViewMode.VIEW; + + } catch (error) { + handleError(error, $t('errors.error_deleting_shared_user')); + } +}; - try { - await refreshAlbum(); - viewMode = album.albumUsers.length > 0 ? ViewMode.VIEW_USERS : ViewMode.VIEW; - } catch (error) { - handleError(error, $t('errors.error_deleting_shared_user')); - } - }; const handleDownloadAlbum = async () => { await downloadAlbum(album); @@ -730,7 +734,7 @@ (viewMode = ViewMode.VIEW)} {album} - onRemove={handleRemoveUser} + onRemove={(userId) => handleRemoveUser(userId, ViewMode.VIEW_USERS)} onRefreshAlbum={refreshAlbum} /> {/if} @@ -744,7 +748,7 @@ albumOrder = order; await setModeToView(); }} - onRemove={handleRemoveUser} + onRemove={(userId)=>handleRemoveUser(userId, ViewMode.OPTIONS)} onClose={() => (viewMode = ViewMode.VIEW)} onToggleEnabledActivity={handleToggleEnableActivity} onShowSelectSharedUser={() => (viewMode = ViewMode.SELECT_USERS)} From 3d524d21404028486c9fe240ee1829c87b01ee69 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 10 Oct 2024 15:46:09 +0700 Subject: [PATCH 5/5] format fix --- .../album-page/album-options.svelte | 95 ++++++++++--------- .../[[assetId=id]]/+page.svelte | 30 +++--- 2 files changed, 62 insertions(+), 63 deletions(-) diff --git a/web/src/lib/components/album-page/album-options.svelte b/web/src/lib/components/album-page/album-options.svelte index dd2d601338e75..53fd355c4b0db 100644 --- a/web/src/lib/components/album-page/album-options.svelte +++ b/web/src/lib/components/album-page/album-options.svelte @@ -5,7 +5,7 @@ removeUserFromAlbum, type AlbumResponseDto, type UserResponseDto, - AssetOrder + AssetOrder, } from '@immich/sdk'; import { mdiArrowDownThin, mdiArrowUpThin, mdiPlus, mdiDotsVertical } from '@mdi/js'; import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte'; @@ -83,62 +83,63 @@ {#if !selectedRemoveUser} - -
-
-

{$t('settings').toUpperCase()}

-
- {#if order} - +
+
+

{$t('settings').toUpperCase()}

+
+ {#if order} + + {/if} + - {/if} - -
-
-
-
{$t('people').toUpperCase()}
-
- - -
-
- -
-
{user.name}
-
{$t('owner')}
+
+
+
{$t('people').toUpperCase()}
+
+ - {#each album.albumUsers as { user } (user.id)} -
+
{user.name}
- {#if user.id !== album.ownerId} - - handleMenuRemove(user)} text={$t('remove')} /> - - {/if} +
{$t('owner')}
- {/each} + + {#each album.albumUsers as { user } (user.id)} +
+
+ +
+
{user.name}
+ {#if user.id !== album.ownerId} + + + handleMenuRemove(user)} text={$t('remove')} /> + + {/if} +
+ {/each} +
-
- + {/if} {#if selectedRemoveUser} diff --git a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte index b2b628be1854b..fdf21a2bb82cd 100644 --- a/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte +++ b/web/src/routes/(user)/albums/[albumId=id]/[[photos=photos]]/[[assetId=id]]/+page.svelte @@ -346,22 +346,20 @@ }; const handleRemoveUser = async (userId: string, nextViewMode: ViewMode) => { - if (userId == 'me' || userId === $user.id) { - await goto(backUrl); - return; - } - - try { - await refreshAlbum(); - - // Dynamically set the view mode based on the passed argument - viewMode = album.albumUsers.length > 0 ? nextViewMode : ViewMode.VIEW; + if (userId == 'me' || userId === $user.id) { + await goto(backUrl); + return; + } - } catch (error) { - handleError(error, $t('errors.error_deleting_shared_user')); - } -}; + try { + await refreshAlbum(); + // Dynamically set the view mode based on the passed argument + viewMode = album.albumUsers.length > 0 ? nextViewMode : ViewMode.VIEW; + } catch (error) { + handleError(error, $t('errors.error_deleting_shared_user')); + } + }; const handleDownloadAlbum = async () => { await downloadAlbum(album); @@ -734,7 +732,7 @@ (viewMode = ViewMode.VIEW)} {album} - onRemove={(userId) => handleRemoveUser(userId, ViewMode.VIEW_USERS)} + onRemove={(userId) => handleRemoveUser(userId, ViewMode.VIEW_USERS)} onRefreshAlbum={refreshAlbum} /> {/if} @@ -748,7 +746,7 @@ albumOrder = order; await setModeToView(); }} - onRemove={(userId)=>handleRemoveUser(userId, ViewMode.OPTIONS)} + onRemove={(userId) => handleRemoveUser(userId, ViewMode.OPTIONS)} onClose={() => (viewMode = ViewMode.VIEW)} onToggleEnabledActivity={handleToggleEnableActivity} onShowSelectSharedUser={() => (viewMode = ViewMode.SELECT_USERS)}