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

72 lines
1.8 KiB
Vue
Raw Normal View History

<template>
<modal-dialog :actions="actions" :show="show" @close="$emit('close')">
<template #content>
2025-02-12 19:13:35 +01:00
<list-properties :buttons="buttons" :item="item" />
</template>
</modal-dialog>
</template>
<script>
2025-02-12 19:13:35 +01:00
import ListProperties from '@/components/ListProperties.vue'
import ModalDialog from '@/components/ModalDialog.vue'
import webapi from '@/webapi'
export default {
name: 'ModalDialogPlayable',
2025-02-12 19:13:35 +01:00
components: { ListProperties, ModalDialog },
props: {
2025-02-09 17:52:45 +01:00
buttons: { default: () => [], type: Array },
item: { required: true, type: Object },
show: Boolean
},
emits: ['close'],
computed: {
actions() {
return [
{
label: this.$t('dialog.playable.add'),
handler: this.queue_add,
icon: 'playlist-plus'
},
{
label: this.$t('dialog.playable.add-next'),
handler: this.queue_add_next,
icon: 'playlist-play'
},
{
label: this.$t('dialog.playable.play'),
handler: this.play,
icon: 'play'
}
]
}
},
methods: {
play() {
this.$emit('close')
2025-02-09 17:52:45 +01:00
if (this.item.expression) {
webapi.player_play_expression(this.item.expression, false)
} else {
2025-02-09 17:52:45 +01:00
webapi.player_play_uri(this.item.uris || this.item.item.uri, false)
}
},
queue_add() {
this.$emit('close')
2025-02-09 17:52:45 +01:00
if (this.item.expression) {
webapi.queue_expression_add(this.item.expression)
} else {
2025-02-09 17:52:45 +01:00
webapi.queue_add(this.item.uris || this.item.uri)
}
},
queue_add_next() {
this.$emit('close')
2025-02-09 17:52:45 +01:00
if (this.item.expression) {
webapi.queue_expression_add_next(this.item.expression)
} else {
2025-02-09 17:52:45 +01:00
webapi.queue_add_next(this.item.uris || this.item.uri)
}
}
}
}
</script>