mirror of
https://github.com/immich-app/immich.git
synced 2025-02-04 01:09:14 -05:00
refactor(web): refactor album selection modal and album summary component (#9658)
This commit is contained in:
parent
61b850f0ce
commit
a341ab0050
5 changed files with 24 additions and 20 deletions
|
@ -26,7 +26,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<span class="my-2 flex gap-2 text-sm font-medium text-gray-500" data-testid="album-details">
|
<span class="my-2 flex gap-2 text-sm font-medium text-gray-500" data-testid="album-details">
|
||||||
<p>{getDateRange(startDate, endDate)}</p>
|
<span>{getDateRange(startDate, endDate)}</span>
|
||||||
<p>·</p>
|
<span>•</span>
|
||||||
<p>{album.assetCount} items</p>
|
<span>{album.assetCount} items</span>
|
||||||
</span>
|
</span>
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<script lang="ts">
|
||||||
|
import type { AlbumResponseDto } from '@immich/sdk';
|
||||||
|
|
||||||
|
export let album: AlbumResponseDto;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<span>{album.assetCount} items</span>
|
||||||
|
{#if album.shared}
|
||||||
|
<span>• Shared</span>
|
||||||
|
{/if}
|
|
@ -3,13 +3,13 @@
|
||||||
import { ThumbnailFormat, type AlbumResponseDto } from '@immich/sdk';
|
import { ThumbnailFormat, type AlbumResponseDto } from '@immich/sdk';
|
||||||
import { createEventDispatcher } from 'svelte';
|
import { createEventDispatcher } from 'svelte';
|
||||||
import { normalizeSearchString } from '$lib/utils/string-utils.js';
|
import { normalizeSearchString } from '$lib/utils/string-utils.js';
|
||||||
|
import AlbumListItemDetails from './album-list-item-details.svelte';
|
||||||
|
|
||||||
const dispatch = createEventDispatcher<{
|
const dispatch = createEventDispatcher<{
|
||||||
album: void;
|
album: void;
|
||||||
}>();
|
}>();
|
||||||
|
|
||||||
export let album: AlbumResponseDto;
|
export let album: AlbumResponseDto;
|
||||||
export let variant: 'simple' | 'full' = 'full';
|
|
||||||
export let searchQuery = '';
|
export let searchQuery = '';
|
||||||
let albumNameArray: string[] = ['', '', ''];
|
let albumNameArray: string[] = ['', '', ''];
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
on:click={() => dispatch('album')}
|
on:click={() => dispatch('album')}
|
||||||
class="flex w-full gap-4 px-6 py-2 text-left transition-colors hover:bg-gray-200 dark:hover:bg-gray-700 rounded-xl"
|
class="flex w-full gap-4 px-6 py-2 text-left transition-colors hover:bg-gray-200 dark:hover:bg-gray-700 rounded-xl"
|
||||||
>
|
>
|
||||||
<div class="h-12 w-12 shrink-0 rounded-xl bg-slate-300">
|
<span class="h-12 w-12 shrink-0 rounded-xl bg-slate-300">
|
||||||
{#if album.albumThumbnailAssetId}
|
{#if album.albumThumbnailAssetId}
|
||||||
<img
|
<img
|
||||||
src={getAssetThumbnailUrl(album.albumThumbnailAssetId, ThumbnailFormat.Webp)}
|
src={getAssetThumbnailUrl(album.albumThumbnailAssetId, ThumbnailFormat.Webp)}
|
||||||
|
@ -41,17 +41,13 @@
|
||||||
draggable="false"
|
draggable="false"
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</span>
|
||||||
<div class="flex h-12 flex-col items-start justify-center overflow-hidden">
|
<span class="flex h-12 flex-col items-start justify-center overflow-hidden">
|
||||||
<span class="w-full shrink overflow-hidden text-ellipsis whitespace-nowrap"
|
<span class="w-full shrink overflow-hidden text-ellipsis whitespace-nowrap"
|
||||||
>{albumNameArray[0]}<b>{albumNameArray[1]}</b>{albumNameArray[2]}</span
|
>{albumNameArray[0]}<b>{albumNameArray[1]}</b>{albumNameArray[2]}</span
|
||||||
>
|
>
|
||||||
<span class="flex gap-1 text-sm">
|
<span class="flex gap-1 text-sm">
|
||||||
{#if variant === 'simple'}
|
<AlbumListItemDetails {album} />
|
||||||
<span>{album.shared ? 'Shared' : ''}</span>
|
</span>
|
||||||
{:else}
|
|
||||||
<span>{album.assetCount} items{album.shared ? ' - Shared' : ''}</span>
|
|
||||||
{/if}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
|
||||||
</button>
|
</button>
|
||||||
|
|
|
@ -33,8 +33,8 @@
|
||||||
import { DateTime } from 'luxon';
|
import { DateTime } from 'luxon';
|
||||||
import { createEventDispatcher, onMount } from 'svelte';
|
import { createEventDispatcher, onMount } from 'svelte';
|
||||||
import { slide } from 'svelte/transition';
|
import { slide } from 'svelte/transition';
|
||||||
import { asByteUnitString } from '../../utils/byte-units';
|
import { asByteUnitString } from '$lib/utils/byte-units';
|
||||||
import { handleError } from '../../utils/handle-error';
|
import { handleError } from '$lib/utils/handle-error';
|
||||||
import ImageThumbnail from '../assets/thumbnail/image-thumbnail.svelte';
|
import ImageThumbnail from '../assets/thumbnail/image-thumbnail.svelte';
|
||||||
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
||||||
import PersonSidePanel from '../faces-page/person-side-panel.svelte';
|
import PersonSidePanel from '../faces-page/person-side-panel.svelte';
|
||||||
|
@ -43,6 +43,7 @@
|
||||||
import LoadingSpinner from '../shared-components/loading-spinner.svelte';
|
import LoadingSpinner from '../shared-components/loading-spinner.svelte';
|
||||||
import { NotificationType, notificationController } from '../shared-components/notification/notification';
|
import { NotificationType, notificationController } from '../shared-components/notification/notification';
|
||||||
import { shortcut } from '$lib/utils/shortcut';
|
import { shortcut } from '$lib/utils/shortcut';
|
||||||
|
import AlbumListItemDetails from './album-list-item-details.svelte';
|
||||||
|
|
||||||
export let asset: AssetResponseDto;
|
export let asset: AssetResponseDto;
|
||||||
export let albums: AlbumResponseDto[] = [];
|
export let albums: AlbumResponseDto[] = [];
|
||||||
|
@ -607,10 +608,7 @@
|
||||||
<p class="dark:text-immich-dark-primary">{album.albumName}</p>
|
<p class="dark:text-immich-dark-primary">{album.albumName}</p>
|
||||||
<div class="flex flex-col gap-0 text-sm">
|
<div class="flex flex-col gap-0 text-sm">
|
||||||
<div>
|
<div>
|
||||||
<span>{album.assetCount} items</span>
|
<AlbumListItemDetails {album} />
|
||||||
{#if album.shared}
|
|
||||||
<span> • Shared</span>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
{#if !shared && search.length === 0}
|
{#if !shared && search.length === 0}
|
||||||
<p class="px-5 py-3 text-xs">RECENT</p>
|
<p class="px-5 py-3 text-xs">RECENT</p>
|
||||||
{#each recentAlbums as album (album.id)}
|
{#each recentAlbums as album (album.id)}
|
||||||
<AlbumListItem variant="simple" {album} on:album={() => handleSelect(album)} />
|
<AlbumListItem {album} on:album={() => handleSelect(album)} />
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue