mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
* chore(web): another missing translations * unused removed * more keys * lint fix * test fixed * dynamic translation fix * fixes * people search translation * params fixed * keep filter setting fix * lint fix * $t fixes * Update web/src/lib/i18n/en.json Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> * another missing * activity translation * link sharing translations * expiration dropdown fix - didn't work localized * notification title * device logout * search results * reset to default * unsaved change * select from computer * selected * select-2 * select-3 * unmerge * pluralize, force icu message * Update web/src/lib/components/asset-viewer/asset-viewer.svelte Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> * review fixes * remove user * plural fixes * ffmpeg settings * fixes * error title * plural fixes * onboarding * change password * more more * console log fix * another * api key desc * map marker * format fix * key fix * asset-utils * utils * misc --------- Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com>
62 lines
2.1 KiB
Svelte
62 lines
2.1 KiB
Svelte
<script lang="ts">
|
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
|
import {
|
|
NotificationType,
|
|
notificationController,
|
|
} from '$lib/components/shared-components/notification/notification';
|
|
import { getAlbumInfo, removeAssetFromAlbum, type AlbumResponseDto } from '@immich/sdk';
|
|
import { mdiDeleteOutline, mdiImageRemoveOutline } from '@mdi/js';
|
|
import MenuOption from '../../shared-components/context-menu/menu-option.svelte';
|
|
import { getAssetControlContext } from '../asset-select-control-bar.svelte';
|
|
import { dialogController } from '$lib/components/shared-components/dialog/dialog';
|
|
import { t } from 'svelte-i18n';
|
|
|
|
export let album: AlbumResponseDto;
|
|
export let onRemove: ((assetIds: string[]) => void) | undefined;
|
|
export let menuItem = false;
|
|
|
|
const { getAssets, clearSelect } = getAssetControlContext();
|
|
|
|
const removeFromAlbum = async () => {
|
|
const isConfirmed = await dialogController.show({
|
|
id: 'remove-from-album',
|
|
prompt: $t('remove_assets_album_confirmation', { values: { count: getAssets().size } }),
|
|
});
|
|
|
|
if (!isConfirmed) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
const ids = [...getAssets()].map((a) => a.id);
|
|
const results = await removeAssetFromAlbum({
|
|
id: album.id,
|
|
bulkIdsDto: { ids },
|
|
});
|
|
|
|
album = await getAlbumInfo({ id: album.id });
|
|
|
|
onRemove?.(ids);
|
|
|
|
const count = results.filter(({ success }) => success).length;
|
|
notificationController.show({
|
|
type: NotificationType.Info,
|
|
message: $t('assets_removed_count', { values: { count: count } }),
|
|
});
|
|
|
|
clearSelect();
|
|
} catch (error) {
|
|
console.error('Error [album-viewer] [removeAssetFromAlbum]', error);
|
|
notificationController.show({
|
|
type: NotificationType.Error,
|
|
message: $t('errors.error_removing_assets_from_album'),
|
|
});
|
|
}
|
|
};
|
|
</script>
|
|
|
|
{#if menuItem}
|
|
<MenuOption text={$t('remove_from_album')} icon={mdiImageRemoveOutline} onClick={removeFromAlbum} />
|
|
{:else}
|
|
<CircleIconButton title={$t('remove_from_album')} icon={mdiDeleteOutline} on:click={removeFromAlbum} />
|
|
{/if}
|