-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): Implement keep this delete others for asset stacks (#14217)
- Loading branch information
1 parent
bcd17c2
commit 1737013
Showing
7 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
web/src/lib/components/asset-viewer/actions/keep-this-delete-others.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<script lang="ts"> | ||
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte'; | ||
import { AssetAction } from '$lib/constants'; | ||
import { keepThisDeleteOthers } from '$lib/utils/asset-utils'; | ||
import type { AssetResponseDto, StackResponseDto } from '@immich/sdk'; | ||
import { mdiPinOutline } from '@mdi/js'; | ||
import type { OnAction } from './action'; | ||
import { t } from 'svelte-i18n'; | ||
import { dialogController } from '$lib/components/shared-components/dialog/dialog'; | ||
export let stack: StackResponseDto; | ||
export let asset: AssetResponseDto; | ||
export let onAction: OnAction; | ||
const handleKeepThisDeleteOthers = async () => { | ||
const isConfirmed = await dialogController.show({ | ||
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: [keptAsset] }); | ||
} | ||
}; | ||
</script> | ||
|
||
<MenuOption icon={mdiPinOutline} onClick={handleKeepThisDeleteOthers} text={$t('keep_this_delete_others')} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -379,6 +379,7 @@ | |
break; | ||
} | ||
case AssetAction.KEEP_THIS_DELETE_OTHERS: | ||
case AssetAction.UNSTACK: { | ||
closeViewer(); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters