owntone-server/web-src/src/components/ModalDialogPlaylist.vue

92 lines
2.2 KiB
Vue
Raw Normal View History

<template>
2025-02-09 08:05:03 +01:00
<modal-dialog :actions="actions" :show="show" @close="$emit('close')">
<template #content>
<div class="title is-4">
<a @click="open" v-text="item.name" />
</div>
<div class="mb-3">
<div
class="is-size-7 is-uppercase"
v-text="$t('dialog.playlist.path')"
/>
<div class="title is-6" v-text="item.path" />
</div>
<div class="mb-3">
<div
class="is-size-7 is-uppercase"
v-text="$t('dialog.playlist.type')"
/>
<div class="title is-6" v-text="$t(`playlist.type.${item.type}`)" />
</div>
<div v-if="!item.folder" class="mb-3">
<div
class="is-size-7 is-uppercase"
v-text="$t('dialog.playlist.tracks')"
/>
<div class="title is-6" v-text="item.item_count" />
</div>
</template>
2025-02-08 14:35:25 +01:00
</modal-dialog>
</template>
<script>
2025-02-08 14:35:25 +01:00
import ModalDialog from '@/components/ModalDialog.vue'
import webapi from '@/webapi'
export default {
name: 'ModalDialogPlaylist',
2025-02-08 14:35:25 +01:00
components: { ModalDialog },
2024-02-28 13:10:08 +01:00
props: {
2024-03-26 03:13:17 +01:00
item: { required: true, type: Object },
2024-02-28 13:10:08 +01:00
show: Boolean,
uris: { default: '', type: String }
},
2022-02-19 07:05:59 +01:00
emits: ['close'],
computed: {
actions() {
if (!this.item.folder) {
return [
{
label: this.$t('dialog.playlist.add'),
2025-02-09 08:05:03 +01:00
handler: this.queue_add,
icon: 'playlist-plus'
},
{
label: this.$t('dialog.playlist.add-next'),
2025-02-09 08:05:03 +01:00
handler: this.queue_add_next,
icon: 'playlist-play'
},
{
label: this.$t('dialog.playlist.play'),
2025-02-09 08:05:03 +01:00
handler: this.play,
icon: 'play'
}
]
}
return []
}
},
methods: {
2024-03-26 03:13:17 +01:00
open() {
2024-03-26 01:17:07 +01:00
this.$emit('close')
this.$router.push({
name: 'playlist',
2024-03-26 03:13:17 +01:00
params: { id: this.item.id }
2024-03-26 01:17:07 +01:00
})
},
play() {
this.$emit('close')
2024-03-26 03:13:17 +01:00
webapi.player_play_uri(this.uris || this.item.uri, false)
},
queue_add() {
this.$emit('close')
2024-03-26 03:13:17 +01:00
webapi.queue_add(this.uris || this.item.uri)
},
queue_add_next() {
this.$emit('close')
2024-03-26 03:13:17 +01:00
webapi.queue_add_next(this.uris || this.item.uri)
}
}
}
</script>