mirror of
https://github.com/owntone/owntone-server.git
synced 2025-11-23 11:07:56 -05:00
[web] Add helper methods in stores
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<div class="media-content">
|
||||
<div class="is-size-7 is-uppercase" v-text="$t('navigation.volume')" />
|
||||
<control-slider
|
||||
v-model:value="player.volume"
|
||||
v-model:value="playerStore.volume"
|
||||
:max="100"
|
||||
@change="changeVolume"
|
||||
/>
|
||||
@@ -26,7 +26,7 @@ export default {
|
||||
components: { ControlSlider },
|
||||
setup() {
|
||||
return {
|
||||
player: usePlayerStore()
|
||||
playerStore: usePlayerStore()
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -36,22 +36,25 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
icon() {
|
||||
return this.player.volume > 0 ? 'volume-high' : 'volume-off'
|
||||
if (this.playerStore.isMuted) {
|
||||
return 'volume-off'
|
||||
}
|
||||
return 'volume-high'
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'player.volume'() {
|
||||
if (this.player.volume > 0) {
|
||||
this.volume = this.player.volume
|
||||
'playerStore.volume'() {
|
||||
if (!this.playerStore.isMuted) {
|
||||
this.volume = this.playerStore.volume
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeVolume() {
|
||||
player.setVolume(this.player.volume)
|
||||
player.setVolume(this.playerStore.volume)
|
||||
},
|
||||
toggle() {
|
||||
this.player.volume = this.player.volume > 0 ? 0 : this.volume
|
||||
this.playerStore.volume = this.playerStore.isMuted ? this.volume : 0
|
||||
this.changeVolume()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,11 +26,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
disabled() {
|
||||
return (
|
||||
this.queueStore?.count <= 0 ||
|
||||
this.playerStore.isStopped ||
|
||||
this.queueStore.current.data_kind === 'pipe'
|
||||
)
|
||||
return this.queueStore.isEmpty || this.playerStore.isStopped
|
||||
},
|
||||
visible() {
|
||||
return ['podcast', 'audiobook'].includes(
|
||||
|
||||
@@ -26,11 +26,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
disabled() {
|
||||
return (
|
||||
this.queueStore?.count <= 0 ||
|
||||
this.playerStore.isStopped ||
|
||||
this.queueStore.current.data_kind === 'pipe'
|
||||
)
|
||||
return this.queueStore.isEmpty || this.playerStore.isStopped
|
||||
},
|
||||
visible() {
|
||||
return ['podcast', 'audiobook'].includes(
|
||||
|
||||
@@ -19,7 +19,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
disabled() {
|
||||
return this.queueStore.count <= 0
|
||||
return this.queueStore.isEmpty
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
@@ -19,7 +19,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
disabled() {
|
||||
return this.queueStore?.count <= 0
|
||||
return this.queueStore.isEmpty
|
||||
},
|
||||
icon() {
|
||||
if (!this.playerStore.isPlaying) {
|
||||
|
||||
@@ -19,7 +19,7 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
disabled() {
|
||||
return this.queueStore.count <= 0
|
||||
return this.queueStore.isEmpty
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
Reference in New Issue
Block a user