From 82c162142721f2405c40d71820532281a1b7e867 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Fri, 14 Sep 2018 00:20:13 +0900 Subject: [PATCH] refs #598 Add tag timelines to jump menu --- .../components/TimelineSpace/Modals/Jump.vue | 9 ++++----- src/renderer/store/TimelineSpace/Modals/Jump.js | 12 ++++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/renderer/components/TimelineSpace/Modals/Jump.vue b/src/renderer/components/TimelineSpace/Modals/Jump.vue index 035db99b..fc2b2c7e 100644 --- a/src/renderer/components/TimelineSpace/Modals/Jump.vue +++ b/src/renderer/components/TimelineSpace/Modals/Jump.vue @@ -31,11 +31,9 @@ import { mapState } from 'vuex' export default { name: 'jump', computed: { - ...mapState({ - channelList: (state) => { - return state.TimelineSpace.Modals.Jump.defaultChannelList.concat(state.TimelineSpace.Modals.Jump.listChannelList) - }, - selectedChannel: state => state.TimelineSpace.Modals.Jump.selectedChannel + ...mapState('TimelineSpace/Modals/Jump', { + channelList: state => state.defaultChannelList.concat(state.tagChannelList).concat(state.listChannelList), + selectedChannel: state => state.selectedChannel }), channel: { get () { @@ -65,6 +63,7 @@ export default { if (!oldModal && newModal) { this.$nextTick(function () { this.$store.dispatch('TimelineSpace/Modals/Jump/syncListChannel') + this.$store.dispatch('TimelineSpace/Modals/Jump/syncTagChannel') this.$refs.channel.focus() }) } else { diff --git a/src/renderer/store/TimelineSpace/Modals/Jump.js b/src/renderer/store/TimelineSpace/Modals/Jump.js index 28740917..ff103a42 100644 --- a/src/renderer/store/TimelineSpace/Modals/Jump.js +++ b/src/renderer/store/TimelineSpace/Modals/Jump.js @@ -37,6 +37,7 @@ const Jump = { } ], listChannelList: [], + tagChannelList: [], selectedChannel: { name: i18n.t('side_menu.home'), path: 'home' @@ -59,6 +60,14 @@ const Jump = { path: `lists/${l.id}` } }) + }, + updateTagChannel (state, tags) { + state.tagChannelList = tags.map(t => { + return { + name: `#${t.tagName}`, + path: `hashtag/${t.tagName}` + } + }) } }, actions: { @@ -72,6 +81,9 @@ const Jump = { }, syncListChannel ({ state, commit, rootState }) { commit('updateListChannel', rootState.TimelineSpace.SideMenu.lists) + }, + syncTagChannel ({ commit, rootState }) { + commit('updateTagChannel', rootState.TimelineSpace.SideMenu.tags) } } }