Skip to content
Snippets Groups Projects
Verified Commit fd5c1916 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

See #262: added message feedback on play button

parent f8de5c2f
No related branches found
No related tags found
No related merge requests found
...@@ -124,19 +124,28 @@ export default { ...@@ -124,19 +124,28 @@ export default {
add () { add () {
let self = this let self = this
this.getPlayableTracks().then((tracks) => { this.getPlayableTracks().then((tracks) => {
self.$store.dispatch('queue/appendMany', {tracks: tracks}) self.$store.dispatch('queue/appendMany', {tracks: tracks}).then(() => self.addMessage(tracks))
}) })
}, },
addNext (next) { addNext (next) {
let self = this let self = this
let wasEmpty = this.$store.state.queue.tracks.length === 0 let wasEmpty = this.$store.state.queue.tracks.length === 0
this.getPlayableTracks().then((tracks) => { this.getPlayableTracks().then((tracks) => {
self.$store.dispatch('queue/appendMany', {tracks: tracks, index: self.$store.state.queue.currentIndex + 1}) self.$store.dispatch('queue/appendMany', {tracks: tracks, index: self.$store.state.queue.currentIndex + 1}).then(() => self.addMessage(tracks))
let goNext = next && !wasEmpty let goNext = next && !wasEmpty
if (goNext) { if (goNext) {
self.$store.dispatch('queue/next') self.$store.dispatch('queue/next')
} }
}) })
},
addMessage (tracks) {
if (tracks.length < 1) {
return
}
this.$store.commit('ui/addMessage', {
content: this.$t('{% tracks %} tracks were added to your queue.', {tracks: tracks.length}),
date: new Date()
})
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment