mirror of
https://github.com/immich-app/immich.git
synced 2025-05-30 19:54:52 -04:00
feat(web): remove and delete from album (#3725)
This commit is contained in:
parent
3fb60aca4f
commit
4cbb18aabc
@ -9,8 +9,10 @@
|
|||||||
import { OnAssetDelete, getAssetControlContext } from '../asset-select-control-bar.svelte';
|
import { OnAssetDelete, getAssetControlContext } from '../asset-select-control-bar.svelte';
|
||||||
import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
|
import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
|
||||||
import { handleError } from '../../../utils/handle-error';
|
import { handleError } from '../../../utils/handle-error';
|
||||||
|
import MenuOption from '../../shared-components/context-menu/menu-option.svelte';
|
||||||
|
|
||||||
export let onAssetDelete: OnAssetDelete;
|
export let onAssetDelete: OnAssetDelete;
|
||||||
|
export let menuItem = false;
|
||||||
const { getAssets, clearSelect } = getAssetControlContext();
|
const { getAssets, clearSelect } = getAssetControlContext();
|
||||||
|
|
||||||
let isShowConfirmation = false;
|
let isShowConfirmation = false;
|
||||||
@ -46,7 +48,11 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CircleIconButton title="Delete" logo={DeleteOutline} on:click={() => (isShowConfirmation = true)} />
|
{#if menuItem}
|
||||||
|
<MenuOption text="Delete" on:click={() => (isShowConfirmation = true)} />
|
||||||
|
{:else}
|
||||||
|
<CircleIconButton title="Delete" logo={DeleteOutline} on:click={() => (isShowConfirmation = true)} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#if isShowConfirmation}
|
{#if isShowConfirmation}
|
||||||
<ConfirmDialogue
|
<ConfirmDialogue
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
||||||
|
import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
|
||||||
import {
|
import {
|
||||||
NotificationType,
|
NotificationType,
|
||||||
notificationController,
|
notificationController,
|
||||||
} from '$lib/components/shared-components/notification/notification';
|
} from '$lib/components/shared-components/notification/notification';
|
||||||
import { AlbumResponseDto, api } from '@api';
|
import { AlbumResponseDto, api } from '@api';
|
||||||
import DeleteOutline from 'svelte-material-icons/DeleteOutline.svelte';
|
import DeleteOutline from 'svelte-material-icons/DeleteOutline.svelte';
|
||||||
|
import MenuOption from '../../shared-components/context-menu/menu-option.svelte';
|
||||||
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
|
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
|
||||||
import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
|
|
||||||
|
|
||||||
export let album: AlbumResponseDto;
|
export let album: AlbumResponseDto;
|
||||||
export let onRemove: ((assetIds: string[]) => void) | undefined = undefined;
|
export let onRemove: ((assetIds: string[]) => void) | undefined = undefined;
|
||||||
|
export let menuItem = false;
|
||||||
|
|
||||||
const { getAssets, clearSelect } = getAssetControlContext();
|
const { getAssets, clearSelect } = getAssetControlContext();
|
||||||
|
|
||||||
@ -48,11 +50,15 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<CircleIconButton title="Remove from album" on:click={() => (isShowConfirmation = true)} logo={DeleteOutline} />
|
{#if menuItem}
|
||||||
|
<MenuOption text="Remove from album" on:click={() => (isShowConfirmation = true)} />
|
||||||
|
{:else}
|
||||||
|
<CircleIconButton title="Remove from album" logo={DeleteOutline} on:click={() => (isShowConfirmation = true)} />
|
||||||
|
{/if}
|
||||||
|
|
||||||
{#if isShowConfirmation}
|
{#if isShowConfirmation}
|
||||||
<ConfirmDialogue
|
<ConfirmDialogue
|
||||||
title="Remove Asset{getAssets().size > 1 ? 's' : ''}"
|
title="Remove from {album.albumName}"
|
||||||
confirmText="Remove"
|
confirmText="Remove"
|
||||||
on:confirm={removeFromAlbum}
|
on:confirm={removeFromAlbum}
|
||||||
on:cancel={() => (isShowConfirmation = false)}
|
on:cancel={() => (isShowConfirmation = false)}
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
||||||
import AddToAlbum from '$lib/components/photos-page/actions/add-to-album.svelte';
|
import AddToAlbum from '$lib/components/photos-page/actions/add-to-album.svelte';
|
||||||
import CreateSharedLink from '$lib/components/photos-page/actions/create-shared-link.svelte';
|
import CreateSharedLink from '$lib/components/photos-page/actions/create-shared-link.svelte';
|
||||||
|
import DeleteAssets from '$lib/components/photos-page/actions/delete-assets.svelte';
|
||||||
import DownloadAction from '$lib/components/photos-page/actions/download-action.svelte';
|
import DownloadAction from '$lib/components/photos-page/actions/download-action.svelte';
|
||||||
import FavoriteAction from '$lib/components/photos-page/actions/favorite-action.svelte';
|
import FavoriteAction from '$lib/components/photos-page/actions/favorite-action.svelte';
|
||||||
import RemoveFromAlbum from '$lib/components/photos-page/actions/remove-from-album.svelte';
|
import RemoveFromAlbum from '$lib/components/photos-page/actions/remove-from-album.svelte';
|
||||||
@ -287,14 +288,17 @@
|
|||||||
<AddToAlbum />
|
<AddToAlbum />
|
||||||
<AddToAlbum shared />
|
<AddToAlbum shared />
|
||||||
</AssetSelectContextMenu>
|
</AssetSelectContextMenu>
|
||||||
{#if isOwned || isAllUserOwned}
|
|
||||||
<RemoveFromAlbum bind:album onRemove={(assetIds) => handleRemoveAssets(assetIds)} />
|
|
||||||
{/if}
|
|
||||||
<AssetSelectContextMenu icon={DotsVertical} title="Menu">
|
<AssetSelectContextMenu icon={DotsVertical} title="Menu">
|
||||||
{#if isAllUserOwned}
|
{#if isAllUserOwned}
|
||||||
<FavoriteAction menuItem removeFavorite={isAllFavorite} />
|
<FavoriteAction menuItem removeFavorite={isAllFavorite} />
|
||||||
{/if}
|
{/if}
|
||||||
<DownloadAction menuItem filename="{album.albumName}.zip" />
|
<DownloadAction menuItem filename="{album.albumName}.zip" />
|
||||||
|
{#if isOwned || isAllUserOwned}
|
||||||
|
<RemoveFromAlbum menuItem bind:album onRemove={(assetIds) => handleRemoveAssets(assetIds)} />
|
||||||
|
{/if}
|
||||||
|
{#if isAllUserOwned}
|
||||||
|
<DeleteAssets menuItem onAssetDelete={(assetId) => assetStore.removeAsset(assetId)} />
|
||||||
|
{/if}
|
||||||
</AssetSelectContextMenu>
|
</AssetSelectContextMenu>
|
||||||
</AssetSelectControlBar>
|
</AssetSelectControlBar>
|
||||||
{:else}
|
{:else}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user