From 3adbdcb3d42407d9d29717f7a0317f37190c76f1 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Sun, 15 Apr 2018 12:12:15 +0900
Subject: [PATCH] refs #202 Add lists channels in jump modal
---
.../components/TimelineSpace/Modals/Jump.vue | 23 +++++++++++--------
.../store/TimelineSpace/Modals/Jump.js | 18 ++++++++++++---
2 files changed, 29 insertions(+), 12 deletions(-)
diff --git a/src/renderer/components/TimelineSpace/Modals/Jump.vue b/src/renderer/components/TimelineSpace/Modals/Jump.vue
index 202f6dde1a..cb46a87825 100644
--- a/src/renderer/components/TimelineSpace/Modals/Jump.vue
+++ b/src/renderer/components/TimelineSpace/Modals/Jump.vue
@@ -25,7 +25,9 @@ export default {
name: 'jump',
computed: {
...mapState({
- channelList: state => state.TimelineSpace.Modals.Jump.channelList,
+ channelList: (state) => {
+ return state.TimelineSpace.Modals.Jump.defaultChannelList.concat(state.TimelineSpace.Modals.Jump.listChannelList)
+ },
selectedChannel: state => state.TimelineSpace.Modals.Jump.selectedChannel
}),
channel: {
@@ -49,15 +51,18 @@ export default {
}
},
watch: {
- channel (newChannel, oldChannel) {
+ channel: function (newChannel, oldChannel) {
this.$store.commit('TimelineSpace/Modals/Jump/changeSelected', this.filterChannelForm()[0])
- }
- },
- updated () {
- if (this.jumpModal) {
- this.$refs.channel.focus()
- } else {
- this.channel = ''
+ },
+ jumpModal: function (newModal, oldModal) {
+ if (!oldModal && newModal) {
+ this.$nextTick(function () {
+ this.$store.dispatch('TimelineSpace/Modals/Jump/syncListChannel')
+ this.$refs.channel.focus()
+ })
+ } else {
+ this.channel = ''
+ }
}
},
methods: {
diff --git a/src/renderer/store/TimelineSpace/Modals/Jump.js b/src/renderer/store/TimelineSpace/Modals/Jump.js
index 50bd6cf659..77071ea6a4 100644
--- a/src/renderer/store/TimelineSpace/Modals/Jump.js
+++ b/src/renderer/store/TimelineSpace/Modals/Jump.js
@@ -5,7 +5,7 @@ const Jump = {
state: {
modalOpen: false,
channel: '',
- channelList: [
+ defaultChannelList: [
{
name: 'Home',
path: 'home'
@@ -19,14 +19,15 @@ const Jump = {
path: 'favourites'
},
{
- name: 'LocalTimeline',
+ name: 'Local timeline',
path: 'local'
},
{
- name: 'PublicTimeline',
+ name: 'Public timeline',
path: 'public'
}
],
+ listChannelList: [],
selectedChannel: {
name: 'Home',
path: 'home'
@@ -41,6 +42,14 @@ const Jump = {
},
changeSelected (state, value) {
state.selectedChannel = value
+ },
+ updateListChannel (state, list) {
+ state.listChannelList = list.map((l) => {
+ return {
+ name: `#${l.title}`,
+ path: `lists/${l.id}`
+ }
+ })
}
},
actions: {
@@ -51,6 +60,9 @@ const Jump = {
jump ({ state, commit, rootState }, channel) {
commit('changeModal', false)
router.push({ path: `/${rootState.TimelineSpace.account._id}/${channel.path}` })
+ },
+ syncListChannel ({ state, commit, rootState }) {
+ commit('updateListChannel', rootState.TimelineSpace.SideMenu.lists)
}
}
}