2020-10-04 17:31:47 +02:00
|
|
|
<template>
|
2024-03-26 03:13:17 +01:00
|
|
|
<template v-for="item in items" :key="item.itemId">
|
|
|
|
<div v-if="!item.isItem" class="mt-6 mb-5 py-2">
|
2023-03-23 23:19:55 +01:00
|
|
|
<span
|
2024-03-26 03:34:50 +01:00
|
|
|
:id="`index_${item.index}`"
|
2023-03-23 23:19:55 +01:00
|
|
|
class="tag is-info is-light is-small has-text-weight-bold"
|
2024-03-26 03:13:17 +01:00
|
|
|
v-text="item.index"
|
2022-05-29 18:49:00 +02:00
|
|
|
/>
|
2022-02-19 07:47:54 +01:00
|
|
|
</div>
|
2023-03-23 23:19:55 +01:00
|
|
|
<div
|
2023-07-26 08:07:51 +02:00
|
|
|
v-else
|
2023-07-01 09:09:16 +02:00
|
|
|
class="media is-align-items-center"
|
2023-03-23 23:19:55 +01:00
|
|
|
:class="{ 'with-progress': show_progress }"
|
2024-03-26 03:13:17 +01:00
|
|
|
@click="play(item.item)"
|
2023-03-23 23:19:55 +01:00
|
|
|
>
|
2023-06-10 19:22:29 +02:00
|
|
|
<figure v-if="show_icon" class="media-left is-clickable">
|
2023-06-30 21:41:40 +02:00
|
|
|
<mdicon class="icon" name="file-outline" size="16" />
|
2023-03-23 23:19:55 +01:00
|
|
|
</figure>
|
2023-06-10 19:22:29 +02:00
|
|
|
<div class="media-content is-clickable is-clipped">
|
2023-03-23 23:19:55 +01:00
|
|
|
<h1
|
|
|
|
class="title is-6"
|
|
|
|
:class="{
|
|
|
|
'has-text-grey':
|
2024-03-26 03:13:17 +01:00
|
|
|
item.item.media_kind === 'podcast' && item.item.play_count > 0
|
2023-03-23 23:19:55 +01:00
|
|
|
}"
|
2024-03-26 03:13:17 +01:00
|
|
|
v-text="item.item.title"
|
2023-03-23 23:19:55 +01:00
|
|
|
/>
|
2023-12-09 10:49:15 +01:00
|
|
|
<h2
|
|
|
|
class="subtitle is-7 has-text-grey has-text-weight-bold"
|
2024-03-26 03:13:17 +01:00
|
|
|
v-text="item.item.artist"
|
2023-12-09 10:49:15 +01:00
|
|
|
/>
|
2024-03-26 03:13:17 +01:00
|
|
|
<h2 class="subtitle is-7 has-text-grey" v-text="item.item.album" />
|
2024-01-28 20:27:56 +01:00
|
|
|
<progress
|
2024-03-26 03:13:17 +01:00
|
|
|
v-if="show_progress && item.item.seek_ms > 0"
|
2024-01-28 20:27:56 +01:00
|
|
|
class="progress is-info"
|
2024-03-26 03:13:17 +01:00
|
|
|
:max="item.item.length_ms"
|
|
|
|
:value="item.item.seek_ms"
|
2023-03-23 23:19:55 +01:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<div class="media-right">
|
2024-03-26 03:13:17 +01:00
|
|
|
<a @click.prevent.stop="open_dialog(item.item)">
|
2023-06-30 21:41:40 +02:00
|
|
|
<mdicon class="icon has-text-dark" name="dots-vertical" size="16" />
|
2023-03-23 23:19:55 +01:00
|
|
|
</a>
|
|
|
|
</div>
|
2022-02-19 07:47:54 +01:00
|
|
|
</div>
|
2023-03-23 23:19:55 +01:00
|
|
|
</template>
|
2022-02-19 07:47:54 +01:00
|
|
|
<teleport to="#app">
|
2022-05-29 18:49:00 +02:00
|
|
|
<modal-dialog-track
|
2024-03-26 03:13:17 +01:00
|
|
|
:item="selected_item"
|
2022-05-29 18:49:00 +02:00
|
|
|
:show="show_details_modal"
|
|
|
|
@close="show_details_modal = false"
|
|
|
|
@play-count-changed="$emit('play-count-changed')"
|
|
|
|
/>
|
2022-02-19 07:47:54 +01:00
|
|
|
</teleport>
|
2020-10-04 17:31:47 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 06:18:01 +01:00
|
|
|
import ModalDialogTrack from '@/components/ModalDialogTrack.vue'
|
2020-10-04 17:31:47 +02:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'ListTracks',
|
2024-01-28 20:27:56 +01:00
|
|
|
components: { ModalDialogTrack },
|
2024-02-27 17:18:58 +01:00
|
|
|
props: {
|
2024-02-28 13:10:08 +01:00
|
|
|
expression: { default: '', type: String },
|
2024-03-23 23:46:47 +01:00
|
|
|
items: { required: true, type: Object },
|
2024-02-28 13:10:08 +01:00
|
|
|
show_icon: Boolean,
|
2024-02-27 17:18:58 +01:00
|
|
|
show_progress: Boolean,
|
2024-02-28 13:10:08 +01:00
|
|
|
uris: { default: '', type: String }
|
2024-02-27 17:18:58 +01:00
|
|
|
},
|
2022-02-19 07:47:54 +01:00
|
|
|
emits: ['play-count-changed'],
|
2020-10-04 17:31:47 +02:00
|
|
|
|
2022-02-19 06:39:14 +01:00
|
|
|
data() {
|
2020-10-04 17:31:47 +02:00
|
|
|
return {
|
2024-03-26 03:13:17 +01:00
|
|
|
selected_item: {},
|
2024-03-23 23:46:47 +01:00
|
|
|
show_details_modal: false
|
2020-10-04 17:31:47 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2024-03-26 03:13:17 +01:00
|
|
|
open_dialog(item) {
|
|
|
|
this.selected_item = item
|
2024-03-23 01:53:25 +01:00
|
|
|
this.show_details_modal = true
|
|
|
|
},
|
2024-03-26 03:13:17 +01:00
|
|
|
play(item) {
|
2020-10-04 17:31:47 +02:00
|
|
|
if (this.uris) {
|
2024-03-26 03:13:17 +01:00
|
|
|
webapi.player_play_uri(this.uris, false, this.items.items.indexOf(item))
|
2020-10-04 17:31:47 +02:00
|
|
|
} else if (this.expression) {
|
2023-07-26 16:04:12 +02:00
|
|
|
webapi.player_play_expression(
|
|
|
|
this.expression,
|
|
|
|
false,
|
2024-03-26 03:13:17 +01:00
|
|
|
this.items.items.indexOf(item)
|
2023-07-26 16:04:12 +02:00
|
|
|
)
|
2020-10-04 17:31:47 +02:00
|
|
|
} else {
|
2024-03-26 03:13:17 +01:00
|
|
|
webapi.player_play_uri(item.uri, false)
|
2020-10-04 17:31:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2024-01-28 20:27:56 +01:00
|
|
|
<style scoped>
|
|
|
|
.progress {
|
|
|
|
height: 0.25rem;
|
|
|
|
}
|
|
|
|
</style>
|