1
0
mirror of https://github.com/immich-app/immich.git synced 2024-12-25 10:43:13 +02:00

fix(web): asset viewer navbar overlapping with details tab and context menu not closing on button press (except in album viewer) (#2323)

* fix overlapping of asset-viewer-nav-bar
with details tab

* fix contextmenu not closing on button press

---------

Co-authored-by: faupau03 <paul.paffe@gmx.net>
This commit is contained in:
faupau 2023-04-26 04:30:19 +02:00 committed by GitHub
parent b8313abfa8
commit 6631b286c1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 45 deletions

View File

@ -43,6 +43,7 @@
import GalleryViewer from '../shared-components/gallery-viewer/gallery-viewer.svelte'; import GalleryViewer from '../shared-components/gallery-viewer/gallery-viewer.svelte';
import ImmichLogo from '../shared-components/immich-logo.svelte'; import ImmichLogo from '../shared-components/immich-logo.svelte';
import Button from '../elements/buttons/button.svelte'; import Button from '../elements/buttons/button.svelte';
import { clickOutside } from '$lib/utils/click-outside';
export let album: AlbumResponseDto; export let album: AlbumResponseDto;
export let sharedLink: SharedLinkResponseDto | undefined = undefined; export let sharedLink: SharedLinkResponseDto | undefined = undefined;
@ -457,11 +458,26 @@
{/if} {/if}
{#if !isPublicShared} {#if !isPublicShared}
<CircleIconButton <div use:clickOutside on:outclick={() => (isShowAlbumOptions = false)}>
title="Album options" <CircleIconButton
on:click={showAlbumOptionsMenu} title="Album options"
logo={DotsVertical} on:click={showAlbumOptionsMenu}
/> logo={DotsVertical}
>{#if isShowAlbumOptions}
<ContextMenu {...contextMenuPosition}>
{#if isOwned}
<MenuOption
on:click={() => {
isShowThumbnailSelection = true;
isShowAlbumOptions = false;
}}
text="Set album cover"
/>
{/if}
</ContextMenu>
{/if}
</CircleIconButton>
</div>
{/if} {/if}
{#if isPublicShared} {#if isPublicShared}
@ -590,20 +606,6 @@
/> />
{/if} {/if}
{#if isShowAlbumOptions}
<ContextMenu {...contextMenuPosition} on:clickoutside={() => (isShowAlbumOptions = false)}>
{#if isOwned}
<MenuOption
on:click={() => {
isShowThumbnailSelection = true;
isShowAlbumOptions = false;
}}
text="Set album cover"
/>
{/if}
</ContextMenu>
{/if}
{#if isShowThumbnailSelection} {#if isShowThumbnailSelection}
<ThumbnailSelection <ThumbnailSelection
{album} {album}

View File

@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher, onMount } from 'svelte'; import { createEventDispatcher, onMount } from 'svelte';
import { AlbumResponseDto, api, UserResponseDto } from '@api'; import { AlbumResponseDto, api, UserResponseDto } from '@api';
import { clickOutside } from '$lib/utils/click-outside';
import BaseModal from '../shared-components/base-modal.svelte'; import BaseModal from '../shared-components/base-modal.svelte';
import CircleAvatar from '../shared-components/circle-avatar.svelte'; import CircleAvatar from '../shared-components/circle-avatar.svelte';
import DotsVertical from 'svelte-material-icons/DotsVertical.svelte'; import DotsVertical from 'svelte-material-icons/DotsVertical.svelte';
@ -84,13 +85,21 @@
<div id={`icon-${user.id}`} class="flex place-items-center"> <div id={`icon-${user.id}`} class="flex place-items-center">
{#if isOwned} {#if isOwned}
<CircleIconButton <div use:clickOutside on:outclick={() => (isShowMenu = false)}>
on:click={() => showContextMenu(user.id)} <CircleIconButton
logo={DotsVertical} on:click={() => showContextMenu(user.id)}
backgroundColor={'transparent'} logo={DotsVertical}
hoverColor={'#e2e7e9'} backgroundColor={'transparent'}
size={'20'} hoverColor={'#e2e7e9'}
/> size={'20'}
>
{#if isShowMenu}
<ContextMenu {...position}>
<MenuOption on:click={() => removeUser(targetUserId)} text="Remove" />
</ContextMenu>
{/if}
</CircleIconButton>
</div>
{:else if user.id == currentUser?.id} {:else if user.id == currentUser?.id}
<button <button
on:click={() => removeUser('me')} on:click={() => removeUser('me')}
@ -102,10 +111,4 @@
</div> </div>
{/each} {/each}
</section> </section>
{#if isShowMenu}
<ContextMenu {...position} on:clickoutside={() => (isShowMenu = false)}>
<MenuOption on:click={() => removeUser(targetUserId)} text="Remove" />
</ContextMenu>
{/if}
</BaseModal> </BaseModal>

View File

@ -1,6 +1,7 @@
<script lang="ts"> <script lang="ts">
import { createEventDispatcher } from 'svelte'; import { createEventDispatcher } from 'svelte';
import { clickOutside } from '$lib/utils/click-outside';
import ArrowLeft from 'svelte-material-icons/ArrowLeft.svelte'; import ArrowLeft from 'svelte-material-icons/ArrowLeft.svelte';
import CloudDownloadOutline from 'svelte-material-icons/CloudDownloadOutline.svelte'; import CloudDownloadOutline from 'svelte-material-icons/CloudDownloadOutline.svelte';
import InformationOutline from 'svelte-material-icons/InformationOutline.svelte'; import InformationOutline from 'svelte-material-icons/InformationOutline.svelte';
@ -45,12 +46,12 @@
</script> </script>
<div <div
class="h-16 flex justify-between place-items-center px-3 transition-transform duration-200 z-[9999]" class="h-16 flex justify-between place-items-center px-3 transition-transform duration-200 z-[1001]"
> >
<div> <div>
<CircleIconButton logo={ArrowLeft} on:click={() => dispatch('goBack')} /> <CircleIconButton logo={ArrowLeft} on:click={() => dispatch('goBack')} />
</div> </div>
<div class="text-white flex gap-2"> <div class="text-white flex gap-2 justify-end w-[calc(100%-3rem)] overflow-hidden">
{#if isOwner} {#if isOwner}
<CircleIconButton <CircleIconButton
logo={asset.isArchived ? ArchiveArrowUpOutline : ArchiveArrowDownOutline} logo={asset.isArchived ? ArchiveArrowUpOutline : ArchiveArrowDownOutline}
@ -107,16 +108,21 @@
{#if isOwner} {#if isOwner}
<CircleIconButton logo={DeleteOutline} on:click={() => dispatch('delete')} title="Delete" /> <CircleIconButton logo={DeleteOutline} on:click={() => dispatch('delete')} title="Delete" />
<CircleIconButton logo={DotsVertical} on:click={showOptionsMenu} title="More" /> <div use:clickOutside on:outclick={() => (isShowAssetOptions = false)}>
<CircleIconButton logo={DotsVertical} on:click={showOptionsMenu} title="More">
{#if isShowAssetOptions}
<ContextMenu {...contextMenuPosition}>
<div class="flex flex-col rounded-lg ">
<MenuOption on:click={() => onMenuClick('addToAlbum')} text="Add to Album" />
<MenuOption
on:click={() => onMenuClick('addToSharedAlbum')}
text="Add to Shared Album"
/>
</div>
</ContextMenu>
{/if}
</CircleIconButton>
</div>
{/if} {/if}
</div> </div>
</div> </div>
{#if isShowAssetOptions}
<ContextMenu {...contextMenuPosition} on:clickoutside={() => (isShowAssetOptions = false)}>
<div class="flex flex-col rounded-lg ">
<MenuOption on:click={() => onMenuClick('addToAlbum')} text="Add to Album" />
<MenuOption on:click={() => onMenuClick('addToSharedAlbum')} text="Add to Shared Album" />
</div>
</ContextMenu>
{/if}

View File

@ -391,7 +391,7 @@
<div <div
transition:fly={{ duration: 150 }} transition:fly={{ duration: 150 }}
id="detail-panel" id="detail-panel"
class="bg-immich-bg w-[360px] row-span-full transition-all overflow-y-auto dark:bg-immich-dark-bg dark:border-l dark:border-l-immich-dark-gray" class="bg-immich-bg w-[360px] z-[1002] row-span-full transition-all overflow-y-auto dark:bg-immich-dark-bg dark:border-l dark:border-l-immich-dark-gray"
translate="yes" translate="yes"
> >
<DetailPanel <DetailPanel

View File

@ -16,6 +16,7 @@
on:click on:click
> >
<svelte:component this={logo} {size} /> <svelte:component this={logo} {size} />
<slot />
</button> </button>
<style> <style>