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">New Releases</p>
|
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
2022-05-29 18:49:00 +02:00
|
|
|
<spotify-list-item-album
|
|
|
|
v-for="album in new_releases"
|
|
|
|
:key="album.id"
|
|
|
|
:album="album"
|
|
|
|
@click="open_album(album)"
|
|
|
|
>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template v-if="is_visible_artwork" #artwork>
|
2023-06-07 16:11:40 +02:00
|
|
|
<cover-artwork
|
|
|
|
:artwork_url="artwork_url(album)"
|
|
|
|
:artist="album.artist"
|
|
|
|
:album="album.name"
|
|
|
|
class="fd-has-action fd-has-shadow fd-cover fd-cover-small-image"
|
|
|
|
:maxwidth="64"
|
|
|
|
:maxheight="64"
|
|
|
|
/>
|
2020-08-02 07:33:17 +02:00
|
|
|
</template>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #actions>
|
2022-04-02 19:05:41 +02:00
|
|
|
<a @click.prevent.stop="open_album_dialog(album)">
|
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-album>
|
2022-05-29 18:49:00 +02:00
|
|
|
<spotify-modal-dialog-album
|
|
|
|
:show="show_album_details_modal"
|
|
|
|
:album="selected_album"
|
|
|
|
@close="show_album_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 SpotifyListItemAlbum from '@/components/SpotifyListItemAlbum.vue'
|
|
|
|
import SpotifyModalDialogAlbum from '@/components/SpotifyModalDialogAlbum.vue'
|
|
|
|
import CoverArtwork from '@/components/CoverArtwork.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_new_releases.length > 0) {
|
|
|
|
return Promise.resolve()
|
|
|
|
}
|
|
|
|
|
|
|
|
const spotifyApi = new SpotifyWebApi()
|
|
|
|
spotifyApi.setAccessToken(store.state.spotify.webapi_token)
|
2022-02-19 06:39:14 +01:00
|
|
|
return spotifyApi.getNewReleases({
|
|
|
|
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_NEW_RELEASES, response.albums.items)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'SpotifyPageBrowseNewReleases',
|
2022-02-19 06:39:14 +01:00
|
|
|
components: {
|
|
|
|
ContentWithHeading,
|
|
|
|
TabsMusic,
|
|
|
|
SpotifyListItemAlbum,
|
|
|
|
SpotifyModalDialogAlbum,
|
|
|
|
CoverArtwork
|
|
|
|
},
|
|
|
|
|
|
|
|
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_album_details_modal: false,
|
|
|
|
selected_album: {}
|
|
|
|
}
|
|
|
|
},
|
2018-08-11 07:47:10 +02:00
|
|
|
|
|
|
|
computed: {
|
2022-02-19 06:39:14 +01:00
|
|
|
new_releases() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return this.$store.state.spotify_new_releases
|
2020-08-23 19:26:54 +02:00
|
|
|
},
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
is_visible_artwork() {
|
|
|
|
return this.$store.getters.settings_option(
|
|
|
|
'webinterface',
|
|
|
|
'show_cover_artwork_in_album_lists'
|
|
|
|
).value
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
2018-12-17 11:52:09 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
open_album: function (album) {
|
2020-08-02 07:33:17 +02:00
|
|
|
this.$router.push({ path: '/music/spotify/albums/' + album.id })
|
|
|
|
},
|
|
|
|
|
|
|
|
open_album_dialog: function (album) {
|
2018-12-17 11:52:09 +01:00
|
|
|
this.selected_album = album
|
|
|
|
this.show_album_details_modal = true
|
2020-08-02 07:33:17 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
artwork_url: function (album) {
|
|
|
|
if (album.images && album.images.length > 0) {
|
|
|
|
return album.images[0].url
|
|
|
|
}
|
|
|
|
return ''
|
2018-12-17 11:52:09 +01:00
|
|
|
}
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|