refactor: asset manager
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
import { AssetAction } from '$lib/constants';
|
||||
|
||||
import SetVisibilityAction from '$lib/components/photos-page/actions/set-visibility-action.svelte';
|
||||
import { AssetManager } from '$lib/managers/asset-manager.svelte';
|
||||
import { TimelineManager } from '$lib/managers/timeline-manager/timeline-manager.svelte';
|
||||
import { AssetInteraction } from '$lib/stores/asset-interaction.svelte';
|
||||
import { AssetVisibility } from '@immich/sdk';
|
||||
@@ -33,6 +34,15 @@
|
||||
|
||||
const assetInteraction = new AssetInteraction();
|
||||
|
||||
const assetManager = new AssetManager();
|
||||
$effect(() => {
|
||||
if (data.assetId) {
|
||||
assetManager.showAssetViewer = true;
|
||||
void assetManager.updateOptions({ assetId: data.assetId });
|
||||
}
|
||||
});
|
||||
onDestroy(() => assetManager.destroy());
|
||||
|
||||
const handleEscape = () => {
|
||||
if (assetInteraction.selectionActive) {
|
||||
assetInteraction.clearMultiselect();
|
||||
@@ -51,6 +61,7 @@
|
||||
enableRouting={true}
|
||||
{timelineManager}
|
||||
{assetInteraction}
|
||||
{assetManager}
|
||||
removeAction={AssetAction.UNARCHIVE}
|
||||
onEscape={handleEscape}
|
||||
>
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
import { authenticate } from '$lib/utils/auth';
|
||||
import { getFormatter } from '$lib/utils/i18n';
|
||||
import { getAssetInfoFromParam } from '$lib/utils/navigation';
|
||||
import type { PageLoad } from './$types';
|
||||
|
||||
export const load = (async ({ params, url }) => {
|
||||
await authenticate(url);
|
||||
const asset = await getAssetInfoFromParam(params);
|
||||
const $t = await getFormatter();
|
||||
|
||||
return {
|
||||
asset,
|
||||
assetId: params.assetId,
|
||||
meta: {
|
||||
title: $t('archive'),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user