From c4b1acd77579040c922c1a2cad984967f8867551 Mon Sep 17 00:00:00 2001 From: Shpuld Shpuldson Date: Thu, 16 Jul 2020 16:56:12 +0300 Subject: [PATCH] basic first version --- src/components/notification/notification.js | 3 - src/components/notification/notification.vue | 7 -- src/components/popover/popover.js | 16 ++++- src/components/status/status.js | 9 +-- src/components/status/status.vue | 62 +++++++++--------- src/components/user_avatar/user_avatar.js | 7 +- src/components/user_avatar/user_avatar.vue | 14 ++++ src/components/user_card/user_card.js | 8 ++- src/components/user_card/user_card.vue | 2 + src/components/user_popover/user_popover.js | 35 ++++++++++ src/components/user_popover/user_popover.vue | 68 ++++++++++++++++++++ 11 files changed, 177 insertions(+), 54 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/notification/notification.js b/src/components/notification/notification.js index bb906b50..eee9976a 100644 --- a/src/components/notification/notification.js +++ b/src/components/notification/notification.js @@ -25,9 +25,6 @@ const Notification = { Status }, methods: { - toggleUserExpanded () { - this.userExpanded = !this.userExpanded - }, generateUserProfileLink (user) { return generateProfileLink(user.id, user.screen_name, this.$store.state.instance.restrictedNicknames) }, diff --git a/src/components/notification/notification.vue b/src/components/notification/notification.vue index 044ac871..a276cfef 100644 --- a/src/components/notification/notification.vue +++ b/src/components/notification/notification.vue @@ -29,7 +29,6 @@
-
diff --git a/src/components/popover/popover.js b/src/components/popover/popover.js index a40a9195..dcac1958 100644 --- a/src/components/popover/popover.js +++ b/src/components/popover/popover.js @@ -19,11 +19,14 @@ const Popover = { // anchor point on either axis offset: Object, // Additional styles you may want for the popover container - popoverClass: String + popoverClass: String, + // Time in milliseconds until the popup appears, default is 100ms + delay: Number }, data () { return { hidden: true, + hovered: false, styles: { opacity: 0 }, oldSize: { width: 0, height: 0 } } @@ -110,6 +113,7 @@ const Popover = { } }, showPopover () { + if (this.trigger === 'hover' && !this.hovered) return if (this.hidden) this.$emit('show') this.hidden = false this.$nextTick(this.updateStyles) @@ -120,10 +124,16 @@ const Popover = { this.styles = { opacity: 0 } }, onMouseenter (e) { - if (this.trigger === 'hover') this.showPopover() + if (this.trigger === 'hover') { + this.hovered = true + setTimeout(this.showPopover, this.delay || 100) + } }, onMouseleave (e) { - if (this.trigger === 'hover') this.hidePopover() + if (this.trigger === 'hover') { + this.hovered = false + this.hidePopover() + } }, onClick (e) { if (this.trigger === 'click') { diff --git a/src/components/status/status.js b/src/components/status/status.js index ad0b72a9..22a4dd50 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -9,6 +9,7 @@ import AvatarList from '../avatar_list/avatar_list.vue' import Timeago from '../timeago/timeago.vue' import StatusContent from '../status_content/status_content.vue' import StatusPopover from '../status_popover/status_popover.vue' +import UserPopover from '../user_popover/user_popover.vue' import EmojiReactions from '../emoji_reactions/emoji_reactions.vue' import generateProfileLink from 'src/services/user_profile_link_generator/user_profile_link_generator' import { highlightClass, highlightStyle } from '../../services/user_highlighter/user_highlighter.js' @@ -37,7 +38,6 @@ const Status = { return { replying: false, unmuted: false, - userExpanded: false, error: null } }, @@ -203,13 +203,13 @@ const Status = { RetweetButton, ExtraButtons, PostStatusForm, - UserCard, UserAvatar, AvatarList, Timeago, StatusPopover, EmojiReactions, - StatusContent + StatusContent, + UserPopover }, methods: { visibilityIcon (visibility) { @@ -244,9 +244,6 @@ const Status = { toggleMute () { this.unmuted = !this.unmuted }, - toggleUserExpanded () { - this.userExpanded = !this.userExpanded - }, generateUserProfileLink (id, name) { return generateProfileLink(id, name, this.$store.state.instance.restrictedNicknames) } diff --git a/src/components/status/status.vue b/src/components/status/status.vue index f6b5dd6f..2d74e5d6 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -22,9 +22,11 @@ v-if="muted && retweet" class="button-icon icon-retweet" /> - - {{ status.user.screen_name }} - + + + {{ status.user.screen_name }} + +
- - {{ retweeter }} + + + {{ retweeter }} + - +
-
{{ status.user.name }} - + + +
@@ -222,9 +218,11 @@ > {{ $t('status.reply_to') }} - - {{ replyToName }} - + + + {{ replyToName }} + + + + + diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index 8e6b9d7f..5f66f036 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -9,7 +9,13 @@ import { mapGetters } from 'vuex' export default { props: [ - 'userId', 'switcher', 'selected', 'hideBio', 'rounded', 'bordered', 'allowZoomingAvatar' + 'userId', + 'switcher', + 'selected', + 'hideBio', + 'rounded', + 'bordered', + 'allowZoomingAvatar' ], data () { return { diff --git a/src/components/user_card/user_card.vue b/src/components/user_card/user_card.vue index 9529d7f6..5f7861b2 100644 --- a/src/components/user_card/user_card.vue +++ b/src/components/user_card/user_card.vue @@ -19,6 +19,7 @@