2018-08-11 07:47:10 +02:00
|
|
|
<template>
|
2023-07-01 09:09:16 +02:00
|
|
|
<div
|
|
|
|
v-if="is_next || !show_only_next_items"
|
2025-02-04 22:00:48 +01:00
|
|
|
class="media is-align-items-center is-clickable mb-0"
|
|
|
|
@click="play"
|
2023-07-01 09:09:16 +02:00
|
|
|
>
|
2022-02-19 06:39:14 +01:00
|
|
|
<div v-if="edit_mode" class="media-left">
|
2023-06-30 21:41:40 +02:00
|
|
|
<mdicon
|
2025-02-04 22:00:48 +01:00
|
|
|
class="icon has-text-grey is-movable"
|
2023-06-30 21:41:40 +02:00
|
|
|
name="drag-horizontal"
|
2025-02-04 22:00:48 +01:00
|
|
|
size="18"
|
2023-06-30 21:41:40 +02:00
|
|
|
/>
|
2018-08-11 07:47:10 +02:00
|
|
|
</div>
|
2025-02-04 22:00:48 +01:00
|
|
|
<div class="media-content">
|
|
|
|
<div
|
|
|
|
class="is-size-6 has-text-weight-bold"
|
2022-05-29 18:49:00 +02:00
|
|
|
:class="{
|
2024-08-22 21:31:59 +02:00
|
|
|
'has-text-primary': item.id === player.item_id,
|
2022-05-29 18:49:00 +02:00
|
|
|
'has-text-grey-light': !is_next
|
|
|
|
}"
|
|
|
|
v-text="item.title"
|
|
|
|
/>
|
2025-02-04 22:00:48 +01:00
|
|
|
<div
|
|
|
|
class="is-size-7 has-text-weight-bold"
|
2022-05-29 18:49:00 +02:00
|
|
|
:class="{
|
2024-08-22 21:31:59 +02:00
|
|
|
'has-text-primary': item.id === player.item_id,
|
2022-05-29 18:49:00 +02:00
|
|
|
'has-text-grey-light': !is_next,
|
2024-08-22 21:31:59 +02:00
|
|
|
'has-text-grey': is_next && item.id !== player.item_id
|
2022-05-29 18:49:00 +02:00
|
|
|
}"
|
2023-12-09 10:49:15 +01:00
|
|
|
v-text="item.artist"
|
|
|
|
/>
|
2025-02-04 22:00:48 +01:00
|
|
|
<div
|
|
|
|
class="is-size-7"
|
2022-05-29 18:49:00 +02:00
|
|
|
:class="{
|
2024-08-22 21:31:59 +02:00
|
|
|
'has-text-primary': item.id === player.item_id,
|
2022-05-29 18:49:00 +02:00
|
|
|
'has-text-grey-light': !is_next,
|
2024-08-22 21:31:59 +02:00
|
|
|
'has-text-grey': is_next && item.id !== player.item_id
|
2022-05-29 18:49:00 +02:00
|
|
|
}"
|
|
|
|
v-text="item.album"
|
|
|
|
/>
|
2018-08-11 07:47:10 +02:00
|
|
|
</div>
|
|
|
|
<div class="media-right">
|
2022-02-19 06:39:14 +01:00
|
|
|
<slot name="actions" />
|
2018-08-11 07:47:10 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2024-08-22 21:31:59 +02:00
|
|
|
import { usePlayerStore } from '@/stores/player'
|
2018-08-11 07:47:10 +02:00
|
|
|
import webapi from '@/webapi'
|
|
|
|
|
|
|
|
export default {
|
2018-12-15 09:56:09 +01:00
|
|
|
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
|
|
|
},
|
2018-08-11 07:47:10 +02:00
|
|
|
|
2024-08-22 21:31:59 +02:00
|
|
|
setup() {
|
2025-02-13 21:02:13 +01:00
|
|
|
return { playerStore: usePlayerStore() }
|
2024-08-22 21:31:59 +02:00
|
|
|
},
|
|
|
|
|
2018-08-11 07:47:10 +02:00
|
|
|
computed: {
|
2022-02-19 06:39:14 +01:00
|
|
|
is_next() {
|
2018-08-11 07:47:10 +02:00
|
|
|
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
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
2023-06-07 21:25:54 +02:00
|
|
|
play() {
|
2020-04-11 19:43:53 +02:00
|
|
|
webapi.player_play({ item_id: this.item.id })
|
2018-08-11 07:47:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2025-01-01 17:22:17 +01:00
|
|
|
|
2025-02-04 22:00:48 +01:00
|
|
|
<style scoped>
|
|
|
|
.is-movable {
|
|
|
|
cursor: move;
|
|
|
|
}
|
|
|
|
</style>
|