mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(web): make assets cachable (#1724)
This commit is contained in:
parent
74cd3d66c6
commit
d91cc3616b
38 changed files with 91 additions and 82 deletions
|
|
@ -44,10 +44,10 @@ describe('AlbumCard component', () => {
|
|||
const albumDetailsElement = sut.getByTestId('album-details');
|
||||
const detailsText = `${count} items` + (shared ? ' . Shared' : '');
|
||||
|
||||
expect(albumImgElement).toHaveAttribute('src', 'no-thumbnail.png');
|
||||
expect(albumImgElement).toHaveAttribute('src');
|
||||
expect(albumImgElement).toHaveAttribute('alt', album.id);
|
||||
|
||||
await waitFor(() => expect(albumImgElement).toHaveAttribute('src', 'no-thumbnail.png'));
|
||||
await waitFor(() => expect(albumImgElement).toHaveAttribute('src'));
|
||||
|
||||
expect(albumImgElement).toHaveAttribute('alt', album.id);
|
||||
expect(apiMock.assetApi.getAssetThumbnail).not.toHaveBeenCalled();
|
||||
|
|
@ -108,7 +108,7 @@ describe('AlbumCard component', () => {
|
|||
sut = render(AlbumCard, { album });
|
||||
|
||||
const albumImgElement = sut.getByTestId('album-image');
|
||||
await waitFor(() => expect(albumImgElement).toHaveAttribute('src', 'no-thumbnail.png'));
|
||||
await waitFor(() => expect(albumImgElement).toHaveAttribute('src'));
|
||||
});
|
||||
|
||||
it('dispatches custom "click" event with the album in context', async () => {
|
||||
|
|
|
|||
|
|
@ -16,14 +16,13 @@
|
|||
import { createEventDispatcher, onMount } from 'svelte';
|
||||
import DotsVertical from 'svelte-material-icons/DotsVertical.svelte';
|
||||
import CircleIconButton from '../shared-components/circle-icon-button.svelte';
|
||||
import noThumbnailUrl from '$lib/assets/no-thumbnail.png';
|
||||
|
||||
export let album: AlbumResponseDto;
|
||||
|
||||
const NO_THUMBNAIL = 'no-thumbnail.png';
|
||||
|
||||
let imageData = `/api/asset/thumbnail/${album.albumThumbnailAssetId}?format=${ThumbnailFormat.Webp}`;
|
||||
if (!album.albumThumbnailAssetId) {
|
||||
imageData = NO_THUMBNAIL;
|
||||
imageData = noThumbnailUrl;
|
||||
}
|
||||
|
||||
const dispatchClick = createEventDispatcher<OnClick>();
|
||||
|
|
@ -51,7 +50,7 @@
|
|||
};
|
||||
|
||||
onMount(async () => {
|
||||
imageData = (await loadHighQualityThumbnail(album.albumThumbnailAssetId)) || NO_THUMBNAIL;
|
||||
imageData = (await loadHighQualityThumbnail(album.albumThumbnailAssetId)) || noThumbnailUrl;
|
||||
});
|
||||
|
||||
const locale = navigator.language;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@
|
|||
import { openFileUploadDialog } from '$lib/utils/file-uploader';
|
||||
import { bulkDownload } from '$lib/utils/asset-utils';
|
||||
import GalleryViewer from '../shared-components/gallery-viewer/gallery-viewer.svelte';
|
||||
import ImmichLogo from '../shared-components/immich-logo.svelte';
|
||||
|
||||
export let album: AlbumResponseDto;
|
||||
export let sharedLink: SharedLinkResponseDto | undefined = undefined;
|
||||
|
|
@ -419,13 +420,7 @@
|
|||
class="flex gap-2 place-items-center hover:cursor-pointer ml-6"
|
||||
href="https://immich.app"
|
||||
>
|
||||
<img
|
||||
src="/immich-logo.svg"
|
||||
alt="immich logo"
|
||||
height="30"
|
||||
width="30"
|
||||
draggable="false"
|
||||
/>
|
||||
<ImmichLogo height={30} width={30} />
|
||||
<h1 class="font-immich-title text-lg text-immich-primary dark:text-immich-dark-primary">
|
||||
IMMICH
|
||||
</h1>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
import Link from 'svelte-material-icons/Link.svelte';
|
||||
import ShareCircle from 'svelte-material-icons/ShareCircle.svelte';
|
||||
import { goto } from '$app/navigation';
|
||||
import ImmichLogo from '../shared-components/immich-logo.svelte';
|
||||
|
||||
export let album: AlbumResponseDto;
|
||||
export let sharedUsersInAlbum: Set<UserResponseDto>;
|
||||
|
|
@ -53,7 +54,7 @@
|
|||
<BaseModal on:close={() => dispatch('close')}>
|
||||
<svelte:fragment slot="title">
|
||||
<span class="flex gap-2 place-items-center">
|
||||
<img src="/immich-logo.svg" width="24" alt="Immich" draggable="false" />
|
||||
<ImmichLogo width={24} />
|
||||
<p class="font-medium">Invite to album</p>
|
||||
</span>
|
||||
</svelte:fragment>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue