client/src/components/Radio.vue
Artem Anufrij 1097c6aa3d
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
use new object structure for radio covers
2023-09-22 14:16:39 +02:00

43 lines
1019 B
Vue

<template>
<div :title="item.name" class="container radio ma" @click="clicked">
<img class="radioCover shadow" :src="cover" />
<p
class="radioTitle"
:class="{ selected: item == $store.state.selectedRadio }"
>
{{ item.name }}
</p>
</div>
</template>
<script>
import BaseCollection from "../mixins/BaseCollection";
export default {
name: "RadioItem",
mixins: [BaseCollection],
mounted() {
if (this.$route.query.play == this.item._id) {
this.$store.dispatch("radios/play", this.item);
}
},
methods: {
clicked() {
if (this.$route.path == "/" || this.$route.path == "/search") {
this.$router.push("/radios?play=" + this.item._id);
} else {
this.$store.dispatch("radios/play", this.item);
}
},
},
computed: {
cover() {
let res = "/static/icons/dummy/radio.svg";
if (this.item && this.item.covers.cover128) {
res = this.item.covers.cover128;
}
return res;
},
},
};
</script>