[Media UI] MediaImage should emit both play and select.

This commit is contained in:
Fabio Manganiello 2024-07-15 22:28:06 +02:00
parent 75aed6af92
commit c416d0ea1f
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
3 changed files with 15 additions and 4 deletions

View file

@ -2,7 +2,7 @@
<div class="media-info"> <div class="media-info">
<div class="row header"> <div class="row header">
<div class="image-container"> <div class="image-container">
<MediaImage :item="item" @play="$emit('play')" /> <MediaImage :item="item" @play="$emit('play')" @select="$emit('select')" />
</div> </div>
<div class="title"> <div class="title">

View file

@ -5,7 +5,7 @@
@click.right.prevent="$refs.dropdown.toggle()" @click.right.prevent="$refs.dropdown.toggle()"
v-if="!hidden"> v-if="!hidden">
<div class="thumbnail"> <div class="thumbnail">
<MediaImage :item="item" @play="$emit('play')" /> <MediaImage :item="item" @play="$emit('play')" @select="$emit('select')" />
</div> </div>
<div class="body"> <div class="body">

View file

@ -1,7 +1,7 @@
<template> <template>
<div class="image-container" <div class="image-container"
:class="{ 'with-image': !!item?.image }"> :class="{ 'with-image': !!item?.image }">
<div class="play-overlay" @click="$emit('play', item)" v-if="hasPlay"> <div class="play-overlay" @click="$emit(clickEvent, item)" v-if="hasPlay">
<i :class="overlayIconClass" /> <i :class="overlayIconClass" />
</div> </div>
@ -40,7 +40,7 @@ import MediaUtils from "@/components/Media/Utils";
export default { export default {
mixins: [Icons, MediaUtils], mixins: [Icons, MediaUtils],
emits: ['play'], emits: ['play', 'select'],
props: { props: {
item: { item: {
type: Object, type: Object,
@ -60,6 +60,17 @@ export default {
}, },
computed: { computed: {
clickEvent() {
switch (this.item?.item_type) {
case 'channel':
case 'playlist':
case 'folder':
return 'select'
default:
return 'play'
}
},
iconClass() { iconClass() {
switch (this.item?.item_type) { switch (this.item?.item_type) {
case 'channel': case 'channel':