refs #598 Add tag timelines to jump menu

This commit is contained in:
AkiraFukushima 2018-09-14 00:20:13 +09:00
parent 2d68305723
commit 82c1621427
2 changed files with 16 additions and 5 deletions

View File

@ -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 {

View File

@ -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)
}
}
}