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="media-content">
|
||||||
<div class="is-size-7 is-uppercase" v-text="$t('navigation.volume')" />
|
<div class="is-size-7 is-uppercase" v-text="$t('navigation.volume')" />
|
||||||
<control-slider
|
<control-slider
|
||||||
v-model:value="player.volume"
|
v-model:value="playerStore.volume"
|
||||||
:max="100"
|
:max="100"
|
||||||
@change="changeVolume"
|
@change="changeVolume"
|
||||||
/>
|
/>
|
||||||
@@ -26,7 +26,7 @@ export default {
|
|||||||
components: { ControlSlider },
|
components: { ControlSlider },
|
||||||
setup() {
|
setup() {
|
||||||
return {
|
return {
|
||||||
player: usePlayerStore()
|
playerStore: usePlayerStore()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
@@ -36,22 +36,25 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
icon() {
|
icon() {
|
||||||
return this.player.volume > 0 ? 'volume-high' : 'volume-off'
|
if (this.playerStore.isMuted) {
|
||||||
|
return 'volume-off'
|
||||||
|
}
|
||||||
|
return 'volume-high'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'player.volume'() {
|
'playerStore.volume'() {
|
||||||
if (this.player.volume > 0) {
|
if (!this.playerStore.isMuted) {
|
||||||
this.volume = this.player.volume
|
this.volume = this.playerStore.volume
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeVolume() {
|
changeVolume() {
|
||||||
player.setVolume(this.player.volume)
|
player.setVolume(this.playerStore.volume)
|
||||||
},
|
},
|
||||||
toggle() {
|
toggle() {
|
||||||
this.player.volume = this.player.volume > 0 ? 0 : this.volume
|
this.playerStore.volume = this.playerStore.isMuted ? this.volume : 0
|
||||||
this.changeVolume()
|
this.changeVolume()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,11 +26,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
disabled() {
|
disabled() {
|
||||||
return (
|
return this.queueStore.isEmpty || this.playerStore.isStopped
|
||||||
this.queueStore?.count <= 0 ||
|
|
||||||
this.playerStore.isStopped ||
|
|
||||||
this.queueStore.current.data_kind === 'pipe'
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
visible() {
|
visible() {
|
||||||
return ['podcast', 'audiobook'].includes(
|
return ['podcast', 'audiobook'].includes(
|
||||||
|
|||||||
@@ -26,11 +26,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
disabled() {
|
disabled() {
|
||||||
return (
|
return this.queueStore.isEmpty || this.playerStore.isStopped
|
||||||
this.queueStore?.count <= 0 ||
|
|
||||||
this.playerStore.isStopped ||
|
|
||||||
this.queueStore.current.data_kind === 'pipe'
|
|
||||||
)
|
|
||||||
},
|
},
|
||||||
visible() {
|
visible() {
|
||||||
return ['podcast', 'audiobook'].includes(
|
return ['podcast', 'audiobook'].includes(
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
disabled() {
|
disabled() {
|
||||||
return this.queueStore.count <= 0
|
return this.queueStore.isEmpty
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
disabled() {
|
disabled() {
|
||||||
return this.queueStore?.count <= 0
|
return this.queueStore.isEmpty
|
||||||
},
|
},
|
||||||
icon() {
|
icon() {
|
||||||
if (!this.playerStore.isPlaying) {
|
if (!this.playerStore.isPlaying) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
disabled() {
|
disabled() {
|
||||||
return this.queueStore.count <= 0
|
return this.queueStore.isEmpty
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
Reference in New Issue
Block a user