From 4a9f58bf9b1eb719aba5af6aa3e34112e16fe25a Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Fri, 13 Oct 2023 14:47:31 -0400 Subject: [PATCH] fix(web): empty placeholders (#4470) --- .../components/photos-page/asset-grid.svelte | 5 ++- .../empty-placeholder.svelte | 37 +++++++++---------- web/src/routes/(user)/sharing/+page.svelte | 32 ++++++++-------- 3 files changed, 36 insertions(+), 38 deletions(-) diff --git a/web/src/lib/components/photos-page/asset-grid.svelte b/web/src/lib/components/photos-page/asset-grid.svelte index 59ab2ef769..0fc2711639 100644 --- a/web/src/lib/components/photos-page/asset-grid.svelte +++ b/web/src/lib/components/photos-page/asset-grid.svelte @@ -37,6 +37,7 @@ let showSkeleton = true; $: timelineY = element?.scrollTop || 0; + $: isEmpty = $assetStore.initialized && $assetStore.buckets.length === 0; const onKeyboardPress = (event: KeyboardEvent) => handleKeyboardPress(event); const dispatch = createEventDispatcher<{ select: AssetResponseDto; escape: void }>(); @@ -325,7 +326,7 @@
- {#if $assetStore.initialized && $assetStore.buckets.length === 0} + {#if isEmpty} {/if}
diff --git a/web/src/lib/components/shared-components/empty-placeholder.svelte b/web/src/lib/components/shared-components/empty-placeholder.svelte index 8e99502d8f..1ba673181c 100644 --- a/web/src/lib/components/shared-components/empty-placeholder.svelte +++ b/web/src/lib/components/shared-components/empty-placeholder.svelte @@ -4,26 +4,25 @@ export let actionHandler: undefined | (() => unknown) = undefined; export let text = ''; export let alt = ''; + export let fullWidth = false; export let src = empty1Url; - let hoverClasses = 'hover:bg-immich-primary/5 dark:hover:bg-immich-dark-primary/25 hover:cursor-pointer'; + const noop = () => undefined; + + $: 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` + : ''; -{#if actionHandler} - -
- -

{text}

-
-{:else} -
- -

{text}

-
-{/if} + +
+ +

{text}

+
diff --git a/web/src/routes/(user)/sharing/+page.svelte b/web/src/routes/(user)/sharing/+page.svelte index 5bc8495e49..5a2c3d9c1b 100644 --- a/web/src/routes/(user)/sharing/+page.svelte +++ b/web/src/routes/(user)/sharing/+page.svelte @@ -1,20 +1,21 @@