Newer
Older
Eliot Berriot
committed
<template>
<button @click="toggleRadio" :class="['ui', 'blue', {'inverted': running}, 'icon', 'labeled', 'button']">
Eliot Berriot
committed
<i class="ui feed icon"></i>
<template v-if="running"><translate translate-context="*/Player/Button.Label/Short, Verb">Stop radio</translate></template>
<template v-else><translate translate-context="*/Queue/Button.Label/Short, Verb">Start radio</translate></template>
Eliot Berriot
committed
</button>
</template>
<script>
export default {
props: {
customRadioId: {required: false},
type: {type: String, required: false},
Eliot Berriot
committed
},
methods: {
toggleRadio () {
if (this.running) {
this.$store.dispatch('radios/stop')
Eliot Berriot
committed
} else {
this.$store.dispatch('radios/start', {type: this.type, objectId: this.objectId, customRadioId: this.customRadioId})
Eliot Berriot
committed
}
}
},
computed: {
running () {
let state = this.$store.state.radios
let current = state.current
if (!state.running) {
Eliot Berriot
committed
return false
} else {
return current.type === this.type && current.objectId === this.objectId && current.customRadioId === this.customRadioId