diff --git a/src/library/TrackContextMenu.vue b/src/library/TrackContextMenu.vue
index 38aa3c9..b5ee790 100644
--- a/src/library/TrackContextMenu.vue
+++ b/src/library/TrackContextMenu.vue
@@ -36,10 +36,10 @@
return this.$api.star('track', this.track.id)
},
setNextInQueue() {
- return this.$store.dispatch('player/setNextInQueue', this.track)
+ return this.$store.dispatch('player/setNextInQueue', [this.track])
},
addToQueue() {
- return this.$store.dispatch('player/addToQueue', this.track)
+ return this.$store.dispatch('player/addToQueue', [this.track])
},
}
})
diff --git a/src/library/album/AlbumDetails.vue b/src/library/album/AlbumDetails.vue
index 955f572..67d3257 100644
--- a/src/library/album/AlbumDetails.vue
+++ b/src/library/album/AlbumDetails.vue
@@ -22,6 +22,17 @@
+
+
+
+
+
+ Play next
+
+
+ Add to queue
+
+
@@ -59,13 +70,23 @@
},
methods: {
play() {
- if (this.album?.tracks) {
+ if (this.album) {
return this.$store.dispatch('player/playTrackList', {
index: 0,
tracks: this.album.tracks,
})
}
},
+ setNextInQueue() {
+ if (this.album) {
+ return this.$store.dispatch('player/setNextInQueue', this.album.tracks)
+ }
+ },
+ addToQueue() {
+ if (this.album) {
+ return this.$store.dispatch('player/addToQueue', this.album.tracks)
+ }
+ },
toggleStar() {
if (this.album) {
const value = !this.album.starred
@@ -74,7 +95,7 @@
? this.$api.starAlbum(this.album.id)
: this.$api.unstarAlbum(this.album.id)
}
- }
+ },
}
})
diff --git a/src/player/store.ts b/src/player/store.ts
index 0ce7c57..127cbd6 100644
--- a/src/player/store.ts
+++ b/src/player/store.ts
@@ -92,8 +92,8 @@ export const playerModule: Module = {
})
}
},
- addToQueue(state, track) {
- state.queue.push(track)
+ addToQueue(state, tracks) {
+ state.queue.push(...tracks)
},
removeFromQueue(state, index) {
state.queue.splice(index, 1)
@@ -101,8 +101,8 @@ export const playerModule: Module = {
state.queueIndex--
}
},
- setNextInQueue(state, track) {
- state.queue.splice(state.queueIndex + 1, 0, track)
+ setNextInQueue(state, tracks) {
+ state.queue.splice(state.queueIndex + 1, 0, ...tracks)
},
setCurrentTime(state, value: any) {
state.currentTime = value
@@ -190,11 +190,11 @@ export const playerModule: Module = {
commit('setMute', !state.mute)
audio.volume = state.mute ? 0.0 : state.volume
},
- addToQueue({ commit }, track) {
- commit('addToQueue', track)
+ addToQueue({ state, commit }, tracks) {
+ commit('addToQueue', state.shuffle ? shuffle([...tracks]) : tracks)
},
- setNextInQueue({ commit }, track) {
- commit('setNextInQueue', track)
+ setNextInQueue({ state, commit }, tracks) {
+ commit('setNextInQueue', state.shuffle ? shuffle([...tracks]) : tracks)
},
setVolume({ commit }, value) {
audio.volume = value