Skip to content

Commit 7391ea6

Browse files
authored
chore: large file size grid view styling (#20472)
* chore: large file grid styles * chore: large file grid styles
1 parent f972b8d commit 7391ea6

File tree

2 files changed

+18
-39
lines changed

2 files changed

+18
-39
lines changed
Lines changed: 17 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
<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';
64
import { toTimelineAsset } from '$lib/utils/timeline-util';
75
import { type AssetResponseDto } from '@immich/sdk';
8-
import { mdiHeart } from '@mdi/js';
9-
import { t } from 'svelte-i18n';
106
117
interface Props {
128
asset: AssetResponseDto;
@@ -16,43 +12,26 @@
1612
let { asset, onViewAsset }: Props = $props();
1713
1814
let assetData = $derived(JSON.stringify(asset, null, 2));
15+
16+
let boxWidth = $state(300);
1917
</script>
2018

2119
<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}
2323
>
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} />
3926

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}
4730
</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>
5736
</div>
5837
</div>

web/src/routes/(user)/utilities/large-files/[[photos=photos]]/[[assetId=id]]/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
</script>
5757

5858
<UserPageLayout title={data.meta.title} scrollbar={true}>
59-
<div class="flex gap-2 flex-wrap">
59+
<div class="grid gap-2 grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6">
6060
{#if assets && data.assets.length > 0}
6161
{#each assets as asset (asset.id)}
6262
<LargeAssetData {asset} onViewAsset={(asset) => setAsset(asset)} />

0 commit comments

Comments
 (0)