|
1 | 1 | import { notificationController, NotificationType } from '$lib/components/shared-components/notification/notification';
|
2 |
| -import { TimelineManager } from '$lib/managers/timeline-manager/timeline-manager.svelte'; |
3 | 2 | import type { TimelineAsset } from '$lib/managers/timeline-manager/types';
|
4 | 3 | import type { StackResponse } from '$lib/utils/asset-utils';
|
5 |
| -import { toTimelineAsset } from '$lib/utils/timeline-util'; |
6 |
| -import { AssetVisibility, deleteAssets as deleteBulk, restoreAssets, type StackResponseDto } from '@immich/sdk'; |
| 4 | +import { AssetVisibility, deleteAssets as deleteBulk, restoreAssets } from '@immich/sdk'; |
7 | 5 | import { t } from 'svelte-i18n';
|
8 | 6 | import { get } from 'svelte/store';
|
9 | 7 | import { handleError } from './handle-error';
|
@@ -58,69 +56,3 @@ const undoDeleteAssets = async (onUndoDelete: OnUndoDelete, assets: TimelineAsse
|
58 | 56 | handleError(error, $t('errors.unable_to_restore_assets'));
|
59 | 57 | }
|
60 | 58 | };
|
61 |
| - |
62 |
| -/** |
63 |
| - * Update the asset stack state in the asset store based on the provided stack response. |
64 |
| - * This function updates the stack information so that the icon is shown for the primary asset |
65 |
| - * and removes any assets from the timeline that are marked for deletion. |
66 |
| - * |
67 |
| - * @param {TimelineManager} timelineManager - The timeline manager to update. |
68 |
| - * @param {StackResponse} stackResponse - The stack response containing the stack and assets to delete. |
69 |
| - */ |
70 |
| -export function updateStackedAssetInTimeline(timelineManager: TimelineManager, { stack, toDeleteIds }: StackResponse) { |
71 |
| - if (stack != undefined) { |
72 |
| - timelineManager.updateAssetOperation([stack.primaryAssetId], (asset) => { |
73 |
| - asset.stack = { |
74 |
| - id: stack.id, |
75 |
| - primaryAssetId: stack.primaryAssetId, |
76 |
| - assetCount: stack.assets.length, |
77 |
| - }; |
78 |
| - return { remove: false }; |
79 |
| - }); |
80 |
| - |
81 |
| - timelineManager.removeAssets(toDeleteIds); |
82 |
| - } |
83 |
| -} |
84 |
| - |
85 |
| -/** |
86 |
| - * Update the timeline manager to reflect the unstacked state of assets. |
87 |
| - * This function updates the stack property of each asset to undefined, effectively unstacking them. |
88 |
| - * It also adds the unstacked assets back to the timeline manager. |
89 |
| - * |
90 |
| - * @param timelineManager - The timeline manager to update. |
91 |
| - * @param assets - The array of asset response DTOs to update in the timeline manager. |
92 |
| - */ |
93 |
| -export function updateUnstackedAssetInTimeline(timelineManager: TimelineManager, assets: TimelineAsset[]) { |
94 |
| - timelineManager.updateAssetOperation( |
95 |
| - assets.map((asset) => asset.id), |
96 |
| - (asset) => { |
97 |
| - asset.stack = null; |
98 |
| - return { remove: false }; |
99 |
| - }, |
100 |
| - ); |
101 |
| - |
102 |
| - timelineManager.addAssets(assets); |
103 |
| -} |
104 |
| - |
105 |
| -export function refreshStackedAssetInTimeline( |
106 |
| - timelineManager: TimelineManager, |
107 |
| - stack: StackResponseDto, |
108 |
| - addPrimaryAsset: boolean = false, |
109 |
| -) { |
110 |
| - if (stack != undefined) { |
111 |
| - if (addPrimaryAsset) { |
112 |
| - timelineManager.addAssets( |
113 |
| - stack.assets.filter((a) => a.id === stack.primaryAssetId).map((a) => toTimelineAsset(a)), |
114 |
| - ); |
115 |
| - } |
116 |
| - timelineManager.updateAssetOperation([stack.primaryAssetId], (asset) => { |
117 |
| - asset.stack = { |
118 |
| - id: stack.id, |
119 |
| - primaryAssetId: stack.primaryAssetId, |
120 |
| - assetCount: stack.assets.length, |
121 |
| - }; |
122 |
| - return { remove: false }; |
123 |
| - }); |
124 |
| - timelineManager.removeAssets(stack.assets.filter((a) => a.id !== stack.primaryAssetId).map(({ id }) => id)); |
125 |
| - } |
126 |
| -} |
0 commit comments