fix avatar not closing, add option to put popovers next to avatar

instead of over it
This commit is contained in:
Henry Jameson 2022-07-19 19:33:48 +03:00
parent 54ab1ed741
commit 2c3c2bb5b0
9 changed files with 33 additions and 15 deletions

View File

@ -79,6 +79,11 @@
{{ $t('settings.user_popover_avatar_zoom') }}
</BooleanSetting>
</li>
<li>
<BooleanSetting path="userPopoverOverlay">
{{ $t('settings.user_popover_avatar_overlay') }}
</BooleanSetting>
</li>
<li>
<ChoiceSetting
v-if="user"

View File

@ -37,9 +37,8 @@ export default {
'hideBio',
'rounded',
'bordered',
'allowZoomingAvatar',
'onClose',
'onAvatarClick'
'avatarAction', // default - open profile, 'zoom' - zoom, function - call function
'onClose'
],
data () {
return {

View File

@ -133,23 +133,27 @@
min-width: 0;
}
> a {
vertical-align: middle;
display: flex;
}
.Avatar {
--_avatarShadowBox: var(--avatarShadow);
--_avatarShadowFilter: var(--avatarShadowFilter);
--_avatarShadowInset: var(--avatarShadowInset);
flex: 1 0 100%;
width: 56px;
height: 56px;
object-fit: cover;
}
}
&-avatar-link {
&-avatar {
position: relative;
cursor: pointer;
&-overlay {
&.-overlay {
position: absolute;
left: 0;
top: 0;
@ -169,7 +173,7 @@
}
}
&:hover &-overlay {
&:hover &.-overlay {
opacity: 1;
}
}

View File

@ -12,25 +12,31 @@
<div class="user-info">
<div class="container">
<a
v-if="allowZoomingAvatar"
class="user-info-avatar-link"
v-if="avatarAction === 'zoom'"
class="user-info-avatar -link"
@click="zoomAvatar"
>
<UserAvatar
:better-shadow="betterShadow"
:user="user"
/>
<div class="user-info-avatar-link-overlay">
<div class="user-info-avatar -link -overlay">
<FAIcon
class="fa-scale-110 fa-old-padding"
icon="search-plus"
/>
</div>
</a>
<UserAvatar
v-else-if="typeof avatarAction === 'function'"
@click="avatarAction"
class="user-info-avatar"
:better-shadow="betterShadow"
:user="user"
/>
<router-link
v-else
:to="userProfileLink(user)"
@click="onAvatarClickHandler"
>
<UserAvatar
:better-shadow="betterShadow"

View File

@ -13,6 +13,9 @@ const UserPopover = {
computed: {
userPopoverZoom () {
return this.$store.getters.mergedConfig.userPopoverZoom
},
userPopoverOverlay () {
return this.$store.getters.mergedConfig.userPopoverOverlay
}
}
}

View File

@ -3,7 +3,7 @@
trigger="click"
popover-class="popover-default user-popover"
:overlay-centers-selector="overlayCentersSelector || '.user-info .Avatar'"
:overlay-centers="overlayCenters"
:overlay-centers="overlayCenters && userPopoverOverlay"
:disabled="disabled"
>
<template v-slot:trigger>
@ -14,8 +14,7 @@
class="user-popover"
:user-id="userId"
:hide-bio="true"
:allow-zooming-avatar="userPopoverZoom"
:on-avatar-click="userPopoverZoom ? null : close"
:avatar-action="userPopoverZoom ? 'zoom' : close"
:on-close="close"
/>
</template>

View File

@ -8,7 +8,7 @@
:user-id="userId"
:switcher="true"
:selected="timeline.viewing"
:allow-zooming-avatar="true"
:avatar-action="zoom"
rounded="top"
/>
<div

View File

@ -551,6 +551,7 @@
"mention_link_fade_domain": "Fade domains (e.g. {'@'}example.org in {'@'}foo{'@'}example.org)",
"mention_link_bolden_you": "Highlight mention of you when you are mentioned",
"user_popover_avatar_zoom": "Clicking on user avatar in popover zooms it instead of closing the popover",
"user_popover_avatar_overlay": "Show user popover over user avatar",
"fun": "Fun",
"greentext": "Meme arrows",
"show_yous": "Show (You)s",

View File

@ -82,6 +82,7 @@ export const defaultState = {
disableStickyHeaders: false,
showScrollbars: false,
userPopoverZoom: false,
userPopoverOverlay: true,
greentext: undefined, // instance default
useAtIcon: undefined, // instance default
mentionLinkDisplay: undefined, // instance default