2018-08-11 07:47:10 +02:00
|
|
|
<template>
|
2020-05-16 07:01:42 +02:00
|
|
|
<content-with-hero>
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-left>
|
|
|
|
<h1 class="title is-5">
|
|
|
|
{{ album.name }}
|
|
|
|
</h1>
|
|
|
|
<h2 class="subtitle is-6 has-text-link has-text-weight-normal">
|
|
|
|
<a class="has-text-link" @click="open_artist">{{
|
|
|
|
album.artists[0].name
|
|
|
|
}}</a>
|
|
|
|
</h2>
|
2020-05-16 07:01:42 +02:00
|
|
|
|
|
|
|
<div class="buttons fd-is-centered-mobile fd-has-margin-top">
|
2019-02-20 09:22:17 +01:00
|
|
|
<a class="button is-small is-dark is-rounded" @click="play">
|
2022-02-19 06:39:14 +01:00
|
|
|
<span class="icon"><i class="mdi mdi-shuffle" /></span>
|
|
|
|
<span>Shuffle</span>
|
2019-02-20 09:22:17 +01:00
|
|
|
</a>
|
2022-02-19 06:39:14 +01:00
|
|
|
<a
|
|
|
|
class="button is-small is-light is-rounded"
|
|
|
|
@click="show_album_details_modal = true"
|
|
|
|
>
|
|
|
|
<span class="icon"
|
|
|
|
><i class="mdi mdi-dots-horizontal mdi-18px"
|
|
|
|
/></span>
|
2020-05-16 07:01:42 +02:00
|
|
|
</a>
|
2019-02-20 09:22:17 +01:00
|
|
|
</div>
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2020-06-30 08:43:06 +02:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #heading-right>
|
2020-06-30 08:43:06 +02:00
|
|
|
<p class="image is-square fd-has-shadow fd-has-action">
|
2020-05-16 07:01:42 +02:00
|
|
|
<cover-artwork
|
|
|
|
:artwork_url="artwork_url"
|
|
|
|
:artist="album.artist"
|
2020-06-30 08:43:06 +02:00
|
|
|
:album="album.name"
|
2022-02-19 06:39:14 +01:00
|
|
|
@click="show_album_details_modal = true"
|
|
|
|
/>
|
2020-05-16 07:01:42 +02:00
|
|
|
</p>
|
|
|
|
</template>
|
2020-06-30 08:43:06 +02:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<template #content>
|
|
|
|
<p class="heading is-7 has-text-centered-mobile fd-has-margin-top">
|
|
|
|
{{ album.tracks.total }} tracks
|
|
|
|
</p>
|
|
|
|
<spotify-list-item-track
|
|
|
|
v-for="(track, index) in album.tracks.items"
|
|
|
|
:key="track.id"
|
|
|
|
:track="track"
|
|
|
|
:position="index"
|
|
|
|
:album="album"
|
|
|
|
:context_uri="album.uri"
|
|
|
|
>
|
|
|
|
<template #actions>
|
2018-12-17 11:52:09 +01:00
|
|
|
<a @click="open_track_dialog(track)">
|
2022-02-19 06:39:14 +01:00
|
|
|
<span class="icon has-text-dark"
|
|
|
|
><i class="mdi mdi-dots-vertical mdi-18px"
|
|
|
|
/></span>
|
2018-12-17 11:52:09 +01:00
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
</spotify-list-item-track>
|
2022-02-19 06:39:14 +01:00
|
|
|
<spotify-modal-dialog-track
|
|
|
|
:show="show_track_details_modal"
|
|
|
|
:track="selected_track"
|
|
|
|
:album="album"
|
|
|
|
@close="show_track_details_modal = false"
|
|
|
|
/>
|
|
|
|
<spotify-modal-dialog-album
|
|
|
|
:show="show_album_details_modal"
|
|
|
|
:album="album"
|
|
|
|
@close="show_album_details_modal = false"
|
|
|
|
/>
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
2020-05-16 07:01:42 +02:00
|
|
|
</content-with-hero>
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 06:18:01 +01:00
|
|
|
import ContentWithHero from '@/templates/ContentWithHero.vue'
|
|
|
|
import SpotifyListItemTrack from '@/components/SpotifyListItemTrack.vue'
|
|
|
|
import SpotifyModalDialogTrack from '@/components/SpotifyModalDialogTrack.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 webapi from '@/webapi'
|
|
|
|
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) {
|
|
|
|
const spotifyApi = new SpotifyWebApi()
|
|
|
|
spotifyApi.setAccessToken(store.state.spotify.webapi_token)
|
2022-02-19 06:39:14 +01:00
|
|
|
return spotifyApi.getAlbum(to.params.album_id, {
|
|
|
|
market: store.state.spotify.webapi_country
|
|
|
|
})
|
2018-08-11 07:47:10 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
set: function (vm, response) {
|
|
|
|
vm.album = response
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'PageAlbum',
|
2022-02-19 06:39:14 +01:00
|
|
|
components: {
|
|
|
|
ContentWithHero,
|
|
|
|
SpotifyListItemTrack,
|
|
|
|
SpotifyModalDialogTrack,
|
|
|
|
SpotifyModalDialogAlbum,
|
|
|
|
CoverArtwork
|
|
|
|
},
|
2018-08-11 07:47:10 +02:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
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()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
data() {
|
2018-08-11 07:47:10 +02:00
|
|
|
return {
|
2018-12-17 11:52:09 +01:00
|
|
|
album: { artists: [{}], tracks: {} },
|
|
|
|
|
|
|
|
show_track_details_modal: false,
|
2019-02-20 09:22:17 +01:00
|
|
|
selected_track: {},
|
|
|
|
|
|
|
|
show_album_details_modal: false
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2020-05-16 07:01:42 +02:00
|
|
|
computed: {
|
|
|
|
artwork_url: function () {
|
|
|
|
if (this.album.images && this.album.images.length > 0) {
|
|
|
|
return this.album.images[0].url
|
|
|
|
}
|
|
|
|
return ''
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
2018-08-11 07:47:10 +02:00
|
|
|
methods: {
|
|
|
|
open_artist: function () {
|
2022-02-19 06:39:14 +01:00
|
|
|
this.$router.push({
|
|
|
|
path: '/music/spotify/artists/' + this.album.artists[0].id
|
|
|
|
})
|
2018-08-11 07:47:10 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
play: function () {
|
|
|
|
this.show_details_modal = false
|
2018-11-06 21:44:01 +01:00
|
|
|
webapi.player_play_uri(this.album.uri, true)
|
2018-12-17 11:52:09 +01:00
|
|
|
},
|
|
|
|
|
|
|
|
open_track_dialog: function (track) {
|
|
|
|
this.selected_track = track
|
|
|
|
this.show_track_details_modal = true
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|