From d84cda7009d486a047953b1ca2d27acf35b8ddc1 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 16 Jun 2022 16:30:05 +0300 Subject: [PATCH 1/2] unify user popovers into a separate component --- src/components/mention_link/mention_link.js | 3 +- src/components/mention_link/mention_link.vue | 115 ++++++++----------- src/components/notification/notification.js | 4 +- src/components/notification/notification.vue | 36 ++---- src/components/popover/popover.js | 2 +- src/components/status/status.js | 6 +- src/components/status/status.vue | 43 ++----- src/components/user_popover/user_popover.js | 14 +++ src/components/user_popover/user_popover.vue | 34 ++++++ 9 files changed, 127 insertions(+), 130 deletions(-) create mode 100644 src/components/user_popover/user_popover.js create mode 100644 src/components/user_popover/user_popover.vue diff --git a/src/components/mention_link/mention_link.js b/src/components/mention_link/mention_link.js index 4b088f88..7e47625a 100644 --- a/src/components/mention_link/mention_link.js +++ b/src/components/mention_link/mention_link.js @@ -16,8 +16,7 @@ const MentionLink = { name: 'MentionLink', components: { UserAvatar, - Popover: defineAsyncComponent(() => import('../popover/popover.vue')), - UserCard: defineAsyncComponent(() => import('../user_card/user_card.vue')) + UserPopover: defineAsyncComponent(() => import('../user_popover/user_popover.vue')) }, props: { url: { diff --git a/src/components/mention_link/mention_link.vue b/src/components/mention_link/mention_link.vue index 686ad27f..0cff50ab 100644 --- a/src/components/mention_link/mention_link.vue +++ b/src/components/mention_link/mention_link.vue @@ -10,84 +10,71 @@ target="_blank" v-html="content" /> - - - - + + + diff --git a/src/components/notification/notification.js b/src/components/notification/notification.js index 9408b217..77cdfa73 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -5,7 +5,7 @@ import UserAvatar from '../user_avatar/user_avatar.vue' import UserCard from '../user_card/user_card.vue' import Timeago from '../timeago/timeago.vue' import RichContent from 'src/components/rich_content/rich_content.jsx' -import Popover from '../popover/popover.vue' +import UserPopover from '../user_popover/user_popover.vue' import { isStatusNotification } from '../../services/notification_utils/notification_utils.js' import { highlightClass, highlightStyle } from '../../services/user_highlighter/user_highlighter.js' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' @@ -48,7 +48,7 @@ const Notification = { Timeago, Status, RichContent, - Popover + UserPopover }, methods: { toggleUserExpanded () { diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index a44481c9..6427d117 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -36,32 +36,18 @@ :href="$router.resolve(userProfileLink).href" @click.prevent > - - - - + +
diff --git a/src/components/popover/popover.js b/src/components/popover/popover.js index 7f4c1cac..f6527624 100644 --- a/src/components/popover/popover.js +++ b/src/components/popover/popover.js @@ -80,7 +80,7 @@ const Popover = { y: anchorScreenBox.top + anchorHeight * 0.5 } const content = this.$refs.content - const overlayCenter = this.overlayCentersSelector + const overlayCenter = this.overlayCenters ? this.$refs.content.querySelector(this.overlayCentersSelector) : null diff --git a/src/components/status/status.js b/src/components/status/status.js index 06496258..053c9441 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -4,14 +4,13 @@ import ReactButton from '../react_button/react_button.vue' import RetweetButton from '../retweet_button/retweet_button.vue' import ExtraButtons from '../extra_buttons/extra_buttons.vue' import PostStatusForm from '../post_status_form/post_status_form.vue' -import UserCard from '../user_card/user_card.vue' import UserAvatar from '../user_avatar/user_avatar.vue' import AvatarList from '../avatar_list/avatar_list.vue' import Timeago from '../timeago/timeago.vue' import StatusContent from '../status_content/status_content.vue' import RichContent from 'src/components/rich_content/rich_content.jsx' import StatusPopover from '../status_popover/status_popover.vue' -import Popover from '../popover/popover.vue' +import UserPopover from '../user_popover/user_popover.vue' import UserListPopover from '../user_list_popover/user_list_popover.vue' import EmojiReactions from '../emoji_reactions/emoji_reactions.vue' import MentionsLine from 'src/components/mentions_line/mentions_line.vue' @@ -106,7 +105,6 @@ const Status = { RetweetButton, ExtraButtons, PostStatusForm, - UserCard, UserAvatar, AvatarList, Timeago, @@ -117,7 +115,7 @@ const Status = { RichContent, MentionLink, MentionsLine, - Popover + UserPopover }, props: [ 'statusoid', diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 624960fe..771d336a 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -123,42 +123,21 @@ class="left-side" > - - - - + +
-
import('../user_card/user_card.vue')), + Popover: defineAsyncComponent(() => import('../popover/popover.vue')) + } +} + +export default UserPopover diff --git a/src/components/user_popover/user_popover.vue b/src/components/user_popover/user_popover.vue new file mode 100644 index 00000000..7ad5c234 --- /dev/null +++ b/src/components/user_popover/user_popover.vue @@ -0,0 +1,34 @@ + + + + + From 60571685c2e42e44b75157c3d52f162bf39c4bab Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 16 Jun 2022 17:06:16 +0300 Subject: [PATCH 2/2] popover controls for user-card --- src/components/user_card/user_card.js | 24 +++++++++--- src/components/user_card/user_card.scss | 39 +++++++++++++++----- src/components/user_card/user_card.vue | 37 ++++++++++++++++--- src/components/user_popover/user_popover.vue | 5 +-- 4 files changed, 81 insertions(+), 24 deletions(-) diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index 4168c54a..52e8c079 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -14,7 +14,9 @@ import { faRss, faSearchPlus, faExternalLinkAlt, - faEdit + faEdit, + faTimes, + faExpandAlt } from '@fortawesome/free-solid-svg-icons' library.add( @@ -22,12 +24,21 @@ library.add( faBell, faSearchPlus, faExternalLinkAlt, - faEdit + faEdit, + faTimes, + faExpandAlt ) export default { props: [ - 'userId', 'switcher', 'selected', 'hideBio', 'rounded', 'bordered', 'allowZoomingAvatar' + 'userId', + 'switcher', + 'selected', + 'hideBio', + 'rounded', + 'bordered', + 'allowZoomingAvatar', + 'onClose' ], data () { return { @@ -47,9 +58,10 @@ export default { }, classes () { return [{ - 'user-card-rounded-t': this.rounded === 'top', // set border-top-left-radius and border-top-right-radius - 'user-card-rounded': this.rounded === true, // set border-radius for all sides - 'user-card-bordered': this.bordered === true // set border for all sides + '-rounded-t': this.rounded === 'top', // set border-top-left-radius and border-top-right-radius + '-rounded': this.rounded === true, // set border-radius for all sides + '-bordered': this.bordered === true, // set border for all sides + '-popover': !!this.onClose // set popover rounding }] }, style () { diff --git a/src/components/user_card/user_card.scss b/src/components/user_card/user_card.scss index 2e153120..65299e60 100644 --- a/src/components/user_card/user_card.scss +++ b/src/components/user_card/user_card.scss @@ -42,8 +42,10 @@ mask-composite: exclude; background-size: cover; mask-size: 100% 60%; - border-top-left-radius: calc(var(--panelRadius) - 1px); - border-top-right-radius: calc(var(--panelRadius) - 1px); + border-top-left-radius: calc(var(--__roundnessTop, --panelRadius) - 1px); + border-top-right-radius: calc(var(--__roundnessTop, --panelRadius) - 1px); + border-bottom-left-radius: calc(var(--__roundnessBottom, --panelRadius) - 1px); + border-bottom-right-radius: calc(var(--__roundnessBottom, --panelRadius) - 1px); background-color: var(--profileBg); z-index: -2; @@ -72,21 +74,33 @@ } } - // Modifiers - - &-rounded-t { + &.-rounded-t { border-top-left-radius: $fallback--panelRadius; border-top-left-radius: var(--panelRadius, $fallback--panelRadius); border-top-right-radius: $fallback--panelRadius; border-top-right-radius: var(--panelRadius, $fallback--panelRadius); + + --__roundnessTop: var(--panelRadius); + --__roundnessBottom: 0; } - &-rounded { + &.-rounded { border-radius: $fallback--panelRadius; border-radius: var(--panelRadius, $fallback--panelRadius); + + --__roundnessTop: var(--panelRadius); + --__roundnessBottom: var(--panelRadius); } - &-bordered { + &.-popover { + border-radius: $fallback--tooltipRadius; + border-radius: var(--tooltipRadius, $fallback--tooltipRadius); + + --__roundnessTop: var(--tooltipRadius); + --__roundnessBottom: var(--tooltipRadius); + } + + &.-bordered { border-width: 1px; border-style: solid; border-color: $fallback--border; @@ -99,6 +113,15 @@ color: var(--lightText, $fallback--lightText); padding: 0 26px; + a { + color: $fallback--lightText; + color: var(--lightText, $fallback--lightText); + + &:hover { + color: var(--icon); + } + } + .container { min-width: 0; padding: 16px 0 6px; @@ -206,8 +229,6 @@ flex: 0 1 auto; text-overflow: ellipsis; overflow: hidden; - color: $fallback--lightText; - color: var(--lightText, $fallback--lightText); } .dailyAvg { diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index 67837845..936d6798 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -8,7 +8,7 @@ :style="style" class="background-image" /> -