2018-08-11 07:47:10 +02:00
|
|
|
<template>
|
2024-03-25 21:54:01 +01:00
|
|
|
<template v-for="item in items" :key="item.id">
|
|
|
|
<div class="media is-align-items-center">
|
|
|
|
<div
|
|
|
|
class="media-content is-clipped"
|
2022-05-29 18:49:00 +02:00
|
|
|
:class="{
|
2024-03-25 21:54:01 +01:00
|
|
|
'is-clickable': item.is_playable,
|
|
|
|
'fd-is-not-allowed': !item.is_playable
|
2022-05-29 18:49:00 +02:00
|
|
|
}"
|
2024-03-25 21:54:01 +01:00
|
|
|
@click="play(item)"
|
|
|
|
>
|
|
|
|
<h1
|
|
|
|
class="title is-6"
|
|
|
|
:class="{ 'has-text-grey-light': !item.is_playable }"
|
|
|
|
v-text="item.name"
|
|
|
|
/>
|
|
|
|
<h2
|
|
|
|
class="subtitle is-7 has-text-weight-bold"
|
|
|
|
:class="{
|
|
|
|
'has-text-grey': item.is_playable,
|
|
|
|
'has-text-grey-light': !item.is_playable
|
|
|
|
}"
|
|
|
|
v-text="item.artists[0].name"
|
|
|
|
/>
|
|
|
|
<h2 class="subtitle is-7 has-text-grey" v-text="item.album.name" />
|
|
|
|
<h2 v-if="!item.is_playable" class="subtitle is-7">
|
|
|
|
(<span v-text="$t('list.spotify.not-playable-track')" />
|
|
|
|
<span
|
|
|
|
v-if="item.restrictions && item.restrictions.reason"
|
|
|
|
v-text="
|
|
|
|
$t('list.spotify.restriction-reason', {
|
|
|
|
reason: item.restrictions.reason
|
|
|
|
})
|
|
|
|
"
|
|
|
|
/>)
|
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
<div class="media-right">
|
|
|
|
<a @click.prevent.stop="open_dialog(item)">
|
|
|
|
<mdicon class="icon has-text-dark" name="dots-vertical" size="16" />
|
|
|
|
</a>
|
|
|
|
</div>
|
2018-08-11 07:47:10 +02:00
|
|
|
</div>
|
2024-03-25 21:54:01 +01:00
|
|
|
</template>
|
2024-03-25 14:00:42 +01:00
|
|
|
<teleport to="#app">
|
|
|
|
<modal-dialog-track-spotify
|
|
|
|
:show="show_details_modal"
|
2024-03-25 21:54:01 +01:00
|
|
|
:track="selected_item"
|
2024-03-25 14:00:42 +01:00
|
|
|
@close="show_details_modal = false"
|
|
|
|
/>
|
|
|
|
</teleport>
|
2018-08-11 07:47:10 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2024-03-25 14:00:42 +01:00
|
|
|
import ModalDialogTrackSpotify from '@/components/ModalDialogTrackSpotify.vue'
|
2018-08-11 07:47:10 +02:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
export default {
|
2024-03-26 00:59:15 +01:00
|
|
|
name: 'ListTracksSpotify',
|
2024-03-25 14:00:42 +01:00
|
|
|
components: { ModalDialogTrackSpotify },
|
2024-02-28 13:10:08 +01:00
|
|
|
props: {
|
2024-03-25 15:25:00 +01:00
|
|
|
context_uri: { default: '', type: String },
|
2024-03-25 21:54:01 +01:00
|
|
|
items: { required: true, type: Object }
|
2024-02-28 13:10:08 +01:00
|
|
|
},
|
2024-03-25 14:00:42 +01:00
|
|
|
data() {
|
2024-03-25 21:54:01 +01:00
|
|
|
return { selected_item: {}, show_details_modal: false }
|
2024-03-25 14:00:42 +01:00
|
|
|
},
|
2018-08-11 07:47:10 +02:00
|
|
|
methods: {
|
2024-03-25 21:54:01 +01:00
|
|
|
open_dialog(item) {
|
|
|
|
this.selected_item = item
|
|
|
|
this.show_details_modal = true
|
|
|
|
},
|
|
|
|
play(item) {
|
|
|
|
if (item.is_playable) {
|
2024-03-25 15:25:00 +01:00
|
|
|
webapi.player_play_uri(
|
2024-03-25 21:54:01 +01:00
|
|
|
this.context_uri || item.uri,
|
2024-03-25 15:25:00 +01:00
|
|
|
false,
|
2024-03-25 21:54:01 +01:00
|
|
|
item.position || 0
|
2024-03-25 15:25:00 +01:00
|
|
|
)
|
2023-06-10 18:25:12 +02:00
|
|
|
}
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
<style></style>
|