diff --git a/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte b/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte index fe5d14d809..227fb13942 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte @@ -9,7 +9,6 @@ import { mdiAlertOutline, mdiArrowLeft, - mdiCloudDownloadOutline, mdiContentCopy, mdiDeleteOutline, mdiDotsVertical, @@ -20,6 +19,7 @@ mdiMagnifyPlusOutline, mdiMotionPauseOutline, mdiPlaySpeed, + mdiShareVariantOutline, } from '@mdi/js'; import { createEventDispatcher } from 'svelte'; import ContextMenu from '../shared-components/context-menu/context-menu.svelte'; @@ -32,12 +32,20 @@ export let isMotionPhotoPlaying = false; export let showDownloadButton: boolean; export let showDetailButton: boolean; + export let showShareButton: boolean; export let showSlideshow = false; export let hasStackChildren = false; $: isOwner = asset.ownerId === $user?.id; - type MenuItemEvent = 'addToAlbum' | 'addToSharedAlbum' | 'asProfileImage' | 'runJob' | 'playSlideShow' | 'unstack'; + type MenuItemEvent = + | 'addToAlbum' + | 'addToSharedAlbum' + | 'asProfileImage' + | 'download' + | 'playSlideShow' + | 'runJob' + | 'unstack'; const dispatch = createEventDispatcher<{ back: void; @@ -54,6 +62,7 @@ runJob: AssetJobName; playSlideShow: void; unstack: void; + showShareModal: void; }>(); let contextMenuPosition = { x: 0, y: 0 }; @@ -82,6 +91,14 @@ dispatch('back')} />
+ {#if showShareButton} + dispatch('showShareModal')} + title="Share" + /> + {/if} {#if asset.isOffline} {/if} - - {#if showDownloadButton} - dispatch('download')} - title="Download" - /> - {/if} {#if showDetailButton} onMenuClick('playSlideShow')} text="Slideshow" /> {/if} + {#if showDownloadButton} + onMenuClick('download')} text="Download" /> + {/if} onMenuClick('addToAlbum')} text="Add to Album" /> onMenuClick('addToSharedAlbum')} text="Add to Shared Album" /> diff --git a/web/src/lib/components/asset-viewer/asset-viewer.svelte b/web/src/lib/components/asset-viewer/asset-viewer.svelte index b8d25d8b66..5f32c000c2 100644 --- a/web/src/lib/components/asset-viewer/asset-viewer.svelte +++ b/web/src/lib/components/asset-viewer/asset-viewer.svelte @@ -51,6 +51,7 @@ import PhotoViewer from './photo-viewer.svelte'; import SlideshowBar from './slideshow-bar.svelte'; import VideoViewer from './video-viewer.svelte'; + import CreateSharedLinkModal from '$lib/components/shared-components/create-share-link-modal/create-shared-link-modal.svelte'; export let assetStore: AssetStore | null = null; export let asset: AssetResponseDto; @@ -81,11 +82,13 @@ let appearsInAlbums: AlbumResponseDto[] = []; let isShowAlbumPicker = false; let isShowDeleteConfirmation = false; + let isShowShareModal = false; let addToSharedAlbum = true; let shouldPlayMotionPhoto = false; let isShowProfileImageCrop = false; let shouldShowDownloadButton = sharedLink ? sharedLink.allowDownload : !asset.isOffline; let shouldShowDetailButton = asset.hasMetadata; + let shouldShowShareModal = !asset.isTrashed; let canCopyImagesToClipboard: boolean; let slideshowStateUnsubscribe: () => void; let shuffleSlideshowUnsubscribe: () => void; @@ -292,6 +295,10 @@ isShowDeleteConfirmation = false; return; } + if (isShowShareModal) { + isShowShareModal = false; + return; + } closeViewer(); return; } @@ -563,6 +570,7 @@ showDetailButton={shouldShowDetailButton} showSlideshow={!!assetStore} hasStackChildren={$stackAssetsStore.length > 0} + showShareButton={shouldShowShareModal} on:back={closeViewer} on:showDetail={showDetailInfoHandler} on:download={() => downloadFile(asset)} @@ -577,6 +585,7 @@ on:runJob={({ detail: job }) => handleRunJob(job)} on:playSlideShow={() => ($slideshowState = SlideshowState.PlaySlideshow)} on:unstack={handleUnstack} + on:showShareModal={() => (isShowShareModal = true)} />
{/if} @@ -767,6 +776,10 @@ {#if isShowProfileImageCrop} (isShowProfileImageCrop = false)} /> {/if} + + {#if isShowShareModal} + (isShowShareModal = false)} /> + {/if}