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') }} {{ $t('settings.user_popover_avatar_zoom') }}
</BooleanSetting> </BooleanSetting>
</li> </li>
<li>
<BooleanSetting path="userPopoverOverlay">
{{ $t('settings.user_popover_avatar_overlay') }}
</BooleanSetting>
</li>
<li> <li>
<ChoiceSetting <ChoiceSetting
v-if="user" v-if="user"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -551,6 +551,7 @@
"mention_link_fade_domain": "Fade domains (e.g. {'@'}example.org in {'@'}foo{'@'}example.org)", "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", "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_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", "fun": "Fun",
"greentext": "Meme arrows", "greentext": "Meme arrows",
"show_yous": "Show (You)s", "show_yous": "Show (You)s",

View File

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