Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web): small fixes for empty placeholder #7859

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 11 additions & 15 deletions web/src/lib/components/shared-components/empty-placeholder.svelte
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
<script lang="ts">
import empty1Url from '$lib/assets/empty-1.svg';

export let actionHandler: undefined | (() => unknown) = undefined;
export let text = '';
export let alt = '';
export let onClick: undefined | (() => unknown) = undefined;
export let text: string;
export let fullWidth = false;
export let src = empty1Url;

const noop = () => {};
$: width = fullWidth ? 'w-full' : 'w-1/2';

$: handler = actionHandler || noop;
$: width = fullWidth ? 'w-full' : 'w-[50%]';

const hoverClasses = actionHandler
? `border dark:border-immich-dark-gray hover:bg-immich-primary/5 dark:hover:bg-immich-dark-primary/25 hover:cursor-pointer`
const hoverClasses = onClick
? `border dark:border-immich-dark-gray hover:bg-immich-primary/5 dark:hover:bg-immich-dark-primary/25`
: '';
</script>

<!-- svelte-ignore a11y-no-static-element-interactions -->
<div
on:click={handler}
on:keydown={handler}
<svelte:element
this={onClick ? 'button' : 'div'}
on:click={onClick}
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}"
>
<img {src} {alt} width="500" draggable="false" />
<p class="text-immich-text-gray-500 text-center dark:text-immich-dark-fg">{text}</p>
</div>
<img {src} alt="" width="500" draggable="false" />
<p class="text-immich-text-gray-500 dark:text-immich-dark-fg">{text}</p>
</svelte:element>
6 changes: 1 addition & 5 deletions web/src/routes/(user)/albums/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,7 @@

<!-- Empty Message -->
{:else}
<EmptyPlaceholder
text="Create an album to organize your photos and videos"
actionHandler={handleCreateAlbum}
alt="Empty albums"
/>
<EmptyPlaceholder text="Create an album to organize your photos and videos" onClick={handleCreateAlbum} />
{/if}
</UserPageLayout>

Expand Down
6 changes: 1 addition & 5 deletions web/src/routes/(user)/archive/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@

<UserPageLayout hideNavbar={$isMultiSelectState} title={data.meta.title} scrollbar={false}>
<AssetGrid {assetStore} {assetInteractionStore} removeAction={AssetAction.UNARCHIVE}>
<EmptyPlaceholder
text="Archive photos and videos to hide them from your Photos view"
alt="Empty archive"
slot="empty"
/>
<EmptyPlaceholder text="Archive photos and videos to hide them from your Photos view" slot="empty" />
</AssetGrid>
</UserPageLayout>
6 changes: 1 addition & 5 deletions web/src/routes/(user)/favorites/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@

<UserPageLayout hideNavbar={$isMultiSelectState} title={data.meta.title} scrollbar={false}>
<AssetGrid {assetStore} {assetInteractionStore} removeAction={AssetAction.UNFAVORITE}>
<EmptyPlaceholder
text="Add favorites to quickly find your best pictures and videos"
alt="Empty favorites"
slot="empty"
/>
<EmptyPlaceholder text="Add favorites to quickly find your best pictures and videos" slot="empty" />
</AssetGrid>
</UserPageLayout>
6 changes: 1 addition & 5 deletions web/src/routes/(user)/photos/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@
{#if $user.memoriesEnabled}
<MemoryLane />
{/if}
<EmptyPlaceholder
text="CLICK TO UPLOAD YOUR FIRST PHOTO"
actionHandler={() => openFileUploadDialog()}
slot="empty"
/>
<EmptyPlaceholder text="CLICK TO UPLOAD YOUR FIRST PHOTO" onClick={() => openFileUploadDialog()} slot="empty" />
</AssetGrid>
</UserPageLayout>
1 change: 0 additions & 1 deletion web/src/routes/(user)/sharing/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
{#if data.sharedAlbums.length === 0}
<EmptyPlaceholder
text="Create a shared album to share photos and videos with people in your network"
alt="Empty album list"
src={empty2Url}
/>
{/if}
Expand Down
7 changes: 1 addition & 6 deletions web/src/routes/(user)/trash/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,7 @@
<p class="font-medium text-gray-500/60 dark:text-gray-300/60 p-4">
Trashed items will be permanently deleted after {$serverConfig.trashDays} days.
</p>
<EmptyPlaceholder
text="Trashed photos and videos will show up here."
alt="Empty trash can"
slot="empty"
src={empty3Url}
/>
<EmptyPlaceholder text="Trashed photos and videos will show up here." src={empty3Url} slot="empty" />
</AssetGrid>
</UserPageLayout>
{/if}
Expand Down
3 changes: 1 addition & 2 deletions web/src/routes/admin/library-management/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,7 @@
{:else}
<EmptyPlaceholder
text="Create an external library to view your photos and videos"
actionHandler={() => (toCreateLibrary = true)}
alt="Empty albums"
onClick={() => (toCreateLibrary = true)}
/>
{/if}
</div>
Expand Down
7 changes: 1 addition & 6 deletions web/src/routes/admin/repair/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,7 @@
<section class="w-full pb-28 sm:w-5/6 md:w-[850px]">
{#if matches.length + extras.length + orphans.length === 0}
<div class="w-full">
<EmptyPlaceholder
fullWidth
text="Untracked and missing files will show up here"
alt="Empty report"
src={empty4Url}
/>
<EmptyPlaceholder fullWidth text="Untracked and missing files will show up here" src={empty4Url} />
</div>
{:else}
<div class="gap-2">
Expand Down