0bbe70e6a3
* 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>
40 lines
1.3 KiB
Svelte
40 lines
1.3 KiB
Svelte
<script lang="ts">
|
|
import MenuOption from '$lib/components/shared-components/context-menu/menu-option.svelte';
|
|
import {
|
|
notificationController,
|
|
NotificationType,
|
|
} from '$lib/components/shared-components/notification/notification';
|
|
import { AssetAction } from '$lib/constants';
|
|
import { handleError } from '$lib/utils/handle-error';
|
|
import { toTimelineAsset } from '$lib/utils/timeline-util';
|
|
import { restoreAssets, type AssetResponseDto } from '@immich/sdk';
|
|
import { mdiHistory } from '@mdi/js';
|
|
import { t } from 'svelte-i18n';
|
|
import type { OnAction } from './action';
|
|
|
|
interface Props {
|
|
asset: AssetResponseDto;
|
|
onAction: OnAction;
|
|
}
|
|
|
|
let { asset = $bindable(), onAction }: Props = $props();
|
|
|
|
const handleRestoreAsset = async () => {
|
|
try {
|
|
await restoreAssets({ bulkIdsDto: { ids: [asset.id] } });
|
|
asset.isTrashed = false;
|
|
|
|
onAction({ type: AssetAction.RESTORE, asset: toTimelineAsset(asset) });
|
|
|
|
notificationController.show({
|
|
type: NotificationType.Info,
|
|
message: $t('restored_asset'),
|
|
});
|
|
} catch (error) {
|
|
handleError(error, $t('errors.unable_to_restore_assets'));
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<MenuOption icon={mdiHistory} onClick={handleRestoreAsset} text={$t('restore')} />
|