mirror of
https://github.com/immich-app/immich.git
synced 2025-01-09 21:36:46 +01:00
Add selection of favorites
This commit is contained in:
parent
05e851ef44
commit
026ffbe133
4 changed files with 70 additions and 64 deletions
|
@ -24,6 +24,7 @@
|
||||||
import Button from '../elements/buttons/button.svelte';
|
import Button from '../elements/buttons/button.svelte';
|
||||||
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
import CircleIconButton from '../elements/buttons/circle-icon-button.svelte';
|
||||||
import DownloadAction from '../photos-page/actions/download-action.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 RemoveFromAlbum from '../photos-page/actions/remove-from-album.svelte';
|
||||||
import AssetSelectControlBar from '../photos-page/asset-select-control-bar.svelte';
|
import AssetSelectControlBar from '../photos-page/asset-select-control-bar.svelte';
|
||||||
import UserAvatar from '../shared-components/user-avatar.svelte';
|
import UserAvatar from '../shared-components/user-avatar.svelte';
|
||||||
|
@ -341,6 +342,7 @@
|
||||||
assets={multiSelectAsset}
|
assets={multiSelectAsset}
|
||||||
clearSelect={() => (multiSelectAsset = new Set())}
|
clearSelect={() => (multiSelectAsset = new Set())}
|
||||||
>
|
>
|
||||||
|
<SelectAllAssets/>
|
||||||
<DownloadAction filename={album.albumName} sharedLinkKey={sharedLink?.key} />
|
<DownloadAction filename={album.albumName} sharedLinkKey={sharedLink?.key} />
|
||||||
{#if isOwned}
|
{#if isOwned}
|
||||||
<RemoveFromAlbum bind:album />
|
<RemoveFromAlbum bind:album />
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
import {api, AssetResponseDto} from '@api';
|
import {api, AssetResponseDto} from '@api';
|
||||||
import SelectAll from 'svelte-material-icons/SelectAll.svelte';
|
import SelectAll from 'svelte-material-icons/SelectAll.svelte';
|
||||||
import TimerSand from 'svelte-material-icons/TimerSand.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 {
|
import {
|
||||||
assetInteractionStore,
|
assetInteractionStore,
|
||||||
selectedAssets
|
selectedAssets
|
||||||
|
@ -18,8 +18,6 @@
|
||||||
import {AssetGridState} from "$lib/models/asset-grid-state";
|
import {AssetGridState} from "$lib/models/asset-grid-state";
|
||||||
import {sumBy} from "lodash-es";
|
import {sumBy} from "lodash-es";
|
||||||
|
|
||||||
export let onSelectAll: OnSelectAll;
|
|
||||||
|
|
||||||
let selecting = false;
|
let selecting = false;
|
||||||
|
|
||||||
const handleSelectAll = async () => {
|
const handleSelectAll = async () => {
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import { createContext } from '$lib/utils/context';
|
import { createContext } from '$lib/utils/context';
|
||||||
|
|
||||||
export type OnAssetDelete = (assetId: string) => void;
|
export type OnAssetDelete = (assetId: string) => void;
|
||||||
export type OnSelectAll = (assetId: string) => void;
|
|
||||||
export type OnAssetArchive = (asset: AssetResponseDto, archived: boolean) => void;
|
export type OnAssetArchive = (asset: AssetResponseDto, archived: boolean) => void;
|
||||||
export type OnAssetFavorite = (asset: AssetResponseDto, favorite: boolean) => void;
|
export type OnAssetFavorite = (asset: AssetResponseDto, favorite: boolean) => void;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,9 @@
|
||||||
import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte';
|
import AssetSelectControlBar from '$lib/components/photos-page/asset-select-control-bar.svelte';
|
||||||
import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte';
|
import EmptyPlaceholder from '$lib/components/shared-components/empty-placeholder.svelte';
|
||||||
import GalleryViewer from '$lib/components/shared-components/gallery-viewer/gallery-viewer.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 {handleError} from '$lib/utils/handle-error';
|
||||||
import {api, AssetResponseDto} from '@api';
|
import {api, AssetResponseDto} from '@api';
|
||||||
import {onMount} from 'svelte';
|
import {onMount} from 'svelte';
|
||||||
|
@ -20,7 +23,6 @@
|
||||||
|
|
||||||
let favorites: AssetResponseDto[] = [];
|
let favorites: AssetResponseDto[] = [];
|
||||||
let selectedAssets: Set<AssetResponseDto> = new Set();
|
let selectedAssets: Set<AssetResponseDto> = new Set();
|
||||||
|
|
||||||
export let data: PageData;
|
export let data: PageData;
|
||||||
|
|
||||||
$: isMultiSelectionMode = selectedAssets.size > 0;
|
$: isMultiSelectionMode = selectedAssets.size > 0;
|
||||||
|
@ -38,6 +40,10 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const handleSelectAll = () => {
|
||||||
|
selectedAssets = new Set(favorites);
|
||||||
|
};
|
||||||
|
|
||||||
const onAssetDelete = (assetId: string) => {
|
const onAssetDelete = (assetId: string) => {
|
||||||
favorites = favorites.filter((a) => a.id !== assetId);
|
favorites = favorites.filter((a) => a.id !== assetId);
|
||||||
};
|
};
|
||||||
|
@ -48,6 +54,7 @@
|
||||||
<AssetSelectControlBar assets={selectedAssets} clearSelect={() => (selectedAssets = new Set())}>
|
<AssetSelectControlBar assets={selectedAssets} clearSelect={() => (selectedAssets = new Set())}>
|
||||||
<FavoriteAction removeFavorite onAssetFavorite={(asset) => onAssetDelete(asset.id)}/>
|
<FavoriteAction removeFavorite onAssetFavorite={(asset) => onAssetDelete(asset.id)}/>
|
||||||
<CreateSharedLink/>
|
<CreateSharedLink/>
|
||||||
|
<CircleIconButton title="Delete" logo={SelectAll} on:click={handleSelectAll}/>
|
||||||
<AssetSelectContextMenu icon={Plus} title="Add">
|
<AssetSelectContextMenu icon={Plus} title="Add">
|
||||||
<AddToAlbum/>
|
<AddToAlbum/>
|
||||||
<AddToAlbum shared/>
|
<AddToAlbum shared/>
|
||||||
|
|
Loading…
Reference in a new issue