Skip to content

Commit b7e5407

Browse files
fix(web): small fixes for empty placeholder (#7859)
1 parent 4023c66 commit b7e5407

File tree

9 files changed

+18
-50
lines changed

9 files changed

+18
-50
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,24 @@
11
<script lang="ts">
22
import empty1Url from '$lib/assets/empty-1.svg';
33
4-
export let actionHandler: undefined | (() => unknown) = undefined;
5-
export let text = '';
6-
export let alt = '';
4+
export let onClick: undefined | (() => unknown) = undefined;
5+
export let text: string;
76
export let fullWidth = false;
87
export let src = empty1Url;
98
10-
const noop = () => {};
9+
$: width = fullWidth ? 'w-full' : 'w-1/2';
1110
12-
$: handler = actionHandler || noop;
13-
$: width = fullWidth ? 'w-full' : 'w-[50%]';
14-
15-
const hoverClasses = actionHandler
16-
? `border dark:border-immich-dark-gray hover:bg-immich-primary/5 dark:hover:bg-immich-dark-primary/25 hover:cursor-pointer`
11+
const hoverClasses = onClick
12+
? `border dark:border-immich-dark-gray hover:bg-immich-primary/5 dark:hover:bg-immich-dark-primary/25`
1713
: '';
1814
</script>
1915

2016
<!-- svelte-ignore a11y-no-static-element-interactions -->
21-
<div
22-
on:click={handler}
23-
on:keydown={handler}
17+
<svelte:element
18+
this={onClick ? 'button' : 'div'}
19+
on:click={onClick}
2420
class="{width} m-auto mt-10 flex flex-col place-content-center place-items-center rounded-3xl bg-gray-50 p-5 dark:bg-immich-dark-gray {hoverClasses}"
2521
>
26-
<img {src} {alt} width="500" draggable="false" />
27-
<p class="text-immich-text-gray-500 text-center dark:text-immich-dark-fg">{text}</p>
28-
</div>
22+
<img {src} alt="" width="500" draggable="false" />
23+
<p class="text-immich-text-gray-500 dark:text-immich-dark-fg">{text}</p>
24+
</svelte:element>

Diff for: web/src/routes/(user)/albums/+page.svelte

+1-5
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,7 @@
375375

376376
<!-- Empty Message -->
377377
{:else}
378-
<EmptyPlaceholder
379-
text="Create an album to organize your photos and videos"
380-
actionHandler={handleCreateAlbum}
381-
alt="Empty albums"
382-
/>
378+
<EmptyPlaceholder text="Create an album to organize your photos and videos" onClick={handleCreateAlbum} />
383379
{/if}
384380
</UserPageLayout>
385381

Diff for: web/src/routes/(user)/archive/+page.svelte

+1-5
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@
4545

4646
<UserPageLayout hideNavbar={$isMultiSelectState} title={data.meta.title} scrollbar={false}>
4747
<AssetGrid {assetStore} {assetInteractionStore} removeAction={AssetAction.UNARCHIVE}>
48-
<EmptyPlaceholder
49-
text="Archive photos and videos to hide them from your Photos view"
50-
alt="Empty archive"
51-
slot="empty"
52-
/>
48+
<EmptyPlaceholder text="Archive photos and videos to hide them from your Photos view" slot="empty" />
5349
</AssetGrid>
5450
</UserPageLayout>

Diff for: web/src/routes/(user)/favorites/+page.svelte

+1-5
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@
5050

5151
<UserPageLayout hideNavbar={$isMultiSelectState} title={data.meta.title} scrollbar={false}>
5252
<AssetGrid {assetStore} {assetInteractionStore} removeAction={AssetAction.UNFAVORITE}>
53-
<EmptyPlaceholder
54-
text="Add favorites to quickly find your best pictures and videos"
55-
alt="Empty favorites"
56-
slot="empty"
57-
/>
53+
<EmptyPlaceholder text="Add favorites to quickly find your best pictures and videos" slot="empty" />
5854
</AssetGrid>
5955
</UserPageLayout>

Diff for: web/src/routes/(user)/photos/+page.svelte

+1-5
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,6 @@
8888
{#if $user.memoriesEnabled}
8989
<MemoryLane />
9090
{/if}
91-
<EmptyPlaceholder
92-
text="CLICK TO UPLOAD YOUR FIRST PHOTO"
93-
actionHandler={() => openFileUploadDialog()}
94-
slot="empty"
95-
/>
91+
<EmptyPlaceholder text="CLICK TO UPLOAD YOUR FIRST PHOTO" onClick={() => openFileUploadDialog()} slot="empty" />
9692
</AssetGrid>
9793
</UserPageLayout>

Diff for: web/src/routes/(user)/sharing/+page.svelte

-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@
9292
{#if data.sharedAlbums.length === 0}
9393
<EmptyPlaceholder
9494
text="Create a shared album to share photos and videos with people in your network"
95-
alt="Empty album list"
9695
src={empty2Url}
9796
/>
9897
{/if}

Diff for: web/src/routes/(user)/trash/+page.svelte

+1-6
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,7 @@
9191
<p class="font-medium text-gray-500/60 dark:text-gray-300/60 p-4">
9292
Trashed items will be permanently deleted after {$serverConfig.trashDays} days.
9393
</p>
94-
<EmptyPlaceholder
95-
text="Trashed photos and videos will show up here."
96-
alt="Empty trash can"
97-
slot="empty"
98-
src={empty3Url}
99-
/>
94+
<EmptyPlaceholder text="Trashed photos and videos will show up here." src={empty3Url} slot="empty" />
10095
</AssetGrid>
10196
</UserPageLayout>
10297
{/if}

Diff for: web/src/routes/admin/library-management/+page.svelte

+1-2
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,7 @@
462462
{:else}
463463
<EmptyPlaceholder
464464
text="Create an external library to view your photos and videos"
465-
actionHandler={() => (toCreateLibrary = true)}
466-
alt="Empty albums"
465+
onClick={() => (toCreateLibrary = true)}
467466
/>
468467
{/if}
469468
</div>

Diff for: web/src/routes/admin/repair/+page.svelte

+1-6
Original file line numberDiff line numberDiff line change
@@ -203,12 +203,7 @@
203203
<section class="w-full pb-28 sm:w-5/6 md:w-[850px]">
204204
{#if matches.length + extras.length + orphans.length === 0}
205205
<div class="w-full">
206-
<EmptyPlaceholder
207-
fullWidth
208-
text="Untracked and missing files will show up here"
209-
alt="Empty report"
210-
src={empty4Url}
211-
/>
206+
<EmptyPlaceholder fullWidth text="Untracked and missing files will show up here" src={empty4Url} />
212207
</div>
213208
{:else}
214209
<div class="gap-2">

0 commit comments

Comments
 (0)