owntone-server/web-src/src/components/ModalDialogTrackSpotify.vue
2025-02-13 21:02:13 +01:00

71 lines
1.7 KiB
Vue

<template>
<modal-dialog-playable
:item="playable"
:show="show"
@close="$emit('close')"
/>
</template>
<script>
import ModalDialogPlayable from '@/components/ModalDialogPlayable.vue'
export default {
name: 'ModalDialogTrackSpotify',
components: { ModalDialogPlayable },
props: { item: { required: true, type: Object }, show: Boolean },
emits: ['close'],
computed: {
playable() {
if (!this.item.artists) {
return {}
}
return {
name: this.item.name,
uri: this.item.uri,
properties: [
{
label: 'property.album',
value: this.item.album.name,
handler: this.open_album
},
{
label: 'property.album-artist',
value: this.item.artists[0]?.name,
handler: this.open_artist
},
{
label: 'property.release-date',
value: this.$filters.date(this.item.album.release_date)
},
{
label: 'property.position',
value: [this.item.disc_number, this.item.track_number].join(' / ')
},
{
label: 'property.duration',
value: this.$filters.durationInHours(this.item.duration_ms)
},
{ label: 'property.path', value: this.item.uri }
]
}
}
},
methods: {
open_album() {
this.$emit('close')
this.$router.push({
name: 'music-spotify-album',
params: { id: this.item.album.id }
})
},
open_artist() {
this.$emit('close')
this.$router.push({
name: 'music-spotify-artist',
params: { id: this.item.artists[0].id }
})
}
}
}
</script>