2020-10-04 11:31:47 -04:00
|
|
|
<template>
|
2022-05-29 12:49:00 -04:00
|
|
|
<div
|
|
|
|
v-for="(track, index) in tracks"
|
|
|
|
:id="'index_' + track.title_sort.charAt(0).toUpperCase()"
|
|
|
|
:key="track.id"
|
|
|
|
class="media"
|
|
|
|
:class="{ 'with-progress': show_progress }"
|
|
|
|
@click="play_track(index, track)"
|
|
|
|
>
|
2022-02-19 01:47:54 -05:00
|
|
|
<figure v-if="show_icon" class="media-left fd-has-action">
|
2022-06-15 13:24:51 -04:00
|
|
|
<span class="icon"><mdicon name="file-outline" size="16" /></span>
|
2022-02-19 01:47:54 -05:00
|
|
|
</figure>
|
|
|
|
<div class="media-content fd-has-action is-clipped">
|
2022-05-29 12:49:00 -04:00
|
|
|
<h1
|
|
|
|
class="title is-6"
|
|
|
|
:class="{
|
|
|
|
'has-text-grey':
|
|
|
|
track.media_kind === 'podcast' && track.play_count > 0
|
|
|
|
}"
|
|
|
|
v-text="track.title"
|
|
|
|
/>
|
2022-05-20 07:44:22 -04:00
|
|
|
<h2 class="subtitle is-7 has-text-grey" v-text="track.artist" />
|
|
|
|
<h2 class="subtitle is-7 has-text-grey" v-text="track.album" />
|
2022-05-29 12:49:00 -04:00
|
|
|
<progress-bar
|
|
|
|
v-if="show_progress"
|
|
|
|
:max="track.length_ms"
|
|
|
|
:value="track.seek_ms"
|
|
|
|
/>
|
2022-02-19 01:47:54 -05:00
|
|
|
</div>
|
|
|
|
<div class="media-right">
|
|
|
|
<a @click.prevent.stop="open_dialog(track)">
|
2022-06-15 13:24:51 -04:00
|
|
|
<span class="icon has-text-dark"
|
|
|
|
><mdicon name="dots-vertical" size="16"
|
|
|
|
/></span>
|
2022-02-19 01:47:54 -05:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<teleport to="#app">
|
2022-05-29 12:49:00 -04:00
|
|
|
<modal-dialog-track
|
|
|
|
:show="show_details_modal"
|
|
|
|
:track="selected_track"
|
|
|
|
@close="show_details_modal = false"
|
|
|
|
@play-count-changed="$emit('play-count-changed')"
|
|
|
|
/>
|
2022-02-19 01:47:54 -05:00
|
|
|
</teleport>
|
2020-10-04 11:31:47 -04:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-02-19 00:18:01 -05:00
|
|
|
import ModalDialogTrack from '@/components/ModalDialogTrack.vue'
|
2022-02-19 01:47:54 -05:00
|
|
|
import ProgressBar from '@/components/ProgressBar.vue'
|
2020-10-04 11:31:47 -04:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'ListTracks',
|
2022-02-19 01:47:54 -05:00
|
|
|
components: { ModalDialogTrack, ProgressBar },
|
2020-10-04 11:31:47 -04:00
|
|
|
|
2022-02-19 01:47:54 -05:00
|
|
|
props: ['tracks', 'uris', 'expression', 'show_progress', 'show_icon'],
|
|
|
|
emits: ['play-count-changed'],
|
2020-10-04 11:31:47 -04:00
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
data() {
|
2020-10-04 11:31:47 -04:00
|
|
|
return {
|
|
|
|
show_details_modal: false,
|
|
|
|
selected_track: {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
play_track: function (position, track) {
|
|
|
|
if (this.uris) {
|
|
|
|
webapi.player_play_uri(this.uris, false, position)
|
|
|
|
} else if (this.expression) {
|
|
|
|
webapi.player_play_expression(this.expression, false, position)
|
|
|
|
} else {
|
|
|
|
webapi.player_play_uri(track.uri, false)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
open_dialog: function (track) {
|
|
|
|
this.selected_track = track
|
|
|
|
this.show_details_modal = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2022-02-19 00:39:14 -05:00
|
|
|
<style></style>
|