From 1727c815f8bb9651a687d4329c4e7e13b7f1983d Mon Sep 17 00:00:00 2001 From: taehoon Date: Thu, 11 Jul 2019 08:30:35 -0400 Subject: [PATCH 1/8] install v-tooltip --- package.json | 3 ++- src/main.js | 2 ++ yarn.lock | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 25bc419c..f1fdaf49 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "portal-vue": "^2.1.4", "sanitize-html": "^1.13.0", "v-click-outside": "^2.1.1", + "v-tooltip": "^2.0.2", "vue": "^2.5.13", "vue-chat-scroll": "^1.2.1", "vue-i18n": "^7.3.2", @@ -81,8 +82,8 @@ "json-loader": "^0.5.4", "karma": "^3.0.0", "karma-coverage": "^1.1.1", - "karma-mocha": "^1.2.0", "karma-firefox-launcher": "^1.1.0", + "karma-mocha": "^1.2.0", "karma-sinon-chai": "^2.0.2", "karma-sourcemap-loader": "^0.3.7", "karma-spec-reporter": "0.0.26", diff --git a/src/main.js b/src/main.js index 3287fa2b..b3256e8e 100644 --- a/src/main.js +++ b/src/main.js @@ -26,6 +26,7 @@ import messages from './i18n/messages.js' import VueChatScroll from 'vue-chat-scroll' import VueClickOutside from 'v-click-outside' import PortalVue from 'portal-vue' +import VTooltip from 'v-tooltip' import afterStoreSetup from './boot/after_store.js' @@ -37,6 +38,7 @@ Vue.use(VueI18n) Vue.use(VueChatScroll) Vue.use(VueClickOutside) Vue.use(PortalVue) +Vue.use(VTooltip) const i18n = new VueI18n({ // By default, use the browser locale, we will update it if neccessary diff --git a/yarn.lock b/yarn.lock index 5a84499e..2656ef3d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5463,6 +5463,11 @@ popper.js@^1.14.7: version "1.14.7" resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.14.7.tgz#e31ec06cfac6a97a53280c3e55e4e0c860e7738e" +popper.js@^1.15.0: + version "1.15.0" + resolved "https://registry.yarnpkg.com/popper.js/-/popper.js-1.15.0.tgz#5560b99bbad7647e9faa475c6b8056621f5a4ff2" + integrity sha512-w010cY1oCUmI+9KwwlWki+r5jxKfTFDVoadl7MSrIujHU5MJ5OR6HTDj6Xo8aoR/QsA56x8jKjA59qGH4ELtrA== + portal-vue@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/portal-vue/-/portal-vue-2.1.4.tgz#1fc679d77e294dc8d026f1eb84aa467de11b392e" @@ -7198,6 +7203,15 @@ v-click-outside@^2.1.1: version "2.1.3" resolved "https://registry.yarnpkg.com/v-click-outside/-/v-click-outside-2.1.3.tgz#b7297abe833a439dc0895e6418a494381e64b5e7" +v-tooltip@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/v-tooltip/-/v-tooltip-2.0.2.tgz#8610d9eece2cc44fd66c12ef2f12eec6435cab9b" + integrity sha512-xQ+qzOFfywkLdjHknRPgMMupQNS8yJtf9Utd5Dxiu/0n4HtrxqsgDtN2MLZ0LKbburtSAQgyypuE/snM8bBZhw== + dependencies: + lodash "^4.17.11" + popper.js "^1.15.0" + vue-resize "^0.4.5" + validate-npm-package-license@^3.0.1: version "3.0.4" resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" @@ -7278,6 +7292,11 @@ vue-popperjs@^2.0.3: dependencies: popper.js "^1.14.7" +vue-resize@^0.4.5: + version "0.4.5" + resolved "https://registry.yarnpkg.com/vue-resize/-/vue-resize-0.4.5.tgz#4777a23042e3c05620d9cbda01c0b3cc5e32dcea" + integrity sha512-bhP7MlgJQ8TIkZJXAfDf78uJO+mEI3CaLABLjv0WNzr4CcGRGPIAItyWYnP6LsPA4Oq0WE+suidNs6dgpO4RHg== + vue-router@^3.0.1: version "3.0.2" resolved "https://registry.yarnpkg.com/vue-router/-/vue-router-3.0.2.tgz#dedc67afe6c4e2bc25682c8b1c2a8c0d7c7e56be" From 005815c8259e3ccbc1fdd9c4d352aa4053d187c4 Mon Sep 17 00:00:00 2001 From: taehoon Date: Thu, 11 Jul 2019 08:31:02 -0400 Subject: [PATCH 2/8] rewrite ExtraButtons using v-tooltip --- src/components/extra_buttons/extra_buttons.js | 24 ------------- .../extra_buttons/extra_buttons.vue | 35 +++++++------------ src/components/status/status.vue | 2 +- 3 files changed, 13 insertions(+), 48 deletions(-) diff --git a/src/components/extra_buttons/extra_buttons.js b/src/components/extra_buttons/extra_buttons.js index 528da301..2ec72729 100644 --- a/src/components/extra_buttons/extra_buttons.js +++ b/src/components/extra_buttons/extra_buttons.js @@ -1,45 +1,21 @@ -import Popper from 'vue-popperjs/src/component/popper.js.vue' - const ExtraButtons = { props: [ 'status' ], - components: { - Popper - }, - data () { - return { - showDropDown: false, - showPopper: true - } - }, methods: { deleteStatus () { - this.refreshPopper() const confirmed = window.confirm(this.$t('status.delete_confirm')) if (confirmed) { this.$store.dispatch('deleteStatus', { id: this.status.id }) } }, - toggleMenu () { - this.showDropDown = !this.showDropDown - }, pinStatus () { - this.refreshPopper() this.$store.dispatch('pinStatus', this.status.id) .then(() => this.$emit('onSuccess')) .catch(err => this.$emit('onError', err.error.error)) }, unpinStatus () { - this.refreshPopper() this.$store.dispatch('unpinStatus', this.status.id) .then(() => this.$emit('onSuccess')) .catch(err => this.$emit('onError', err.error.error)) - }, - refreshPopper () { - this.showPopper = false - this.showDropDown = false - setTimeout(() => { - this.showPopper = true - }) } }, computed: { diff --git a/src/components/extra_buttons/extra_buttons.vue b/src/components/extra_buttons/extra_buttons.vue index 8e24e9a5..d5fc82ac 100644 --- a/src/components/extra_buttons/extra_buttons.vue +++ b/src/components/extra_buttons/extra_buttons.vue @@ -1,23 +1,16 @@ @@ -59,7 +47,8 @@ .icon-ellipsis { cursor: pointer; - &:hover, &.icon-clicked { + &:hover, + .extra-button-popover.open & { color: $fallback--text; color: var(--text, $fallback--text); } diff --git a/src/components/status/status.vue b/src/components/status/status.vue index b825d17d..e9fe0700 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -824,7 +824,7 @@ $status-margin: 0.75em; display: flex; margin-top: $status-margin; - div, favorite-button { + > * { max-width: 4em; flex: 1; } From b9c547828e082970f8ad3fb72f81e38b738a6d0c Mon Sep 17 00:00:00 2001 From: taehoon Date: Thu, 11 Jul 2019 08:32:57 -0400 Subject: [PATCH 3/8] make popover position for status action dropdow relative to parent node --- src/components/extra_buttons/extra_buttons.vue | 1 + src/components/status/status.vue | 1 + 2 files changed, 2 insertions(+) diff --git a/src/components/extra_buttons/extra_buttons.vue b/src/components/extra_buttons/extra_buttons.vue index d5fc82ac..73f3d936 100644 --- a/src/components/extra_buttons/extra_buttons.vue +++ b/src/components/extra_buttons/extra_buttons.vue @@ -3,6 +3,7 @@ v-if="enabled" trigger="click" class="extra-button-popover" + :container="false" >