2018-08-11 07:47:10 +02:00
|
|
|
<template>
|
2022-02-19 06:18:01 +01:00
|
|
|
<div class="fd-page-with-tabs">
|
2022-02-19 06:39:14 +01:00
|
|
|
<tabs-music />
|
2018-08-11 07:47:10 +02:00
|
|
|
<content-with-heading>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-left>
|
2018-08-11 07:47:10 +02:00
|
|
|
<p class="title is-4">Featured Playlists</p>
|
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-05-29 18:49:00 +02:00
|
|
|
<spotify-list-item-playlist
|
|
|
|
v-for="playlist in featured_playlists"
|
|
|
|
:key="playlist.id"
|
|
|
|
:playlist="playlist"
|
|
|
|
>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #actions>
|
2022-05-29 18:49:00 +02:00
|
|
|
<a @click.prevent.stop="open_playlist_dialog(playlist)">
|
2022-06-15 19:24:51 +02:00
|
|
|
<span class="icon has-text-dark"
|
|
|
|
><mdicon name="dots-vertical" size="16"
|
|
|
|
/></span>
|
2018-12-17 11:52:09 +01:00
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
</spotify-list-item-playlist>
|
2022-05-29 18:49:00 +02:00
|
|
|
<spotify-modal-dialog-playlist
|
|
|
|
:show="show_playlist_details_modal"
|
|
|
|
:playlist="selected_playlist"
|
|
|
|
@close="show_playlist_details_modal = false"
|
|
|
|
/>
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
|
|
|
</content-with-heading>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 06:18:01 +01:00
|
|
|
import ContentWithHeading from '@/templates/ContentWithHeading.vue'
|
|
|
|
import TabsMusic from '@/components/TabsMusic.vue'
|
|
|
|
import SpotifyListItemPlaylist from '@/components/SpotifyListItemPlaylist.vue'
|
|
|
|
import SpotifyModalDialogPlaylist from '@/components/SpotifyModalDialogPlaylist.vue'
|
2018-08-11 07:47:10 +02:00
|
|
|
import store from '@/store'
|
|
|
|
import * as types from '@/store/mutation_types'
|
|
|
|
import SpotifyWebApi from 'spotify-web-api-js'
|
|
|
|
|
2022-02-19 06:18:01 +01:00
|
|
|
const dataObject = {
|
2018-08-11 07:47:10 +02:00
|
|
|
load: function (to) {
|
|
|
|
if (store.state.spotify_featured_playlists.length > 0) {
|
|
|
|
return Promise.resolve()
|
|
|
|
}
|
|
|
|
|
|
|
|
const spotifyApi = new SpotifyWebApi()
|
|
|
|
spotifyApi.setAccessToken(store.state.spotify.webapi_token)
|
2022-02-19 06:39:14 +01:00
|
|
|
spotifyApi.getFeaturedPlaylists({
|
|
|
|
country: store.state.spotify.webapi_country,
|
|
|
|
limit: 50
|
|
|
|
})
|
2018-08-11 07:47:10 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
set: function (vm, response) {
|
|
|
|
if (response) {
|
|
|
|
store.commit(types.SPOTIFY_FEATURED_PLAYLISTS, response.playlists.items)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'SpotifyPageBrowseFeaturedPlaylists',
|
2022-02-19 06:39:14 +01:00
|
|
|
components: {
|
|
|
|
ContentWithHeading,
|
|
|
|
TabsMusic,
|
|
|
|
SpotifyListItemPlaylist,
|
|
|
|
SpotifyModalDialogPlaylist
|
|
|
|
},
|
|
|
|
|
|
|
|
beforeRouteEnter(to, from, next) {
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
next((vm) => dataObject.set(vm, response))
|
|
|
|
})
|
|
|
|
},
|
|
|
|
beforeRouteUpdate(to, from, next) {
|
|
|
|
const vm = this
|
|
|
|
dataObject.load(to).then((response) => {
|
|
|
|
dataObject.set(vm, response)
|
|
|
|
next()
|
|
|
|
})
|
|
|
|
},
|
2018-12-17 11:52:09 +01:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
data() {
|
2018-12-17 11:52:09 +01:00
|
|
|
return {
|
|
|
|
show_playlist_details_modal: false,
|
|
|
|
selected_playlist: {}
|
|
|
|
}
|
|
|
|
},
|
2018-08-11 07:47:10 +02:00
|
|
|
|
|
|
|
computed: {
|
2022-02-19 06:39:14 +01:00
|
|
|
featured_playlists() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return this.$store.state.spotify_featured_playlists
|
|
|
|
}
|
2018-12-17 11:52:09 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
open_playlist_dialog: function (playlist) {
|
|
|
|
this.selected_playlist = playlist
|
|
|
|
this.show_playlist_details_modal = true
|
|
|
|
}
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|