|
1 | 1 | <script lang="ts">
|
2 |
| - import Icon from '$lib/components/elements/icon.svelte'; |
3 |
| - import { getAssetThumbnailUrl } from '$lib/utils'; |
4 |
| - import { getAssetResolution, getFileSize } from '$lib/utils/asset-utils'; |
5 |
| - import { getAltText } from '$lib/utils/thumbnail-util'; |
| 2 | + import Thumbnail from '$lib/components/assets/thumbnail/thumbnail.svelte'; |
| 3 | + import { getFileSize } from '$lib/utils/asset-utils'; |
6 | 4 | import { toTimelineAsset } from '$lib/utils/timeline-util';
|
7 | 5 | import { type AssetResponseDto } from '@immich/sdk';
|
8 |
| - import { mdiHeart } from '@mdi/js'; |
9 |
| - import { t } from 'svelte-i18n'; |
10 | 6 |
|
11 | 7 | interface Props {
|
12 | 8 | asset: AssetResponseDto;
|
|
16 | 12 | let { asset, onViewAsset }: Props = $props();
|
17 | 13 |
|
18 | 14 | let assetData = $derived(JSON.stringify(asset, null, 2));
|
| 15 | +
|
| 16 | + let boxWidth = $state(300); |
19 | 17 | </script>
|
20 | 18 |
|
21 | 19 | <div
|
22 |
| - class="max-w-60 rounded-xl border-4 transition-colors font-semibold text-xs bg-gray-200 dark:bg-gray-800 border-gray-200 dark:border-gray-800" |
| 20 | + class="w-full aspect-square rounded-xl border-4 transition-colors font-semibold text-xs bg-gray-200 dark:bg-gray-800 border-gray-200 dark:border-gray-800" |
| 21 | + bind:clientWidth={boxWidth} |
| 22 | + title={assetData} |
23 | 23 | >
|
24 |
| - <div class="relative w-full"> |
25 |
| - <button type="button" onclick={() => onViewAsset(asset)} class="block relative w-full" aria-label={$t('keep')}> |
26 |
| - <!-- THUMBNAIL--> |
27 |
| - <img |
28 |
| - src={getAssetThumbnailUrl(asset.id)} |
29 |
| - alt={$getAltText(toTimelineAsset(asset))} |
30 |
| - title={assetData} |
31 |
| - class="h-60 object-cover rounded-t-xl w-full" |
32 |
| - draggable="false" |
33 |
| - /> |
34 |
| - |
35 |
| - <!-- OVERLAY CHIP --> |
36 |
| - {#if !!asset.libraryId} |
37 |
| - <div class="absolute bottom-1 end-3 px-4 py-1 rounded-xl text-xs transition-colors bg-red-300/90">External</div> |
38 |
| - {/if} |
| 24 | + <div class="relative w-full h-full overflow-hidden rounded-lg"> |
| 25 | + <Thumbnail asset={toTimelineAsset(asset)} readonly onClick={() => onViewAsset(asset)} thumbnailSize={boxWidth} /> |
39 | 26 |
|
40 |
| - <!-- FAVORITE ICON --> |
41 |
| - {#if asset.isFavorite} |
42 |
| - <div class="absolute bottom-2 start-2"> |
43 |
| - <Icon path={mdiHeart} size="24" class="text-white" /> |
44 |
| - </div> |
45 |
| - {/if} |
46 |
| - </button> |
| 27 | + {#if !!asset.libraryId} |
| 28 | + <div class="absolute bottom-1 end-3 px-4 py-1 rounded-xl text-xs transition-colors bg-red-500">External</div> |
| 29 | + {/if} |
47 | 30 | </div>
|
48 |
| - |
49 |
| - <div class="flex justify-between items-center pl-2 pr-4 gap-2"> |
50 |
| - <div class="grid gap-y-2 py-2 text-xs transition-colors dark:text-white"> |
51 |
| - <div class="text-left text-ellipsis truncate">{asset.originalFileName}</div> |
52 |
| - <span>{getAssetResolution(asset)}</span> |
53 |
| - </div> |
54 |
| - <div class="dark:text-white text-lg font-bold whitespace-nowrap w-max"> |
55 |
| - {getFileSize(asset, 1)} |
56 |
| - </div> |
| 31 | + <div class="text-center mt-4 px-4 text-sm font-normal truncate" title={asset.originalFileName}> |
| 32 | + {asset.originalFileName} |
| 33 | + </div> |
| 34 | + <div class="text-center"> |
| 35 | + <p class="text-primary text-xl font-semibold py-3">{getFileSize(asset, 1)}</p> |
57 | 36 | </div>
|
58 | 37 | </div>
|
0 commit comments