diff --git a/package.json b/package.json index c1b997f1..a9ee7340 100644 --- a/package.json +++ b/package.json @@ -95,6 +95,7 @@ "vue": "^2.3.3", "vue-awesome": "^2.3.5", "vue-electron": "^1.0.6", + "vue-js-popover": "^1.1.7", "vue-router": "^2.5.3", "vue-shortkey": "^3.1.0", "vuex": "^2.3.1" diff --git a/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue b/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue index 278b6c77..c166ae40 100644 --- a/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue +++ b/src/renderer/components/TimelineSpace/Contents/Cards/Toot.vue @@ -3,7 +3,7 @@
-
+
{{ username(originalMessage(message).account) }} @@ -38,6 +38,16 @@ + + + + +
    +
  • + View Toot Detail +
  • +
+
@@ -79,6 +89,11 @@ export default { openReply (message) { this.$store.dispatch('TimelineSpace/Modals/NewToot/openReply', message) }, + openDetail (message) { + this.$store.dispatch('TimelineSpace/Contents/SideBar/openTootComponent') + this.$store.dispatch('TimelineSpace/Contents/SideBar/TootDetail/changeToot', message) + this.$store.commit('TimelineSpace/Contents/SideBar/changeOpenSideBar', true) + }, changeReblog (message) { if (message.reblogged) { this.$store.dispatch('TimelineSpace/Contents/Cards/Toot/unreblog', message) @@ -247,6 +262,28 @@ function findLink (target) { .favourited { color: #e6a23c; } + + .toot-menu{ + padding: 0; + font-size: 0.8em; + margin-left: 0.5em; + list-style-type: none; + text-align: center; + + li{ + padding-bottom: 0.5em; + border-bottom: 1px solid #ddd; + + &:hover{ + cursor: pointer; + } + + &:last-child{ + border: 0; + padding: 0; + } + } + } } .reply:hover, diff --git a/src/renderer/components/TimelineSpace/Contents/SideBar.vue b/src/renderer/components/TimelineSpace/Contents/SideBar.vue index 266b8db8..abf23331 100644 --- a/src/renderer/components/TimelineSpace/Contents/SideBar.vue +++ b/src/renderer/components/TimelineSpace/Contents/SideBar.vue @@ -4,16 +4,19 @@
+
+ + diff --git a/src/renderer/main.js b/src/renderer/main.js index 837b84b2..ec6a23af 100644 --- a/src/renderer/main.js +++ b/src/renderer/main.js @@ -1,6 +1,7 @@ import Vue from 'vue' import axios from 'axios' import ElementUI from 'element-ui' +import Popover from 'vue-js-popover' import 'element-ui/lib/theme-chalk/index.css' import 'vue-awesome/icons' import Icon from 'vue-awesome/components/Icon' @@ -11,6 +12,7 @@ import router from './router' import store from './store' Vue.use(ElementUI) +Vue.use(Popover) Vue.component('icon', Icon) if (!process.env.IS_WEB) Vue.use(require('vue-electron')) diff --git a/src/renderer/store/TimelineSpace/Contents/SideBar.js b/src/renderer/store/TimelineSpace/Contents/SideBar.js index 9f1ac625..cf5c19ea 100644 --- a/src/renderer/store/TimelineSpace/Contents/SideBar.js +++ b/src/renderer/store/TimelineSpace/Contents/SideBar.js @@ -1,14 +1,17 @@ import AccountProfile from './SideBar/AccountProfile' +import TootDetail from './SideBar/TootDetail' const SideBar = { namespaced: true, modules: { - AccountProfile + AccountProfile, + TootDetail }, state: { openSideBar: false, // 0: blank // 1: account-profile + // 2: toot-detail component: 0 }, mutations: { @@ -26,6 +29,9 @@ const SideBar = { }, openAccountComponent ({ commit }) { commit('changeComponent', 1) + }, + openTootComponent ({ commit }) { + commit('changeComponent', 2) } } } diff --git a/src/renderer/store/TimelineSpace/Contents/SideBar/TootDetail.js b/src/renderer/store/TimelineSpace/Contents/SideBar/TootDetail.js new file mode 100644 index 00000000..0ecfd7db --- /dev/null +++ b/src/renderer/store/TimelineSpace/Contents/SideBar/TootDetail.js @@ -0,0 +1,43 @@ +import Mastodon from 'mastodon-api' + +const TootDetail = { + namespaced: true, + state: { + message: null, + ancestors: [], + descendants: [] + }, + mutations: { + changeToot (state, message) { + state.message = message + }, + updateAncestors (state, ancestors) { + state.ancestors = ancestors + }, + updateDescendants (state, descendants) { + state.descendants = descendants + } + }, + actions: { + changeToot ({ commit, dispatch }, message) { + commit('changeToot', message) + }, + fetchToot ({ state, commit, rootState }, message) { + return new Promise((resolve, reject) => { + const client = new Mastodon( + { + access_token: rootState.TimelineSpace.account.accessToken, + api_url: rootState.TimelineSpace.account.baseURL + '/api/v1' + }) + client.get(`/statuses/${message.id}/context`, { limit: 40 }, (err, data, res) => { + if (err) return reject(err) + commit('updateAncestors', data.ancestors) + commit('updateDescendants', data.descendants) + resolve(res) + }) + }) + } + } +} + +export default TootDetail