diff --git a/web-src/src/pages/PageSearchSpotify.vue b/web-src/src/pages/PageSearchSpotify.vue index 7e30502b..8e9c8fd9 100644 --- a/web-src/src/pages/PageSearchSpotify.vue +++ b/web-src/src/pages/PageSearchSpotify.vue @@ -35,7 +35,7 @@ - + @@ -78,11 +78,11 @@ /> - + + - + @@ -139,11 +139,11 @@ /> - + + - + @@ -209,11 +209,11 @@ /> - + + - + @@ -270,11 +270,11 @@ /> - + + @@ -362,32 +362,6 @@ export default { return this.$store.state.recent_searches.filter( (search) => !search.startsWith('query:') ) - }, - show_albums() { - return this.$route.query.type && this.$route.query.type.includes('album') - }, - show_all_albums_button() { - return this.albums.total > this.albums.items.length - }, - show_all_artists_button() { - return this.artists.total > this.artists.items.length - }, - show_all_playlists_button() { - return this.playlists.total > this.playlists.items.length - }, - show_all_tracks_button() { - return this.tracks.total > this.tracks.items.length - }, - show_artists() { - return this.$route.query.type && this.$route.query.type.includes('artist') - }, - show_playlists() { - return ( - this.$route.query.type && this.$route.query.type.includes('playlist') - ) - }, - show_tracks() { - return this.$route.query.type && this.$route.query.type.includes('track') } }, @@ -444,39 +418,12 @@ export default { this.search_query = query this.new_search() }, - open_search_albums() { + open_search(type) { this.$router.push({ name: 'search-spotify', query: { query: this.$route.query.query, - type: 'album' - } - }) - }, - open_search_artists() { - this.$router.push({ - name: 'search-spotify', - query: { - query: this.$route.query.query, - type: 'artist' - } - }) - }, - open_search_playlists() { - this.$router.push({ - name: 'search-spotify', - query: { - query: this.$route.query.query, - type: 'playlist' - } - }) - }, - open_search_tracks() { - this.$router.push({ - name: 'search-spotify', - query: { - query: this.$route.query.query, - type: 'track' + type: type } }) }, @@ -550,6 +497,12 @@ export default { loaded(data.tracks.items.length, PAGE_SIZE) }) }, + show(type) { + return this.$route.query.type?.includes(type) ?? false + }, + show_all_button(items) { + return items.total > items.items.length + }, spotify_search() { return webapi.spotify().then(({ data }) => { this.search_param.market = data.webapi_country
+ - + @@ -139,11 +139,11 @@ />
+ - + @@ -209,11 +209,11 @@ />
+ - + @@ -270,11 +270,11 @@ />
+ @@ -362,32 +362,6 @@ export default { return this.$store.state.recent_searches.filter( (search) => !search.startsWith('query:') ) - }, - show_albums() { - return this.$route.query.type && this.$route.query.type.includes('album') - }, - show_all_albums_button() { - return this.albums.total > this.albums.items.length - }, - show_all_artists_button() { - return this.artists.total > this.artists.items.length - }, - show_all_playlists_button() { - return this.playlists.total > this.playlists.items.length - }, - show_all_tracks_button() { - return this.tracks.total > this.tracks.items.length - }, - show_artists() { - return this.$route.query.type && this.$route.query.type.includes('artist') - }, - show_playlists() { - return ( - this.$route.query.type && this.$route.query.type.includes('playlist') - ) - }, - show_tracks() { - return this.$route.query.type && this.$route.query.type.includes('track') } }, @@ -444,39 +418,12 @@ export default { this.search_query = query this.new_search() }, - open_search_albums() { + open_search(type) { this.$router.push({ name: 'search-spotify', query: { query: this.$route.query.query, - type: 'album' - } - }) - }, - open_search_artists() { - this.$router.push({ - name: 'search-spotify', - query: { - query: this.$route.query.query, - type: 'artist' - } - }) - }, - open_search_playlists() { - this.$router.push({ - name: 'search-spotify', - query: { - query: this.$route.query.query, - type: 'playlist' - } - }) - }, - open_search_tracks() { - this.$router.push({ - name: 'search-spotify', - query: { - query: this.$route.query.query, - type: 'track' + type: type } }) }, @@ -550,6 +497,12 @@ export default { loaded(data.tracks.items.length, PAGE_SIZE) }) }, + show(type) { + return this.$route.query.type?.includes(type) ?? false + }, + show_all_button(items) { + return items.total > items.items.length + }, spotify_search() { return webapi.spotify().then(({ data }) => { this.search_param.market = data.webapi_country