logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: 2c3c2bb5b032f534a7ff9bc7be4687373baa2f8d
parent 54ab1ed741984ef0a81019bde053f441f99eaab2
Author: Henry Jameson <me@hjkos.com>
Date:   Tue, 19 Jul 2022 19:33:48 +0300

fix avatar not closing, add option to put popovers next to avatar
instead of over it

Diffstat:

Msrc/components/settings_modal/tabs/general_tab.vue5+++++
Msrc/components/user_card/user_card.js5++---
Msrc/components/user_card/user_card.scss12++++++++----
Msrc/components/user_card/user_card.vue14++++++++++----
Msrc/components/user_popover/user_popover.js3+++
Msrc/components/user_popover/user_popover.vue5++---
Msrc/components/user_profile/user_profile.vue2+-
Msrc/i18n/en.json1+
Msrc/modules/config.js1+
9 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/src/components/settings_modal/tabs/general_tab.vue b/src/components/settings_modal/tabs/general_tab.vue @@ -80,6 +80,11 @@ </BooleanSetting> </li> <li> + <BooleanSetting path="userPopoverOverlay"> + {{ $t('settings.user_popover_avatar_overlay') }} + </BooleanSetting> + </li> + <li> <ChoiceSetting v-if="user" id="thirdColumnMode" diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js @@ -37,9 +37,8 @@ export default { 'hideBio', 'rounded', 'bordered', - 'allowZoomingAvatar', - 'onClose', - 'onAvatarClick' + 'avatarAction', // default - open profile, 'zoom' - zoom, function - call function + 'onClose' ], data () { return { diff --git a/src/components/user_card/user_card.scss b/src/components/user_card/user_card.scss @@ -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; } } diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue @@ -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" diff --git a/src/components/user_popover/user_popover.js b/src/components/user_popover/user_popover.js @@ -13,6 +13,9 @@ const UserPopover = { computed: { userPopoverZoom () { return this.$store.getters.mergedConfig.userPopoverZoom + }, + userPopoverOverlay () { + return this.$store.getters.mergedConfig.userPopoverOverlay } } } diff --git a/src/components/user_popover/user_popover.vue b/src/components/user_popover/user_popover.vue @@ -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> diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue @@ -8,7 +8,7 @@ :user-id="userId" :switcher="true" :selected="timeline.viewing" - :allow-zooming-avatar="true" + :avatar-action="zoom" rounded="top" /> <div diff --git a/src/i18n/en.json b/src/i18n/en.json @@ -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", diff --git a/src/modules/config.js b/src/modules/config.js @@ -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