feat: Add video message viewing in to the user bubble in widget (#9642)
This commit is contained in:
@@ -39,6 +39,14 @@
|
|||||||
:readable-time="readableTime"
|
:readable-time="readableTime"
|
||||||
@error="onImageLoadError"
|
@error="onImageLoadError"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<video-bubble
|
||||||
|
v-if="attachment.file_type === 'video' && !hasVideoError"
|
||||||
|
:url="attachment.data_url"
|
||||||
|
:readable-time="readableTime"
|
||||||
|
@error="onVideoLoadError"
|
||||||
|
/>
|
||||||
|
|
||||||
<file-bubble
|
<file-bubble
|
||||||
v-else
|
v-else
|
||||||
:url="attachment.data_url"
|
:url="attachment.data_url"
|
||||||
@@ -72,6 +80,7 @@
|
|||||||
import UserMessageBubble from 'widget/components/UserMessageBubble.vue';
|
import UserMessageBubble from 'widget/components/UserMessageBubble.vue';
|
||||||
import MessageReplyButton from 'widget/components/MessageReplyButton.vue';
|
import MessageReplyButton from 'widget/components/MessageReplyButton.vue';
|
||||||
import ImageBubble from 'widget/components/ImageBubble.vue';
|
import ImageBubble from 'widget/components/ImageBubble.vue';
|
||||||
|
import VideoBubble from 'widget/components/VideoBubble.vue';
|
||||||
import FluentIcon from 'shared/components/FluentIcon/Index.vue';
|
import FluentIcon from 'shared/components/FluentIcon/Index.vue';
|
||||||
import FileBubble from 'widget/components/FileBubble.vue';
|
import FileBubble from 'widget/components/FileBubble.vue';
|
||||||
import timeMixin from 'dashboard/mixins/time';
|
import timeMixin from 'dashboard/mixins/time';
|
||||||
@@ -88,6 +97,7 @@ export default {
|
|||||||
UserMessageBubble,
|
UserMessageBubble,
|
||||||
MessageReplyButton,
|
MessageReplyButton,
|
||||||
ImageBubble,
|
ImageBubble,
|
||||||
|
VideoBubble,
|
||||||
FileBubble,
|
FileBubble,
|
||||||
FluentIcon,
|
FluentIcon,
|
||||||
ReplyToChip,
|
ReplyToChip,
|
||||||
@@ -107,6 +117,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
hasImageError: false,
|
hasImageError: false,
|
||||||
|
hasVideoError: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -143,10 +154,12 @@ export default {
|
|||||||
watch: {
|
watch: {
|
||||||
message() {
|
message() {
|
||||||
this.hasImageError = false;
|
this.hasImageError = false;
|
||||||
|
this.hasVideoError = false;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.hasImageError = false;
|
this.hasImageError = false;
|
||||||
|
this.hasVideoError = false;
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async retrySendMessage() {
|
async retrySendMessage() {
|
||||||
@@ -158,6 +171,9 @@ export default {
|
|||||||
onImageLoadError() {
|
onImageLoadError() {
|
||||||
this.hasImageError = true;
|
this.hasImageError = true;
|
||||||
},
|
},
|
||||||
|
onVideoLoadError() {
|
||||||
|
this.hasVideoError = true;
|
||||||
|
},
|
||||||
toggleReply() {
|
toggleReply() {
|
||||||
this.$emitter.emit(BUS_EVENTS.TOGGLE_REPLY_TO_MESSAGE, this.message);
|
this.$emitter.emit(BUS_EVENTS.TOGGLE_REPLY_TO_MESSAGE, this.message);
|
||||||
},
|
},
|
||||||
|
|||||||
27
app/javascript/widget/components/VideoBubble.vue
Normal file
27
app/javascript/widget/components/VideoBubble.vue
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<script setup>
|
||||||
|
defineProps({
|
||||||
|
url: { type: String, default: '' },
|
||||||
|
readableTime: { type: String, default: '' },
|
||||||
|
});
|
||||||
|
|
||||||
|
const emits = defineEmits(['error']);
|
||||||
|
|
||||||
|
const onVideoError = () => {
|
||||||
|
emits('error');
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<div class="block relative max-w-full">
|
||||||
|
<video
|
||||||
|
class="w-full max-w-[250px] h-auto"
|
||||||
|
:src="url"
|
||||||
|
controls
|
||||||
|
@error="onVideoError"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
class="text-xs absolute text-white dark:text-white right-3 bottom-1 whitespace-nowrap"
|
||||||
|
>
|
||||||
|
{{ readableTime }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
Reference in New Issue
Block a user