mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix(web): shared album avatars opening modal (#26719)
Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
@@ -24,10 +24,11 @@
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
album: AlbumResponseDto;
|
album: AlbumResponseDto;
|
||||||
|
readOnly?: boolean;
|
||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
let { album, onClose }: Props = $props();
|
let { album, readOnly = false, onClose }: Props = $props();
|
||||||
|
|
||||||
const handleRoleSelect = async (user: UserResponseDto, role: AlbumUserRole | 'none') => {
|
const handleRoleSelect = async (user: UserResponseDto, role: AlbumUserRole | 'none') => {
|
||||||
if (role === 'none') {
|
if (role === 'none') {
|
||||||
@@ -72,14 +73,14 @@
|
|||||||
onAlbumUpdate={(newAlbum) => (album = newAlbum)}
|
onAlbumUpdate={(newAlbum) => (album = newAlbum)}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Modal title={$t('options')} {onClose} size="small">
|
<Modal title={readOnly ? $t('album') : $t('options')} {onClose} size="small">
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<Stack gap={6}>
|
<Stack gap={6}>
|
||||||
<div>
|
<div>
|
||||||
<Text size="medium" fontWeight="semi-bold">{$t('settings')}</Text>
|
<Text size="medium" fontWeight="semi-bold">{$t('settings')}</Text>
|
||||||
<div class="mt-2 grid gap-y-3 ps-2">
|
<div class="mt-2 grid gap-y-3 ps-2">
|
||||||
{#if album.order}
|
{#if album.order}
|
||||||
<Field label={$t('display_order')}>
|
<Field label={$t('display_order')} disabled={readOnly}>
|
||||||
<Select
|
<Select
|
||||||
value={album.order}
|
value={album.order}
|
||||||
options={[
|
options={[
|
||||||
@@ -90,7 +91,7 @@
|
|||||||
/>
|
/>
|
||||||
</Field>
|
</Field>
|
||||||
{/if}
|
{/if}
|
||||||
<Field label={$t('comments_and_likes')} description={$t('let_others_respond')}>
|
<Field label={$t('comments_and_likes')} description={$t('let_others_respond')} disabled={readOnly}>
|
||||||
<Switch
|
<Switch
|
||||||
checked={album.isActivityEnabled}
|
checked={album.isActivityEnabled}
|
||||||
onCheckedChange={(checked) => handleUpdateAlbum(album, { isActivityEnabled: checked })}
|
onCheckedChange={(checked) => handleUpdateAlbum(album, { isActivityEnabled: checked })}
|
||||||
@@ -102,7 +103,9 @@
|
|||||||
<div>
|
<div>
|
||||||
<HStack fullWidth class="mb-2 justify-between">
|
<HStack fullWidth class="mb-2 justify-between">
|
||||||
<Text size="medium" fontWeight="semi-bold">{$t('people')}</Text>
|
<Text size="medium" fontWeight="semi-bold">{$t('people')}</Text>
|
||||||
<HeaderActionButton action={AddUsers} />
|
{#if !readOnly}
|
||||||
|
<HeaderActionButton action={AddUsers} />
|
||||||
|
{/if}
|
||||||
</HStack>
|
</HStack>
|
||||||
<div class="ps-2">
|
<div class="ps-2">
|
||||||
{#each album.albumUsers as { user, role } (user.id)}
|
{#each album.albumUsers as { user, role } (user.id)}
|
||||||
@@ -113,7 +116,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<Text size="small">{user.name}</Text>
|
<Text size="small">{user.name}</Text>
|
||||||
</div>
|
</div>
|
||||||
<Field class="w-32" disabled={role === AlbumUserRole.Owner}>
|
<Field class="w-32" disabled={readOnly || role === AlbumUserRole.Owner}>
|
||||||
<Select
|
<Select
|
||||||
value={role}
|
value={role}
|
||||||
options={[
|
options={[
|
||||||
@@ -129,20 +132,22 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-4">
|
{#if !readOnly}
|
||||||
<HStack class="mb-2 justify-between">
|
<div class="mb-4">
|
||||||
<Text size="medium" fontWeight="semi-bold">{$t('shared_links')}</Text>
|
<HStack class="mb-2 justify-between">
|
||||||
<HeaderActionButton action={CreateSharedLink} />
|
<Text size="medium" fontWeight="semi-bold">{$t('shared_links')}</Text>
|
||||||
</HStack>
|
<HeaderActionButton action={CreateSharedLink} />
|
||||||
|
</HStack>
|
||||||
|
|
||||||
<div class="ps-2">
|
<div class="ps-2">
|
||||||
<Stack gap={4}>
|
<Stack gap={4}>
|
||||||
{#each sharedLinks as sharedLink (sharedLink.id)}
|
{#each sharedLinks as sharedLink (sharedLink.id)}
|
||||||
<AlbumSharedLink {album} {sharedLink} />
|
<AlbumSharedLink {album} {sharedLink} />
|
||||||
{/each}
|
{/each}
|
||||||
</Stack>
|
</Stack>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{/if}
|
||||||
</Stack>
|
</Stack>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
+33
-30
@@ -37,7 +37,6 @@
|
|||||||
import { TimelineManager } from '$lib/managers/timeline-manager/timeline-manager.svelte';
|
import { TimelineManager } from '$lib/managers/timeline-manager/timeline-manager.svelte';
|
||||||
import type { TimelineAsset } from '$lib/managers/timeline-manager/types';
|
import type { TimelineAsset } from '$lib/managers/timeline-manager/types';
|
||||||
import AlbumOptionsModal from '$lib/modals/AlbumOptionsModal.svelte';
|
import AlbumOptionsModal from '$lib/modals/AlbumOptionsModal.svelte';
|
||||||
import SharedLinkCreateModal from '$lib/modals/SharedLinkCreateModal.svelte';
|
|
||||||
import { Route } from '$lib/route';
|
import { Route } from '$lib/route';
|
||||||
import {
|
import {
|
||||||
getAlbumActions,
|
getAlbumActions,
|
||||||
@@ -66,6 +65,7 @@
|
|||||||
mdiArrowLeft,
|
mdiArrowLeft,
|
||||||
mdiCogOutline,
|
mdiCogOutline,
|
||||||
mdiDeleteOutline,
|
mdiDeleteOutline,
|
||||||
|
mdiDotsHorizontal,
|
||||||
mdiDotsVertical,
|
mdiDotsVertical,
|
||||||
mdiDownload,
|
mdiDownload,
|
||||||
mdiImageOutline,
|
mdiImageOutline,
|
||||||
@@ -373,38 +373,41 @@
|
|||||||
<!-- ALBUM SHARING -->
|
<!-- ALBUM SHARING -->
|
||||||
{#if album.albumUsers.length > 1 || (album.hasSharedLink && isOwned)}
|
{#if album.albumUsers.length > 1 || (album.hasSharedLink && isOwned)}
|
||||||
<div class="my-3 flex gap-x-1">
|
<div class="my-3 flex gap-x-1">
|
||||||
<!-- link -->
|
<button
|
||||||
{#if album.hasSharedLink && isOwned}
|
class="flex gap-x-1"
|
||||||
<IconButton
|
type="button"
|
||||||
aria-label={$t('create_link_to_share')}
|
onclick={() => modalManager.show(AlbumOptionsModal, { album, readOnly: !isOwned })}
|
||||||
color="secondary"
|
>
|
||||||
size="medium"
|
<!-- owner & users with write access (collaborators) -->
|
||||||
shape="round"
|
{#each album.albumUsers.filter(({ role }) => role === AlbumUserRole.Editor || role === AlbumUserRole.Owner) as { user } (user.id)}
|
||||||
icon={mdiLink}
|
|
||||||
onclick={() => modalManager.show(SharedLinkCreateModal, { albumId: album.id })}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
|
|
||||||
<!-- users with write access (collaborators) -->
|
|
||||||
{#each album.albumUsers.filter(({ role }) => role === AlbumUserRole.Editor || role === AlbumUserRole.Owner) as { user } (user.id)}
|
|
||||||
<button type="button" onclick={() => modalManager.show(AlbumOptionsModal, { album })}>
|
|
||||||
<UserAvatar {user} size="md" />
|
<UserAvatar {user} size="md" />
|
||||||
</button>
|
{/each}
|
||||||
{/each}
|
|
||||||
|
|
||||||
<!-- display ellipsis if there are readonly users too -->
|
<!-- display ellipsis if there are readonly users too -->
|
||||||
{#if albumHasViewers}
|
{#if albumHasViewers}
|
||||||
<IconButton
|
<IconButton
|
||||||
shape="round"
|
shape="round"
|
||||||
aria-label={$t('view_all_users')}
|
aria-label={$t('view_all_users')}
|
||||||
color="secondary"
|
color="secondary"
|
||||||
size="medium"
|
size="medium"
|
||||||
icon={mdiDotsVertical}
|
icon={mdiDotsHorizontal}
|
||||||
onclick={() => modalManager.show(AlbumOptionsModal, { album })}
|
/>
|
||||||
/>
|
{/if}
|
||||||
|
|
||||||
|
{#if album.hasSharedLink && isOwned}
|
||||||
|
<IconButton
|
||||||
|
aria-label={$t('shared_link_manage_links')}
|
||||||
|
color="secondary"
|
||||||
|
size="medium"
|
||||||
|
shape="round"
|
||||||
|
icon={mdiLink}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
|
||||||
|
{#if isOwned}
|
||||||
|
<ActionButton action={Share} />
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<ActionButton action={Share} />
|
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<AlbumDescription
|
<AlbumDescription
|
||||||
|
|||||||
Reference in New Issue
Block a user