create readonly view on frontend
This commit is contained in:
@@ -136,6 +136,9 @@
|
|||||||
$: showActivityStatus =
|
$: showActivityStatus =
|
||||||
album.sharedUsers.length > 0 && !$showAssetViewer && (album.isActivityEnabled || $numberOfComments > 0);
|
album.sharedUsers.length > 0 && !$showAssetViewer && (album.isActivityEnabled || $numberOfComments > 0);
|
||||||
|
|
||||||
|
$: userHasWriteAccess = !album.albumPermissions.find(({ user: {id } }) => id === $user.id)?.readonly;
|
||||||
|
$: albumHasReadonlyUsers = album.albumPermissions.some(({ readonly }) => readonly);
|
||||||
|
|
||||||
afterNavigate(({ from }) => {
|
afterNavigate(({ from }) => {
|
||||||
assetViewingStore.showAssetViewer(false);
|
assetViewingStore.showAssetViewer(false);
|
||||||
|
|
||||||
@@ -414,11 +417,13 @@
|
|||||||
{#if viewMode === ViewMode.VIEW || viewMode === ViewMode.ALBUM_OPTIONS}
|
{#if viewMode === ViewMode.VIEW || viewMode === ViewMode.ALBUM_OPTIONS}
|
||||||
<ControlAppBar showBackButton backIcon={mdiArrowLeft} on:close={() => goto(backUrl)}>
|
<ControlAppBar showBackButton backIcon={mdiArrowLeft} on:close={() => goto(backUrl)}>
|
||||||
<svelte:fragment slot="trailing">
|
<svelte:fragment slot="trailing">
|
||||||
|
{#if userHasWriteAccess}
|
||||||
<CircleIconButton
|
<CircleIconButton
|
||||||
title="Add photos"
|
title="Add photos"
|
||||||
on:click={() => (viewMode = ViewMode.SELECT_ASSETS)}
|
on:click={() => (viewMode = ViewMode.SELECT_ASSETS)}
|
||||||
icon={mdiImagePlusOutline}
|
icon={mdiImagePlusOutline}
|
||||||
/>
|
/>
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#if isOwned}
|
{#if isOwned}
|
||||||
<CircleIconButton
|
<CircleIconButton
|
||||||
@@ -559,13 +564,25 @@
|
|||||||
<UserAvatar user={album.owner} size="md" />
|
<UserAvatar user={album.owner} size="md" />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<!-- users -->
|
<!-- users with write access (collaborators) -->
|
||||||
{#each album.sharedUsers as user (user.id)}
|
{#each album.albumPermissions.filter(({readonly}) => !readonly) as {user} (user.id)}
|
||||||
<button on:click={() => (viewMode = ViewMode.VIEW_USERS)}>
|
<button on:click={() => (viewMode = ViewMode.VIEW_USERS)}>
|
||||||
<UserAvatar {user} size="md" />
|
<UserAvatar {user} size="md" />
|
||||||
</button>
|
</button>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
|
<!-- display ellipsis if there are readonly users too -->
|
||||||
|
{#if albumHasReadonlyUsers}
|
||||||
|
<CircleIconButton
|
||||||
|
title="View all users"
|
||||||
|
backgroundColor="#d3d3d3"
|
||||||
|
forceDark
|
||||||
|
size="20"
|
||||||
|
icon={mdiDotsVertical}
|
||||||
|
on:click={() => (viewMode = ViewMode.VIEW_USERS)}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#if isOwned}
|
{#if isOwned}
|
||||||
<CircleIconButton
|
<CircleIconButton
|
||||||
backgroundColor="#d3d3d3"
|
backgroundColor="#d3d3d3"
|
||||||
|
|||||||
Reference in New Issue
Block a user