From 64a34af86055e5ae6f840f2b778041ce447a3536 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Fri, 30 Mar 2018 00:20:35 +0900 Subject: [PATCH] refs #116 Store Jump modal component under Modals --- src/renderer/components/TimelineSpace.vue | 10 +++---- .../components/TimelineSpace/Modals.vue | 22 ++++++++++++++++ .../{JumpModal.vue => Modals/Jump.vue} | 26 +++++++++---------- src/renderer/store/TimelineSpace.js | 4 +-- src/renderer/store/TimelineSpace/Modals.js | 4 ++- .../{JumpModal.js => Modals/Jump.js} | 6 ++--- 6 files changed, 45 insertions(+), 27 deletions(-) create mode 100644 src/renderer/components/TimelineSpace/Modals.vue rename src/renderer/components/TimelineSpace/{JumpModal.vue => Modals/Jump.vue} (74%) rename src/renderer/store/TimelineSpace/{JumpModal.js => Modals/Jump.js} (93%) diff --git a/src/renderer/components/TimelineSpace.vue b/src/renderer/components/TimelineSpace.vue index e76030a6..af0d32bd 100644 --- a/src/renderer/components/TimelineSpace.vue +++ b/src/renderer/components/TimelineSpace.vue @@ -7,23 +7,19 @@ - - - + diff --git a/src/renderer/components/TimelineSpace/JumpModal.vue b/src/renderer/components/TimelineSpace/Modals/Jump.vue similarity index 74% rename from src/renderer/components/TimelineSpace/JumpModal.vue rename to src/renderer/components/TimelineSpace/Modals/Jump.vue index cb220e48..202f6dde 100644 --- a/src/renderer/components/TimelineSpace/JumpModal.vue +++ b/src/renderer/components/TimelineSpace/Modals/Jump.vue @@ -22,18 +22,18 @@ import { mapState } from 'vuex' export default { - name: 'jump-modal', + name: 'jump', computed: { ...mapState({ - channelList: state => state.TimelineSpace.JumpModal.channelList, - selectedChannel: state => state.TimelineSpace.JumpModal.selectedChannel + channelList: state => state.TimelineSpace.Modals.Jump.channelList, + selectedChannel: state => state.TimelineSpace.Modals.Jump.selectedChannel }), channel: { get () { - return this.$store.state.TimelineSpace.JumpModal.channel + return this.$store.state.TimelineSpace.Modals.Jump.channel }, set (value) { - this.$store.commit('TimelineSpace/JumpModal/updateChannel', value) + this.$store.commit('TimelineSpace/Modals/Jump/updateChannel', value) } }, filterdChannel () { @@ -41,16 +41,16 @@ export default { }, jumpModal: { get () { - return this.$store.state.TimelineSpace.JumpModal.modalOpen + return this.$store.state.TimelineSpace.Modals.Jump.modalOpen }, set (value) { - this.$store.commit('TimelineSpace/JumpModal/changeModal', value) + this.$store.commit('TimelineSpace/Modals/Jump/changeModal', value) } } }, watch: { channel (newChannel, oldChannel) { - this.$store.commit('TimelineSpace/JumpModal/changeSelected', this.filterChannelForm()[0]) + this.$store.commit('TimelineSpace/Modals/Jump/changeSelected', this.filterChannelForm()[0]) } }, updated () { @@ -72,7 +72,7 @@ export default { return e.name === this.selectedChannel.name }) if (i !== undefined && i < (filterd.length - 1)) { - this.$store.commit('TimelineSpace/JumpModal/changeSelected', filterd[i + 1]) + this.$store.commit('TimelineSpace/Modals/Jump/changeSelected', filterd[i + 1]) } }, prevChannel () { @@ -81,17 +81,17 @@ export default { return e.name === this.selectedChannel.name }) if (i !== undefined && i > 0) { - this.$store.commit('TimelineSpace/JumpModal/changeSelected', filterd[i - 1]) + this.$store.commit('TimelineSpace/Modals/Jump/changeSelected', filterd[i - 1]) } }, changeSelected (channel) { - this.$store.commit('TimelineSpace/JumpModal/changeSelected', channel) + this.$store.commit('TimelineSpace/Modals/Jump/changeSelected', channel) }, jumpCurrentSelected () { - this.$store.dispatch('TimelineSpace/JumpModal/jumpCurrentSelected') + this.$store.dispatch('TimelineSpace/Modals/Jump/jumpCurrentSelected') }, jump (channel) { - this.$store.dispatch('TimelineSpace/JumpModal/jump', channel) + this.$store.dispatch('TimelineSpace/Modals/Jump/jump', channel) } } } diff --git a/src/renderer/store/TimelineSpace.js b/src/renderer/store/TimelineSpace.js index 1f9becc2..0b2b93c7 100644 --- a/src/renderer/store/TimelineSpace.js +++ b/src/renderer/store/TimelineSpace.js @@ -1,7 +1,6 @@ import { ipcRenderer } from 'electron' import Mastodon from 'mastodon-api' import SideMenu from './TimelineSpace/SideMenu' -import JumpModal from './TimelineSpace/JumpModal' import Modals from './TimelineSpace/Modals' import Contents from './TimelineSpace/Contents' import router from '../router' @@ -10,7 +9,6 @@ const TimelineSpace = { namespaced: true, modules: { SideMenu, - JumpModal, Modals, Contents }, @@ -153,7 +151,7 @@ const TimelineSpace = { commit('TimelineSpace/Modals/NewToot/changeModal', true, { root: true }) }) ipcRenderer.on('CmdOrCtrl+K', () => { - commit('TimelineSpace/JumpModal/changeModal', true, { root: true }) + commit('TimelineSpace/Modals/Jump/changeModal', true, { root: true }) }) }, async removeShortcutEvents () { diff --git a/src/renderer/store/TimelineSpace/Modals.js b/src/renderer/store/TimelineSpace/Modals.js index e9daa0ad..a3513817 100644 --- a/src/renderer/store/TimelineSpace/Modals.js +++ b/src/renderer/store/TimelineSpace/Modals.js @@ -1,11 +1,13 @@ import NewToot from './Modals/NewToot' import ImageViewer from './Modals/ImageViewer' +import Jump from './Modals/Jump' const Modals = { namespaced: true, modules: { ImageViewer, - NewToot + NewToot, + Jump } } diff --git a/src/renderer/store/TimelineSpace/JumpModal.js b/src/renderer/store/TimelineSpace/Modals/Jump.js similarity index 93% rename from src/renderer/store/TimelineSpace/JumpModal.js rename to src/renderer/store/TimelineSpace/Modals/Jump.js index 9cfea6c8..50bd6cf6 100644 --- a/src/renderer/store/TimelineSpace/JumpModal.js +++ b/src/renderer/store/TimelineSpace/Modals/Jump.js @@ -1,6 +1,6 @@ -import router from '../../router' +import router from '../../../router' -const JumpModal = { +const Jump = { namespaced: true, state: { modalOpen: false, @@ -55,4 +55,4 @@ const JumpModal = { } } -export default JumpModal +export default Jump