1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-24 12:42:44 +01:00

Add selection of favorites

This commit is contained in:
Yonggan 2023-06-10 13:51:19 +02:00
parent 05e851ef44
commit 026ffbe133
4 changed files with 70 additions and 64 deletions

View file

@ -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())}
>
<SelectAllAssets/>
<DownloadAction filename={album.albumName} sharedLinkKey={sharedLink?.key} />
{#if isOwned}
<RemoveFromAlbum bind:album />

View file

@ -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 () => {

View file

@ -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;

View file

@ -10,6 +10,9 @@
import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte';
import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte';
import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.svelte';
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
import SelectAll from 'svelte-material-icons/SelectAll.svelte';
import TimerSand from 'svelte-material-icons/TimerSand.svelte';
import {handleError} from '$lib/utils/handle-error';
import {api, AssetResponseDto} from '@api';
import {onMount} from 'svelte';
@ -20,7 +23,6 @@
let favorites: AssetResponseDto[] = [];
let selectedAssets: Set<AssetResponseDto> = new Set();
export let data: PageData;
$: isMultiSelectionMode = selectedAssets.size > 0;
@ -38,6 +40,10 @@
}
});
const handleSelectAll = () => {
selectedAssets = new Set(favorites);
};
const onAssetDelete = (assetId: string) => {
favorites = favorites.filter((a) => a.id !== assetId);
};
@ -48,6 +54,7 @@
<AssetSelectControlBar assets={selectedAssets} clearSelect={() => (selectedAssets = new Set())}>
<FavoriteAction removeFavorite onAssetFavorite={(asset) => onAssetDelete(asset.id)}/>
<CreateSharedLink/>
<CircleIconButton title="Delete" logo={SelectAll} on:click={handleSelectAll}/>
<AssetSelectContextMenu icon={Plus} title="Add">
<AddToAlbum/>
<AddToAlbum shared/>