diff --git a/web/src/lib/components/asset-viewer/detail-panel.svelte b/web/src/lib/components/asset-viewer/detail-panel.svelte index f79a0ecbdc..c4b601c59e 100644 --- a/web/src/lib/components/asset-viewer/detail-panel.svelte +++ b/web/src/lib/components/asset-viewer/detail-panel.svelte @@ -55,7 +55,6 @@ let { asset, currentAlbum = null }: Props = $props(); - let showAssetPath = $state(false); let showEditFaces = $state(false); let isOwner = $derived($user?.id === asset.ownerId); let people = $derived(asset.people || []); @@ -129,8 +128,6 @@ return Route.folders({ path: getParentPath(asset.originalPath) }); }; - const toggleAssetPath = () => (showAssetPath = !showAssetPath); - const handleChangeDate = async () => { if (!isOwner) { return; @@ -369,11 +366,11 @@ shape="round" color="secondary" variant="ghost" - onclick={toggleAssetPath} + onclick={() => assetViewerManager.toggleAssetPath()} /> {/if}

- {#if showAssetPath} + {#if assetViewerManager.isShowAssetPath}

diff --git a/web/src/lib/managers/asset-viewer-manager.svelte.ts b/web/src/lib/managers/asset-viewer-manager.svelte.ts index 157ed31243..aaacc2c340 100644 --- a/web/src/lib/managers/asset-viewer-manager.svelte.ts +++ b/web/src/lib/managers/asset-viewer-manager.svelte.ts @@ -9,6 +9,7 @@ import type { ZoomImageWheelState } from '@zoom-image/core'; import { cubicOut } from 'svelte/easing'; const isShowDetailPanel = new PersistedLocalStorage('asset-viewer-state', false); +const isShowAssetPath = new PersistedLocalStorage('asset-viewer-show-path', false); const createDefaultZoomState = (): ZoomImageWheelState => ({ currentRotation: 0, @@ -63,6 +64,10 @@ class AssetViewerManager extends BaseEventManager { return isShowDetailPanel.current; } + get isShowAssetPath() { + return isShowAssetPath.current; + } + get isFaceEditMode() { return this.#isFaceEditMode; } @@ -101,6 +106,10 @@ class AssetViewerManager extends BaseEventManager { isShowDetailPanel.current = value; } + private set isShowAssetPath(value: boolean) { + isShowAssetPath.current = value; + } + onZoomChange(state: ZoomImageWheelState) { // bypass event emitter to avoid loop this.#zoomState = state; @@ -147,6 +156,10 @@ class AssetViewerManager extends BaseEventManager { this.isShowActivityPanel = false; } + toggleAssetPath() { + this.isShowAssetPath = !this.isShowAssetPath; + } + toggleDetailPanel() { this.closeActivityPanel(); this.isShowDetailPanel = !this.isShowDetailPanel;