feat (server, web): Implement Archive (#2225)

* feat (server, web): add archive

* chore: generate api

* feat (web): add empty placeholder for archive page

* chore: remove title on favorites page

Duplicates sidebar selection. Two pages (Archive and Favorites)
are consistent now

* refactor (web): create EmptyPlaceholder component for empty pages

* fixed menu close button not close:

* fix (web): remove not necessary store call

* test (web): simplify asset tests code

* test (web): simplify asset tests code

* chore (server): remove isArchived while uploading

* chore (server): remove isArchived from typesense schema

* chore: generate api

* fix (web): delete asset from archive page

* chore: change archive asset count endpoint

old endpoint: /asset/archived-count-by-user-id
new endpoint: /asset/stat/archive

* chore: generate api

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Sergey Kondrikov
2023-04-12 18:37:52 +03:00
committed by GitHub
parent eb9481b668
commit d314805caf
39 changed files with 861 additions and 97 deletions

View File

@@ -10,7 +10,7 @@
import ShareVariantOutline from 'svelte-material-icons/ShareVariantOutline.svelte';
import StarMinusOutline from 'svelte-material-icons/StarMinusOutline.svelte';
import Error from '../../+error.svelte';
import empty1Url from '$lib/assets/empty-1.svg';
import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte';
import UserPageLayout from '$lib/components/layouts/user-page-layout.svelte';
import type { PageData } from './$types';
@@ -24,7 +24,7 @@
onMount(async () => {
try {
const { data: assets } = await api.assetApi.getAllAssets(true);
const { data: assets } = await api.assetApi.getAllAssets(true, undefined);
favorites = assets;
} catch {
handleError(Error, 'Unable to load favorites');
@@ -96,19 +96,14 @@
/>
{/if}
<UserPageLayout user={data.user} title={data.meta.title} hideNavbar={isMultiSelectionMode}>
<UserPageLayout user={data.user} hideNavbar={isMultiSelectionMode}>
<section>
<!-- Empty Message -->
{#if favorites.length === 0}
<div
class="border dark:border-immich-dark-gray hover:bg-immich-primary/5 dark:hover:bg-immich-dark-primary/25 hover:cursor-pointer p-5 w-[50%] m-auto mt-10 bg-gray-50 dark:bg-immich-dark-gray rounded-3xl flex flex-col place-content-center place-items-center"
>
<img src={empty1Url} alt="Empty shared album" width="500" draggable="false" />
<p class="text-center text-immich-text-gray-500 dark:text-immich-dark-fg">
Add favorites to quickly find your best pictures and videos
</p>
</div>
<EmptyPlaceholder
text="Add favorites to quickly find your best pictures and videos"
alt="Empty favorites"
/>
{/if}
<GalleryViewer assets={favorites} bind:selectedAssets />