rename starred to favourites

This commit is contained in:
Thomas Amland
2021-05-09 11:56:34 +02:00
parent b1ee4b18dc
commit cdb4540d82
7 changed files with 38 additions and 46 deletions
+7 -7
View File
@@ -23,8 +23,8 @@
<b-button variant="secondary" class="mr-2" @click="play">
<Icon icon="play-fill" /> Play
</b-button>
<b-button variant="secondary" class="mr-2" @click="toggleStar">
<Icon :icon="album.starred ? 'star-fill' : 'star'" />
<b-button variant="secondary" class="mr-2" @click="toggleFavourite">
<Icon :icon="album.favourite ? 'heart-fill' : 'heart'" />
</b-button>
<b-dropdown variant="secondary" boundary="window" no-caret toggle-class="px-1">
<template #button-content>
@@ -91,13 +91,13 @@
return this.$store.dispatch('player/addToQueue', this.album.tracks)
}
},
toggleStar() {
toggleFavourite() {
if (this.album) {
const value = !this.album.starred
this.album.starred = value
const value = !this.album.favourite
this.album.favourite = value
return value
? this.$api.starAlbum(this.album.id)
: this.$api.unstarAlbum(this.album.id)
? this.$api.addFavourite('album', this.album.id)
: this.$api.removeFavourite('album', this.album.id)
}
},
}
@@ -1,6 +1,6 @@
<template>
<div>
<h1>Starred</h1>
<h1>Favourites</h1>
<ul class="nav-underlined">
<li>
<router-link :to="{... $route, params: { }}">
@@ -46,7 +46,7 @@
}
},
async created() {
this.result = await this.$api.getStarred()
this.result = await this.$api.getFavourites()
}
})
</script>
+8 -8
View File
@@ -7,8 +7,8 @@
<b-dropdown-item-button @click="addToQueue()">
Add to queue
</b-dropdown-item-button>
<b-dropdown-item-button @click="toggleStarred()">
{{ starred ? 'Unstar' : 'Star' }}
<b-dropdown-item-button @click="toggleFavourite()">
{{ favourite ? 'Remove from favourites' : 'Add to favourites' }}
</b-dropdown-item-button>
<b-dropdown-item-button @click="download()">
Download
@@ -26,16 +26,16 @@
},
data() {
return {
starred: this.track.starred,
favourite: this.track.favourite,
}
},
methods: {
toggleStarred() {
this.starred = !this.starred
if (this.starred) {
return this.$api.unstar('track', this.track.id)
toggleFavourite() {
this.favourite = !this.favourite
if (this.favourite) {
return this.$api.removeFavourite('track', this.track.id)
}
return this.$api.star('track', this.track.id)
return this.$api.addFavourite('track', this.track.id)
},
download() {
window.location.href = this.$api.getDownloadUrl(this.track.id)