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

88 lines
1.9 KiB
Vue
Raw Normal View History

<template>
<div
v-if="is_next || !show_only_next_items"
class="media is-align-items-center is-clickable mb-0"
@click="play"
>
<div v-if="edit_mode" class="media-left">
<mdicon
class="icon has-text-grey is-movable"
name="drag-horizontal"
size="18"
/>
</div>
<div class="media-content">
<div
class="is-size-6 has-text-weight-bold"
:class="{
2024-08-22 21:31:59 +02:00
'has-text-primary': item.id === player.item_id,
'has-text-grey-light': !is_next
}"
v-text="item.title"
/>
<div
class="is-size-7 has-text-weight-bold"
:class="{
2024-08-22 21:31:59 +02:00
'has-text-primary': item.id === player.item_id,
'has-text-grey-light': !is_next,
2024-08-22 21:31:59 +02:00
'has-text-grey': is_next && item.id !== player.item_id
}"
2023-12-09 10:49:15 +01:00
v-text="item.artist"
/>
<div
class="is-size-7"
:class="{
2024-08-22 21:31:59 +02:00
'has-text-primary': item.id === player.item_id,
'has-text-grey-light': !is_next,
2024-08-22 21:31:59 +02:00
'has-text-grey': is_next && item.id !== player.item_id
}"
v-text="item.album"
/>
</div>
<div class="media-right">
<slot name="actions" />
</div>
</div>
</template>
<script>
2024-08-22 21:31:59 +02:00
import { usePlayerStore } from '@/stores/player'
import webapi from '@/webapi'
export default {
name: 'ListItemQueueItem',
2024-02-27 17:18:58 +01:00
props: {
2024-02-28 13:10:08 +01:00
current_position: { required: true, type: Number },
edit_mode: Boolean,
item: { required: true, type: Object },
position: { required: true, type: Number },
show_only_next_items: Boolean
2024-02-27 17:18:58 +01:00
},
2024-08-22 21:31:59 +02:00
setup() {
return { playerStore: usePlayerStore() }
2024-08-22 21:31:59 +02:00
},
computed: {
is_next() {
return this.current_position < 0 || this.position >= this.current_position
2024-03-24 11:01:06 +01:00
},
2024-08-22 21:31:59 +02:00
player() {
return this.playerStore
}
},
methods: {
play() {
webapi.player_play({ item_id: this.item.id })
}
}
}
</script>
2025-01-01 17:22:17 +01:00
<style scoped>
.is-movable {
cursor: move;
}
</style>