mirror of
https://github.com/immich-app/immich.git
synced 2025-05-24 01:12:58 -04:00
* feat(web): lighter timeline buckets * GalleryViewer * weird ssr * Remove generics from AssetInteraction * ensure keys on getAssetInfo, alt-text * empty - trigger ci * re-add alt-text * test fix * update tests * tests * missing import * fix: flappy e2e test * lint * revert settings * unneeded cast * fix after merge * missing import * lint * review * lint * avoid abbreviations * review comment - type safety in test * merge conflicts * lint * lint/abbreviations * fix: left-over migration --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
39 lines
1.3 KiB
Svelte
39 lines
1.3 KiB
Svelte
<script lang="ts">
|
|
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
|
|
import { AssetAction } from '$lib/constants';
|
|
import { modalManager } from '$lib/managers/modal-manager.svelte';
|
|
import { keepThisDeleteOthers } from '$lib/utils/asset-utils';
|
|
import { toTimelineAsset } from '$lib/utils/timeline-util';
|
|
import type { AssetResponseDto, StackResponseDto } from '@immich/sdk';
|
|
import { mdiPinOutline } from '@mdi/js';
|
|
import { t } from 'svelte-i18n';
|
|
import type { OnAction } from './action';
|
|
|
|
interface Props {
|
|
stack: StackResponseDto;
|
|
asset: AssetResponseDto;
|
|
onAction: OnAction;
|
|
}
|
|
|
|
let { stack, asset, onAction }: Props = $props();
|
|
|
|
const handleKeepThisDeleteOthers = async () => {
|
|
const isConfirmed = await modalManager.showDialog({
|
|
title: $t('keep_this_delete_others'),
|
|
prompt: $t('confirm_keep_this_delete_others'),
|
|
confirmText: $t('delete_others'),
|
|
});
|
|
|
|
if (!isConfirmed) {
|
|
return;
|
|
}
|
|
|
|
const keptAsset = await keepThisDeleteOthers(asset, stack);
|
|
if (keptAsset) {
|
|
onAction({ type: AssetAction.UNSTACK, assets: [toTimelineAsset(keptAsset)] });
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<MenuOption icon={mdiPinOutline} onClick={handleKeepThisDeleteOthers} text={$t('keep_this_delete_others')} />
|