refs #116 Store Jump modal component under Modals

This commit is contained in:
AkiraFukushima 2018-03-30 00:20:35 +09:00
parent bcd1cfd1c4
commit 64a34af860
6 changed files with 45 additions and 27 deletions

View File

@ -7,23 +7,19 @@
</header>
<contents></contents>
</div>
<new-toot></new-toot>
<jump-modal></jump-modal>
<image-viewer></image-viewer>
<modals></modals>
</div>
</template>
<script>
import SideMenu from './TimelineSpace/SideMenu'
import HeaderMenu from './TimelineSpace/HeaderMenu'
import NewToot from './TimelineSpace/Modals/NewToot'
import JumpModal from './TimelineSpace/JumpModal'
import ImageViewer from './TimelineSpace/Modals/ImageViewer'
import Contents from './TimelineSpace/Contents'
import Modals from './TimelineSpace/Modals'
export default {
name: 'timeline-space',
components: { SideMenu, HeaderMenu, NewToot, JumpModal, ImageViewer, Contents },
components: { SideMenu, HeaderMenu, Modals, Contents },
created () {
const loading = this.$loading({
lock: true,

View File

@ -0,0 +1,22 @@
<template>
<div>
<new-toot></new-toot>
<jump></jump>
<image-viewer></image-viewer>
</div>
</template>
<script>
import NewToot from './Modals/NewToot'
import Jump from './Modals/Jump'
import ImageViewer from './Modals/ImageViewer'
export default {
name: 'modals',
components: {
NewToot,
Jump,
ImageViewer
}
}
</script>

View File

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

View File

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

View File

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

View File

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