refactor: album users modal (#18266)
This commit is contained in:
+11
-12
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user