rename starred to favourites
This commit is contained in:
		
							parent
							
								
									b1ee4b18dc
								
							
						
					
					
						commit
						cdb4540d82
					
				| @ -31,8 +31,8 @@ | |||||||
|       <Icon icon="collection" /> Genres |       <Icon icon="collection" /> Genres | ||||||
|     </router-link> |     </router-link> | ||||||
| 
 | 
 | ||||||
|     <router-link class="nav-link" :to="{name: 'starred'}"> |     <router-link class="nav-link" :to="{name: 'favourites'}"> | ||||||
|       <Icon icon="star" /> Starred |       <Icon icon="heart" /> Favourites | ||||||
|     </router-link> |     </router-link> | ||||||
| 
 | 
 | ||||||
|     <router-link class="nav-link" :to="{name: 'podcasts'}"> |     <router-link class="nav-link" :to="{name: 'podcasts'}"> | ||||||
|  | |||||||
| @ -23,8 +23,8 @@ | |||||||
|           <b-button variant="secondary" class="mr-2" @click="play"> |           <b-button variant="secondary" class="mr-2" @click="play"> | ||||||
|             <Icon icon="play-fill" /> Play |             <Icon icon="play-fill" /> Play | ||||||
|           </b-button> |           </b-button> | ||||||
|           <b-button variant="secondary" class="mr-2" @click="toggleStar"> |           <b-button variant="secondary" class="mr-2" @click="toggleFavourite"> | ||||||
|             <Icon :icon="album.starred ? 'star-fill' : 'star'" /> |             <Icon :icon="album.favourite ? 'heart-fill' : 'heart'" /> | ||||||
|           </b-button> |           </b-button> | ||||||
|           <b-dropdown variant="secondary" boundary="window" no-caret toggle-class="px-1"> |           <b-dropdown variant="secondary" boundary="window" no-caret toggle-class="px-1"> | ||||||
|             <template #button-content> |             <template #button-content> | ||||||
| @ -91,13 +91,13 @@ | |||||||
|           return this.$store.dispatch('player/addToQueue', this.album.tracks) |           return this.$store.dispatch('player/addToQueue', this.album.tracks) | ||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
|       toggleStar() { |       toggleFavourite() { | ||||||
|         if (this.album) { |         if (this.album) { | ||||||
|           const value = !this.album.starred |           const value = !this.album.favourite | ||||||
|           this.album.starred = value |           this.album.favourite = value | ||||||
|           return value |           return value | ||||||
|             ? this.$api.starAlbum(this.album.id) |             ? this.$api.addFavourite('album', this.album.id) | ||||||
|             : this.$api.unstarAlbum(this.album.id) |             : this.$api.removeFavourite('album', this.album.id) | ||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| <template> | <template> | ||||||
|   <div> |   <div> | ||||||
|     <h1>Starred</h1> |     <h1>Favourites</h1> | ||||||
|     <ul class="nav-underlined"> |     <ul class="nav-underlined"> | ||||||
|       <li> |       <li> | ||||||
|         <router-link :to="{... $route, params: { }}"> |         <router-link :to="{... $route, params: { }}"> | ||||||
| @ -46,7 +46,7 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     async created() { |     async created() { | ||||||
|       this.result = await this.$api.getStarred() |       this.result = await this.$api.getFavourites() | ||||||
|     } |     } | ||||||
|   }) |   }) | ||||||
| </script> | </script> | ||||||
| @ -7,8 +7,8 @@ | |||||||
|       <b-dropdown-item-button @click="addToQueue()"> |       <b-dropdown-item-button @click="addToQueue()"> | ||||||
|         Add to queue |         Add to queue | ||||||
|       </b-dropdown-item-button> |       </b-dropdown-item-button> | ||||||
|       <b-dropdown-item-button @click="toggleStarred()"> |       <b-dropdown-item-button @click="toggleFavourite()"> | ||||||
|         {{ starred ? 'Unstar' : 'Star' }} |         {{ favourite ? 'Remove from favourites' : 'Add to favourites' }} | ||||||
|       </b-dropdown-item-button> |       </b-dropdown-item-button> | ||||||
|       <b-dropdown-item-button @click="download()"> |       <b-dropdown-item-button @click="download()"> | ||||||
|         Download |         Download | ||||||
| @ -26,16 +26,16 @@ | |||||||
|     }, |     }, | ||||||
|     data() { |     data() { | ||||||
|       return { |       return { | ||||||
|         starred: this.track.starred, |         favourite: this.track.favourite, | ||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     methods: { |     methods: { | ||||||
|       toggleStarred() { |       toggleFavourite() { | ||||||
|         this.starred = !this.starred |         this.favourite = !this.favourite | ||||||
|         if (this.starred) { |         if (this.favourite) { | ||||||
|           return this.$api.unstar('track', this.track.id) |           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() { |       download() { | ||||||
|         window.location.href = this.$api.getDownloadUrl(this.track.id) |         window.location.href = this.$api.getDownloadUrl(this.track.id) | ||||||
|  | |||||||
| @ -12,7 +12,7 @@ export interface Track { | |||||||
|   id: string |   id: string | ||||||
|   title: string |   title: string | ||||||
|   duration: number |   duration: number | ||||||
|   starred: boolean |   favourite: boolean | ||||||
|   image?: string |   image?: string | ||||||
|   url?: string |   url?: string | ||||||
|   track?: number |   track?: number | ||||||
| @ -28,7 +28,7 @@ export interface Album { | |||||||
|   artist: string |   artist: string | ||||||
|   artistId: string |   artistId: string | ||||||
|   year: number |   year: number | ||||||
|   starred: boolean |   favourite: boolean | ||||||
|   genreId?: string |   genreId?: string | ||||||
|   image?: string |   image?: string | ||||||
|   tracks?: Track[] |   tracks?: Track[] | ||||||
| @ -39,7 +39,7 @@ export interface Artist { | |||||||
|   name: string |   name: string | ||||||
|   albumCount: number |   albumCount: number | ||||||
|   description?: string |   description?: string | ||||||
|   starred: boolean |   favourite: boolean | ||||||
|   lastFmUrl?: string |   lastFmUrl?: string | ||||||
|   musicBrainzUrl?: string |   musicBrainzUrl?: string | ||||||
|   similarArtist?: Artist[] |   similarArtist?: Artist[] | ||||||
| @ -240,7 +240,7 @@ export class API { | |||||||
|     return (response.randomSongs?.song || []).map(this.normalizeTrack, this) |     return (response.randomSongs?.song || []).map(this.normalizeTrack, this) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async getStarred() { |   async getFavourites() { | ||||||
|     const response = await this.get('rest/getStarred2') |     const response = await this.get('rest/getStarred2') | ||||||
|     return { |     return { | ||||||
|       albums: (response.starred2?.album || []).map(this.normalizeAlbum, this), |       albums: (response.starred2?.album || []).map(this.normalizeAlbum, this), | ||||||
| @ -249,15 +249,7 @@ export class API { | |||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   starAlbum(id: string) { |   async addFavourite(type: 'track' | 'album' | 'artist', id: string) { | ||||||
|     return this.star('album', id) |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   unstarAlbum(id: string) { |  | ||||||
|     return this.unstar('album', id) |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   async star(type: 'track' | 'album' | 'artist', id: string) { |  | ||||||
|     const params = { |     const params = { | ||||||
|       id: type === 'track' ? id : undefined, |       id: type === 'track' ? id : undefined, | ||||||
|       albumId: type === 'album' ? id : undefined, |       albumId: type === 'album' ? id : undefined, | ||||||
| @ -266,7 +258,7 @@ export class API { | |||||||
|     await this.get('rest/star', params) |     await this.get('rest/star', params) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async unstar(type: 'track' | 'album' | 'artist', id: string) { |   async removeFavourite(type: 'track' | 'album' | 'artist', id: string) { | ||||||
|     const params = { |     const params = { | ||||||
|       id: type === 'track' ? id : undefined, |       id: type === 'track' ? id : undefined, | ||||||
|       albumId: type === 'album' ? id : undefined, |       albumId: type === 'album' ? id : undefined, | ||||||
| @ -349,7 +341,7 @@ export class API { | |||||||
|       track: item.track, |       track: item.track, | ||||||
|       url: item.streamUrl, |       url: item.streamUrl, | ||||||
|       duration: 0, |       duration: 0, | ||||||
|       starred: false, |       favourite: false, | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @ -358,7 +350,7 @@ export class API { | |||||||
|       id: item.id, |       id: item.id, | ||||||
|       title: item.title, |       title: item.title, | ||||||
|       duration: item.duration, |       duration: item.duration, | ||||||
|       starred: !!item.starred, |       favourite: !!item.starred, | ||||||
|       track: item.track, |       track: item.track, | ||||||
|       album: item.album, |       album: item.album, | ||||||
|       albumId: item.albumId, |       albumId: item.albumId, | ||||||
| @ -377,7 +369,7 @@ export class API { | |||||||
|       artistId: item.artistId, |       artistId: item.artistId, | ||||||
|       image: this.getCoverArtUrl(item), |       image: this.getCoverArtUrl(item), | ||||||
|       year: item.year || 0, |       year: item.year || 0, | ||||||
|       starred: !!item.starred, |       favourite: !!item.starred, | ||||||
|       genreId: item.genre, |       genreId: item.genre, | ||||||
|       tracks: (item.song || []).map(this.normalizeTrack, this) |       tracks: (item.song || []).map(this.normalizeTrack, this) | ||||||
|     } |     } | ||||||
| @ -392,7 +384,7 @@ export class API { | |||||||
|       id: item.id, |       id: item.id, | ||||||
|       name: item.name, |       name: item.name, | ||||||
|       description: (item.biography || '').replace(/<a[^>]*>.*?<\/a>/gm, ''), |       description: (item.biography || '').replace(/<a[^>]*>.*?<\/a>/gm, ''), | ||||||
|       starred: !!item.starred, |       favourite: !!item.starred, | ||||||
|       albumCount: item.albumCount, |       albumCount: item.albumCount, | ||||||
|       lastFmUrl: item.lastFmUrl, |       lastFmUrl: item.lastFmUrl, | ||||||
|       musicBrainzUrl: item.musicBrainzId |       musicBrainzUrl: item.musicBrainzId | ||||||
| @ -416,7 +408,7 @@ export class API { | |||||||
|         id: episode.id, |         id: episode.id, | ||||||
|         title: episode.title, |         title: episode.title, | ||||||
|         duration: episode.duration, |         duration: episode.duration, | ||||||
|         starred: false, |         favourite: false, | ||||||
|         track: podcast.episode.length - index, |         track: podcast.episode.length - index, | ||||||
|         album: podcast.title, |         album: podcast.title, | ||||||
|         albumId: null, |         albumId: null, | ||||||
|  | |||||||
| @ -11,8 +11,6 @@ | |||||||
|     BIconCardText, |     BIconCardText, | ||||||
|     BIconChevronCompactRight, |     BIconChevronCompactRight, | ||||||
|     BIconMusicNoteList, |     BIconMusicNoteList, | ||||||
|     BIconStar, |  | ||||||
|     BIconStarFill, |  | ||||||
|     BIconCollection, |     BIconCollection, | ||||||
|     BIconCollectionFill, |     BIconCollectionFill, | ||||||
|     BIconList, |     BIconList, | ||||||
| @ -29,6 +27,8 @@ | |||||||
|     BIconX, |     BIconX, | ||||||
|     BIconVolumeMuteFill, |     BIconVolumeMuteFill, | ||||||
|     BIconVolumeUpFill, |     BIconVolumeUpFill, | ||||||
|  |     BIconHeart, | ||||||
|  |     BIconHeartFill, | ||||||
|   } from 'bootstrap-vue' |   } from 'bootstrap-vue' | ||||||
| 
 | 
 | ||||||
|   export default Vue.extend({ |   export default Vue.extend({ | ||||||
| @ -40,8 +40,6 @@ | |||||||
|       BIconCardText, |       BIconCardText, | ||||||
|       BIconChevronCompactRight, |       BIconChevronCompactRight, | ||||||
|       BIconMusicNoteList, |       BIconMusicNoteList, | ||||||
|       BIconStar, |  | ||||||
|       BIconStarFill, |  | ||||||
|       BIconCollection, |       BIconCollection, | ||||||
|       BIconCollectionFill, |       BIconCollectionFill, | ||||||
|       BIconList, |       BIconList, | ||||||
| @ -58,6 +56,8 @@ | |||||||
|       BIconX, |       BIconX, | ||||||
|       BIconVolumeMuteFill, |       BIconVolumeMuteFill, | ||||||
|       BIconVolumeUpFill, |       BIconVolumeUpFill, | ||||||
|  |       BIconHeart, | ||||||
|  |       BIconHeartFill, | ||||||
|     }, |     }, | ||||||
|     props: { |     props: { | ||||||
|       icon: { type: String, required: true } |       icon: { type: String, required: true } | ||||||
|  | |||||||
| @ -8,7 +8,7 @@ import AlbumDetails from '@/library/album/AlbumDetails.vue' | |||||||
| import AlbumLibrary from '@/library/album/AlbumLibrary.vue' | import AlbumLibrary from '@/library/album/AlbumLibrary.vue' | ||||||
| import GenreDetails from '@/library/genre/GenreDetails.vue' | import GenreDetails from '@/library/genre/GenreDetails.vue' | ||||||
| import GenreLibrary from '@/library/genre/GenreLibrary.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 RadioStations from '@/library/radio/RadioStations.vue' | ||||||
| import PodcastDetails from '@/library/podcast/PodcastDetails.vue' | import PodcastDetails from '@/library/podcast/PodcastDetails.vue' | ||||||
| import PodcastLibrary from '@/library/podcast/PodcastLibrary.vue' | import PodcastLibrary from '@/library/podcast/PodcastLibrary.vue' | ||||||
| @ -87,9 +87,9 @@ export function setupRouter(auth: AuthService) { | |||||||
|         props: true, |         props: true, | ||||||
|       }, |       }, | ||||||
|       { |       { | ||||||
|         name: 'starred', |         name: 'favourites', | ||||||
|         path: '/starred/:section?', |         path: '/favourites/:section?', | ||||||
|         component: Starred, |         component: Favourites, | ||||||
|         props: true, |         props: true, | ||||||
|       }, |       }, | ||||||
|       { |       { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user