Added queu and play queue item action and mutation

pull/43/head
Nikan Dalvand 2019-08-01 23:07:21 +04:30
parent a39d404cc7
commit b5af578643
2 changed files with 19 additions and 9 deletions

View File

@ -33,7 +33,7 @@ export default {
} }
</script> </script>
<style lang="sass" scoped> <style lang="sass">
section.action-bar section.action-bar
display: flex display: flex
align-items: center align-items: center

View File

@ -1,28 +1,38 @@
const state = { const state = {
fullscreen_mode: false, fullscreen_mode: false,
currently_playing: { currently_playing: 0,
queue: [
{
id: 8, id: 8,
title: 'Yellow', title: 'Yellow',
artist: 'Rich Brian', artist: 'Rich Brian',
artwork: '/static/demo/yellow.jpeg', artwork: '/static/demo/yellow.jpeg',
stream: '/static/demo/music.mp3' stream: '/static/demo/music.mp3'
} }
]
} }
const getters = { const getters = {
fullscreenStatus: (state) => state.fullscreen_mode, fullscreenStatus: (state) => state.fullscreen_mode,
currentlyPlaying: (state) => state.currently_playing currentlyPlaying: (state) => state.currently_playing,
playerQueue: (state) => state.queue
} }
const mutations = { const mutations = {
TOGGLE_FULLSCREEN (state) { TOGGLE_FULLSCREEN (state) {
state.fullscreen_mode = !state.fullscreen_mode state.fullscreen_mode = !state.fullscreen_mode
},
PLAY_QUEUE_ITEM (state, index) {
state.currently_playing = index
} }
} }
const actions = { const actions = {
toggleFullscreenStatus ({ commit }) { toggleFullscreenStatus ({ commit }) {
commit('TOGGLE_FULLSCREEN') commit('TOGGLE_FULLSCREEN')
},
playQueueItem ({ commit }, index) {
commit('PLAY_QUEUE_ITEM', index)
} }
} }