diff --git a/web/src/lib/components/album-page/__tests__/album-card.spec.ts b/web/src/lib/components/album-page/__tests__/album-card.spec.ts index 6c6dc98f73..0c4996fbfc 100644 --- a/web/src/lib/components/album-page/__tests__/album-card.spec.ts +++ b/web/src/lib/components/album-page/__tests__/album-card.spec.ts @@ -1,6 +1,4 @@ -import { createObjectURLMock } from '$lib/__mocks__/jsdom-url.mock'; import { sdkMock } from '$lib/__mocks__/sdk.mock'; -import { ThumbnailFormat } from '@immich/sdk'; import { albumFactory } from '@test-data'; import '@testing-library/jest-dom'; import { fireEvent, render, waitFor, type RenderResult } from '@testing-library/svelte'; @@ -33,7 +31,7 @@ describe('AlbumCard component', () => { shared: true, }, ])('shows album data without thumbnail with count $count - shared: $shared', async ({ album, count, shared }) => { - sut = render(AlbumCard, { album }); + sut = render(AlbumCard, { album, showItemCount: true }); const albumImgElement = sut.getByTestId('album-image'); const albumNameElement = sut.getByTestId('album-name'); @@ -52,36 +50,22 @@ describe('AlbumCard component', () => { expect(albumDetailsElement).toHaveTextContent(new RegExp(detailsText)); }); - it('shows album data and loads the thumbnail image when available', async () => { - const thumbnailFile = new File([new Blob()], 'fileThumbnail'); - const thumbnailUrl = 'blob:thumbnailUrlOne'; - sdkMock.getAssetThumbnail.mockResolvedValue(thumbnailFile); - createObjectURLMock.mockReturnValueOnce(thumbnailUrl); - + it('shows album data', () => { const album = albumFactory.build({ - albumThumbnailAssetId: 'thumbnailIdOne', shared: false, albumName: 'some album name', }); - sut = render(AlbumCard, { album }); + sut = render(AlbumCard, { album, showItemCount: true }); const albumImgElement = sut.getByTestId('album-image'); const albumNameElement = sut.getByTestId('album-name'); const albumDetailsElement = sut.getByTestId('album-details'); - expect(albumImgElement).toHaveAttribute('alt', album.albumName); - - await waitFor(() => expect(albumImgElement).toHaveAttribute('src', thumbnailUrl)); expect(albumImgElement).toHaveAttribute('alt', album.albumName); - expect(sdkMock.getAssetThumbnail).toHaveBeenCalledTimes(1); - expect(sdkMock.getAssetThumbnail).toHaveBeenCalledWith({ - id: 'thumbnailIdOne', - format: ThumbnailFormat.Jpeg, - }); - expect(createObjectURLMock).toHaveBeenCalledWith(thumbnailFile); + expect(albumImgElement).toHaveAttribute('src'); expect(albumNameElement).toHaveTextContent('some album name'); - expect(albumDetailsElement).toHaveTextContent('0 items'); + expect(albumDetailsElement).toHaveTextContent('0 item'); }); it('hides context menu when "onShowContextMenu" is undefined', () => { diff --git a/web/src/lib/components/album-page/album-card-group.svelte b/web/src/lib/components/album-page/album-card-group.svelte new file mode 100644 index 0000000000..4c303caa68 --- /dev/null +++ b/web/src/lib/components/album-page/album-card-group.svelte @@ -0,0 +1,69 @@ + + +{#if group} +
toggleAlbumGroupCollapsing(group.id)} class="w-fit mt-2 pt-2 pr-2 mb-2 hover:cursor-pointer">
+
{album.albumName}
- + {#if showDateRange && album.startDate && album.endDate} ++ {getShortDateRange(album.startDate, album.endDate)} +
+ {/if} + + {#if showItemCount}{album.assetCount.toLocaleString($locale)} - {album.assetCount == 1 ? `item` : `items`} + {album.assetCount === 1 ? `item` : `items`}
{/if} - {#if isSharingView || album.shared} -·
+ {#if (showOwner || album.shared) && showItemCount} +•
{/if} - {#if isSharingView} - {#await getAlbumOwnerInfo() then albumOwner} - {#if $user.email == albumOwner.email} -Owned
- {:else} -- Shared by {albumOwner.name} -
- {/if} - {/await} + {#if showOwner} + {#if $user.id === album.ownerId} +Owned
+ {:else if album.owner} +Shared by {album.owner.name}
+ {:else} +Shared
+ {/if} {:else if album.shared}Shared
{/if} diff --git a/web/src/lib/components/album-page/album-cover.svelte b/web/src/lib/components/album-page/album-cover.svelte new file mode 100644 index 0000000000..8e289de03a --- /dev/null +++ b/web/src/lib/components/album-page/album-cover.svelte @@ -0,0 +1,36 @@ + + +Create album
Cover
+Covers
{:else}List
+List
{/if}Delete album
- -
+
+
+
+
Are you sure you want to delete the album {albumToDelete.albumName}?
-If this album is shared, other users will not be able to access it anymore.
-Are you sure you want to delete the album {albumToDelete.albumName}?
+If this album is shared, other users will not be able to access it anymore.
+Action |
---|
{album.albumName} | -- {album.assetCount} - {album.assetCount > 1 ? `items` : `item`} + |
+ |
-
-
-
-
-
-
-
APPEARS IN
{#each albums as album} -{album.albumName}
-{album.assetCount} items
- {#if album.shared} -· Shared
- {/if} +