From 026ffbe133ae462bd252bfb047632886c56f503d Mon Sep 17 00:00:00 2001 From: Yonggan Date: Sat, 10 Jun 2023 13:51:19 +0200 Subject: [PATCH] Add selection of favorites --- .../components/album-page/album-viewer.svelte | 2 + .../actions/select-all-assets.svelte | 4 +- .../asset-select-control-bar.svelte | 1 - web/src/routes/(user)/favorites/+page.svelte | 127 +++++++++--------- 4 files changed, 70 insertions(+), 64 deletions(-) diff --git a/web/src/lib/components/album-page/album-viewer.svelte b/web/src/lib/components/album-page/album-viewer.svelte index 1eae441ca8..59ab00cc1c 100644 --- a/web/src/lib/components/album-page/album-viewer.svelte +++ b/web/src/lib/components/album-page/album-viewer.svelte @@ -24,6 +24,7 @@ import Button from '../elements/buttons/button.svelte'; import CircleIconButton from '../elements/buttons/circle-icon-button.svelte'; import DownloadAction from '../photos-page/actions/download-action.svelte'; + import SelectAllAssets from '../photos-page/actions/select-all-assets.svelte'; import RemoveFromAlbum from '../photos-page/actions/remove-from-album.svelte'; import AssetSelectControlBar from '../photos-page/asset-select-control-bar.svelte'; import UserAvatar from '../shared-components/user-avatar.svelte'; @@ -341,6 +342,7 @@ assets={multiSelectAsset} clearSelect={() => (multiSelectAsset = new Set())} > + {#if isOwned} diff --git a/web/src/lib/components/photos-page/actions/select-all-assets.svelte b/web/src/lib/components/photos-page/actions/select-all-assets.svelte index 64f9cfaa08..20f5a3d06e 100644 --- a/web/src/lib/components/photos-page/actions/select-all-assets.svelte +++ b/web/src/lib/components/photos-page/actions/select-all-assets.svelte @@ -7,7 +7,7 @@ import {api, AssetResponseDto} from '@api'; import SelectAll from 'svelte-material-icons/SelectAll.svelte'; import TimerSand from 'svelte-material-icons/TimerSand.svelte'; - import {OnSelectAll, getAssetControlContext} from '../asset-select-control-bar.svelte'; + import {getAssetControlContext} from '../asset-select-control-bar.svelte'; import { assetInteractionStore, selectedAssets @@ -18,8 +18,6 @@ import {AssetGridState} from "$lib/models/asset-grid-state"; import {sumBy} from "lodash-es"; - export let onSelectAll: OnSelectAll; - let selecting = false; const handleSelectAll = async () => { diff --git a/web/src/lib/components/photos-page/asset-select-control-bar.svelte b/web/src/lib/components/photos-page/asset-select-control-bar.svelte index 866446ddc9..3e0f4bcca0 100644 --- a/web/src/lib/components/photos-page/asset-select-control-bar.svelte +++ b/web/src/lib/components/photos-page/asset-select-control-bar.svelte @@ -2,7 +2,6 @@ import { createContext } from '$lib/utils/context'; export type OnAssetDelete = (assetId: string) => void; - export type OnSelectAll = (assetId: string) => void; export type OnAssetArchive = (asset: AssetResponseDto, archived: boolean) => void; export type OnAssetFavorite = (asset: AssetResponseDto, favorite: boolean) => void; diff --git a/web/src/routes/(user)/favorites/+page.svelte b/web/src/routes/(user)/favorites/+page.svelte index 8efeb1b866..0906042a31 100644 --- a/web/src/routes/(user)/favorites/+page.svelte +++ b/web/src/routes/(user)/favorites/+page.svelte @@ -1,75 +1,82 @@ {#if isMultiSelectionMode} - (selectedAssets = new Set())}> - onAssetDelete(asset.id)} /> - - - - - - - - - - - + (selectedAssets = new Set())}> + onAssetDelete(asset.id)}/> + + + + + + + + + + + + {/if} -
- - {#if favorites.length === 0} - - {/if} +
+ + {#if favorites.length === 0} + + {/if} - -
+ +