refactor: album users modal (#18266)

This commit is contained in:
Daniel Dietzler
2025-05-13 19:20:44 +02:00
committed by GitHub
parent 3fdc1df89c
commit 668288ca20
3 changed files with 16 additions and 20 deletions
@@ -441,6 +441,14 @@
await modalManager.show(QrCodeModal, { title: $t('view_link'), value: makeSharedLinkUrl(sharedLink.key) });
}
};
const handleEditUsers = async () => {
const changed = await modalManager.show(AlbumUsersModal, { album });
if (changed) {
album = await getAlbumInfo({ id: album.id, withoutAssets: true });
}
};
</script>
<div class="flex overflow-hidden" use:scrollMemoryClearer={{ routeStartsWith: AppRoute.ALBUMS }}>
@@ -631,13 +639,13 @@
{/if}
<!-- owner -->
<button type="button" onclick={() => (viewMode = AlbumPageViewMode.VIEW_USERS)}>
<button type="button" onclick={handleEditUsers}>
<UserAvatar user={album.owner} size="md" />
</button>
<!-- users with write access (collaborators) -->
{#each album.albumUsers.filter(({ role }) => role === AlbumUserRole.Editor) as { user } (user.id)}
<button type="button" onclick={() => (viewMode = AlbumPageViewMode.VIEW_USERS)}>
<button type="button" onclick={handleEditUsers}>
<UserAvatar {user} size="md" />
</button>
{/each}
@@ -649,7 +657,7 @@
color="gray"
size="20"
icon={mdiDotsVertical}
onclick={() => (viewMode = AlbumPageViewMode.VIEW_USERS)}
onclick={handleEditUsers}
/>
{/if}
@@ -722,15 +730,6 @@
{/if}
</div>
{#if viewMode === AlbumPageViewMode.VIEW_USERS}
<AlbumUsersModal
onClose={() => (viewMode = AlbumPageViewMode.VIEW)}
{album}
onRemove={(userId) => handleRemoveUser(userId, AlbumPageViewMode.VIEW_USERS)}
onRefreshAlbum={refreshAlbum}
/>
{/if}
{#if viewMode === AlbumPageViewMode.OPTIONS && $user}
<AlbumOptions
{album}