mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
refactor(web): album users modal (#22153)
This commit is contained in:
parent
dfa38ec3ef
commit
eee94207ce
1 changed files with 18 additions and 29 deletions
|
|
@ -15,7 +15,7 @@
|
||||||
type AlbumResponseDto,
|
type AlbumResponseDto,
|
||||||
type UserResponseDto,
|
type UserResponseDto,
|
||||||
} from '@immich/sdk';
|
} from '@immich/sdk';
|
||||||
import { Modal, ModalBody, modalManager } from '@immich/ui';
|
import { Button, Modal, ModalBody, Text, modalManager } from '@immich/ui';
|
||||||
import { mdiDotsVertical } from '@mdi/js';
|
import { mdiDotsVertical } from '@mdi/js';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
|
|
@ -97,33 +97,25 @@
|
||||||
<Modal title={$t('options')} size="small" {onClose}>
|
<Modal title={$t('options')} size="small" {onClose}>
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<section class="immich-scrollbar max-h-[400px] overflow-y-auto pb-4">
|
<section class="immich-scrollbar max-h-[400px] overflow-y-auto pb-4">
|
||||||
<div class="flex w-full place-items-center justify-between gap-4 p-5">
|
{#each [{ user: album.owner, role: 'owner' }, ...album.albumUsers] as { user, role } (user.id)}
|
||||||
<div class="flex place-items-center gap-4">
|
<div class="flex w-full place-items-center justify-between gap-4 p-5 rounded-xl transition-colors">
|
||||||
<UserAvatar user={album.owner} size="md" />
|
|
||||||
<p class="text-sm font-medium">{album.owner.name}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="icon-{album.owner.id}" class="flex place-items-center">
|
|
||||||
<p class="text-sm">{$t('owner')}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{#each album.albumUsers as { user, role } (user.id)}
|
|
||||||
<div
|
|
||||||
class="flex w-full place-items-center justify-between gap-4 p-5 rounded-xl transition-colors hover:bg-gray-50 dark:hover:bg-gray-700"
|
|
||||||
>
|
|
||||||
<div class="flex place-items-center gap-4">
|
<div class="flex place-items-center gap-4">
|
||||||
<UserAvatar {user} size="md" />
|
<UserAvatar {user} size="md" />
|
||||||
<p class="text-sm font-medium">{user.name}</p>
|
<div class="flex flex-col">
|
||||||
</div>
|
<p class="font-medium">{user.name}</p>
|
||||||
|
<Text color="muted" size="tiny">
|
||||||
<div id="icon-{user.id}" class="flex place-items-center gap-2 text-sm">
|
{#if role === 'owner'}
|
||||||
<div>
|
{$t('owner')}
|
||||||
{#if role === AlbumUserRole.Viewer}
|
{:else if role === AlbumUserRole.Viewer}
|
||||||
{$t('role_viewer')}
|
{$t('role_viewer')}
|
||||||
{:else}
|
{:else}
|
||||||
{$t('role_editor')}
|
{$t('role_editor')}
|
||||||
{/if}
|
{/if}
|
||||||
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="icon-{user.id}" class="flex place-items-center">
|
||||||
{#if isOwned}
|
{#if isOwned}
|
||||||
<ButtonContextMenu icon={mdiDotsVertical} size="medium" title={$t('options')}>
|
<ButtonContextMenu icon={mdiDotsVertical} size="medium" title={$t('options')}>
|
||||||
{#if role === AlbumUserRole.Viewer}
|
{#if role === AlbumUserRole.Viewer}
|
||||||
|
|
@ -137,11 +129,8 @@
|
||||||
<MenuOption onClick={() => handleRemoveUser(user)} text={$t('remove')} />
|
<MenuOption onClick={() => handleRemoveUser(user)} text={$t('remove')} />
|
||||||
</ButtonContextMenu>
|
</ButtonContextMenu>
|
||||||
{:else if user.id == currentUser?.id}
|
{:else if user.id == currentUser?.id}
|
||||||
<button
|
<Button shape="round" variant="ghost" leadingIcon={undefined} onclick={() => handleRemoveUser(user)}
|
||||||
type="button"
|
>{$t('leave')}</Button
|
||||||
onclick={() => handleRemoveUser(user)}
|
|
||||||
class="text-sm font-medium text-primary transition-colors hover:text-immich-primary/75"
|
|
||||||
>{$t('leave')}</button
|
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue