1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-01 08:31:59 +00:00

feat(web): add emptyplaceholder when no assets (#3155)

* add emptyplace holder when no assets

* remove unecessary number type

* wording

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
faupau 2023-07-09 04:32:34 +02:00 committed by GitHub
parent 73e82303e7
commit 27018e4ab6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -12,18 +12,31 @@
import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte';
import { assetInteractionStore, isMultiSelectStoreState, selectedAssets } from '$lib/stores/asset-interaction.store';
import { assetStore } from '$lib/stores/assets.store';
import { onDestroy } from 'svelte';
import { onDestroy, onMount } from 'svelte';
import DotsVertical from 'svelte-material-icons/DotsVertical.svelte';
import Plus from 'svelte-material-icons/Plus.svelte';
import type { PageData } from './$types';
import { api } from '@api';
import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte';
import { openFileUploadDialog } from '$lib/utils/file-uploader';
export let data: PageData;
let assetCount = 1;
onMount(async () => {
const { data: allAssetCount } = await api.assetApi.getAssetCountByUserId();
assetCount = allAssetCount.total;
});
onDestroy(() => {
assetInteractionStore.clearMultiselect();
});
$: isAllFavorite = Array.from($selectedAssets).every((asset) => asset.isFavorite);
const handleUpload = async () => {
openFileUploadDialog();
};
</script>
<UserPageLayout user={data.user} hideNavbar={$isMultiSelectStoreState} showUploadButton>
@ -45,6 +58,11 @@
</AssetSelectControlBar>
{/if}
</svelte:fragment>
<AssetGrid slot="content" showMemoryLane />
<svelte:fragment slot="content">
{#if assetCount}
<AssetGrid showMemoryLane />
{:else}
<EmptyPlaceholder text="CLICK TO UPLOAD YOUR FIRST PHOTO" actionHandler={handleUpload} />
{/if}
</svelte:fragment>
</UserPageLayout>