mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
b9ca68f6e4
chore: rename components to PascalCase
27 lines
938 B
Svelte
27 lines
938 B
Svelte
<script lang="ts">
|
|
import MenuOption from '$lib/components/shared-components/context-menu/MenuOption.svelte';
|
|
|
|
import { AssetAction } from '$lib/constants';
|
|
import { updateStack, type AssetResponseDto, type StackResponseDto } from '@immich/sdk';
|
|
import { mdiImageCheckOutline } 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 handleSetPrimaryAsset = async () => {
|
|
const updatedStack = await updateStack({ id: stack.id, stackUpdateDto: { primaryAssetId: asset.id } });
|
|
if (updatedStack) {
|
|
onAction({ type: AssetAction.SET_STACK_PRIMARY_ASSET, stack: updatedStack });
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<MenuOption icon={mdiImageCheckOutline} onClick={handleSetPrimaryAsset} text={$t('set_stack_primary_asset')} />
|