mirror of
https://github.com/h3poteto/whalebird-desktop
synced 2025-01-31 09:35:16 +01:00
refs #202 Add lists channels in jump modal
This commit is contained in:
parent
9bae1d3bd5
commit
3adbdcb3d4
@ -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: {
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user