add Play next & Add to queue to album page

This commit is contained in:
Thomas Amland
2021-03-14 12:38:14 +01:00
parent 4100572b54
commit f89f6b36c8
3 changed files with 33 additions and 12 deletions
+2 -2
View File
@@ -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])
},
}
})
+23 -2
View File
@@ -22,6 +22,17 @@
<b-button variant="secondary" class="mr-2" @click="toggleStar">
<Icon :icon="album.starred ? 'star-fill' : 'star'" />
</b-button>
<b-dropdown variant="secondary" boundary="window" no-caret toggle-class="px-1">
<template #button-content>
<Icon icon="three-dots-vertical" />
</template>
<b-dropdown-item-btn @click="setNextInQueue">
Play next
</b-dropdown-item-btn>
<b-dropdown-item-btn @click="addToQueue">
Add to queue
</b-dropdown-item-btn>
</b-dropdown>
</div>
</div>
</div>
@@ -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)
}
}
},
}
})
</script>