rename starred to favourites
This commit is contained in:
parent
b1ee4b18dc
commit
cdb4540d82
@ -31,8 +31,8 @@
|
||||
<Icon icon="collection" /> Genres
|
||||
</router-link>
|
||||
|
||||
<router-link class="nav-link" :to="{name: 'starred'}">
|
||||
<Icon icon="star" /> Starred
|
||||
<router-link class="nav-link" :to="{name: 'favourites'}">
|
||||
<Icon icon="heart" /> Favourites
|
||||
</router-link>
|
||||
|
||||
<router-link class="nav-link" :to="{name: 'podcasts'}">
|
||||
|
@ -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>
|
@ -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)
|
||||
|
@ -12,7 +12,7 @@ export interface Track {
|
||||
id: string
|
||||
title: string
|
||||
duration: number
|
||||
starred: boolean
|
||||
favourite: boolean
|
||||
image?: string
|
||||
url?: string
|
||||
track?: number
|
||||
@ -28,7 +28,7 @@ export interface Album {
|
||||
artist: string
|
||||
artistId: string
|
||||
year: number
|
||||
starred: boolean
|
||||
favourite: boolean
|
||||
genreId?: string
|
||||
image?: string
|
||||
tracks?: Track[]
|
||||
@ -39,7 +39,7 @@ export interface Artist {
|
||||
name: string
|
||||
albumCount: number
|
||||
description?: string
|
||||
starred: boolean
|
||||
favourite: boolean
|
||||
lastFmUrl?: string
|
||||
musicBrainzUrl?: string
|
||||
similarArtist?: Artist[]
|
||||
@ -240,7 +240,7 @@ export class API {
|
||||
return (response.randomSongs?.song || []).map(this.normalizeTrack, this)
|
||||
}
|
||||
|
||||
async getStarred() {
|
||||
async getFavourites() {
|
||||
const response = await this.get('rest/getStarred2')
|
||||
return {
|
||||
albums: (response.starred2?.album || []).map(this.normalizeAlbum, this),
|
||||
@ -249,15 +249,7 @@ export class API {
|
||||
}
|
||||
}
|
||||
|
||||
starAlbum(id: string) {
|
||||
return this.star('album', id)
|
||||
}
|
||||
|
||||
unstarAlbum(id: string) {
|
||||
return this.unstar('album', id)
|
||||
}
|
||||
|
||||
async star(type: 'track' | 'album' | 'artist', id: string) {
|
||||
async addFavourite(type: 'track' | 'album' | 'artist', id: string) {
|
||||
const params = {
|
||||
id: type === 'track' ? id : undefined,
|
||||
albumId: type === 'album' ? id : undefined,
|
||||
@ -266,7 +258,7 @@ export class API {
|
||||
await this.get('rest/star', params)
|
||||
}
|
||||
|
||||
async unstar(type: 'track' | 'album' | 'artist', id: string) {
|
||||
async removeFavourite(type: 'track' | 'album' | 'artist', id: string) {
|
||||
const params = {
|
||||
id: type === 'track' ? id : undefined,
|
||||
albumId: type === 'album' ? id : undefined,
|
||||
@ -349,7 +341,7 @@ export class API {
|
||||
track: item.track,
|
||||
url: item.streamUrl,
|
||||
duration: 0,
|
||||
starred: false,
|
||||
favourite: false,
|
||||
}
|
||||
}
|
||||
|
||||
@ -358,7 +350,7 @@ export class API {
|
||||
id: item.id,
|
||||
title: item.title,
|
||||
duration: item.duration,
|
||||
starred: !!item.starred,
|
||||
favourite: !!item.starred,
|
||||
track: item.track,
|
||||
album: item.album,
|
||||
albumId: item.albumId,
|
||||
@ -377,7 +369,7 @@ export class API {
|
||||
artistId: item.artistId,
|
||||
image: this.getCoverArtUrl(item),
|
||||
year: item.year || 0,
|
||||
starred: !!item.starred,
|
||||
favourite: !!item.starred,
|
||||
genreId: item.genre,
|
||||
tracks: (item.song || []).map(this.normalizeTrack, this)
|
||||
}
|
||||
@ -392,7 +384,7 @@ export class API {
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
description: (item.biography || '').replace(/<a[^>]*>.*?<\/a>/gm, ''),
|
||||
starred: !!item.starred,
|
||||
favourite: !!item.starred,
|
||||
albumCount: item.albumCount,
|
||||
lastFmUrl: item.lastFmUrl,
|
||||
musicBrainzUrl: item.musicBrainzId
|
||||
@ -416,7 +408,7 @@ export class API {
|
||||
id: episode.id,
|
||||
title: episode.title,
|
||||
duration: episode.duration,
|
||||
starred: false,
|
||||
favourite: false,
|
||||
track: podcast.episode.length - index,
|
||||
album: podcast.title,
|
||||
albumId: null,
|
||||
|
@ -11,8 +11,6 @@
|
||||
BIconCardText,
|
||||
BIconChevronCompactRight,
|
||||
BIconMusicNoteList,
|
||||
BIconStar,
|
||||
BIconStarFill,
|
||||
BIconCollection,
|
||||
BIconCollectionFill,
|
||||
BIconList,
|
||||
@ -29,6 +27,8 @@
|
||||
BIconX,
|
||||
BIconVolumeMuteFill,
|
||||
BIconVolumeUpFill,
|
||||
BIconHeart,
|
||||
BIconHeartFill,
|
||||
} from 'bootstrap-vue'
|
||||
|
||||
export default Vue.extend({
|
||||
@ -40,8 +40,6 @@
|
||||
BIconCardText,
|
||||
BIconChevronCompactRight,
|
||||
BIconMusicNoteList,
|
||||
BIconStar,
|
||||
BIconStarFill,
|
||||
BIconCollection,
|
||||
BIconCollectionFill,
|
||||
BIconList,
|
||||
@ -58,6 +56,8 @@
|
||||
BIconX,
|
||||
BIconVolumeMuteFill,
|
||||
BIconVolumeUpFill,
|
||||
BIconHeart,
|
||||
BIconHeartFill,
|
||||
},
|
||||
props: {
|
||||
icon: { type: String, required: true }
|
||||
|
@ -8,7 +8,7 @@ import AlbumDetails from '@/library/album/AlbumDetails.vue'
|
||||
import AlbumLibrary from '@/library/album/AlbumLibrary.vue'
|
||||
import GenreDetails from '@/library/genre/GenreDetails.vue'
|
||||
import GenreLibrary from '@/library/genre/GenreLibrary.vue'
|
||||
import Starred from '@/library/starred/Starred.vue'
|
||||
import Favourites from '@/library/favourite/Favourites.vue'
|
||||
import RadioStations from '@/library/radio/RadioStations.vue'
|
||||
import PodcastDetails from '@/library/podcast/PodcastDetails.vue'
|
||||
import PodcastLibrary from '@/library/podcast/PodcastLibrary.vue'
|
||||
@ -87,9 +87,9 @@ export function setupRouter(auth: AuthService) {
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
name: 'starred',
|
||||
path: '/starred/:section?',
|
||||
component: Starred,
|
||||
name: 'favourites',
|
||||
path: '/favourites/:section?',
|
||||
component: Favourites,
|
||||
props: true,
|
||||
},
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user