Fix: Set widget bg color for file-bubble (#965)

This commit is contained in:
Pranav Raj S 2020-06-15 13:35:52 +05:30 committed by GitHub
parent 7c6ea3a05a
commit 667e3abbe1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 14 deletions

View file

@ -32,6 +32,10 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
widgetColor: {
type: String,
default: '',
},
}, },
computed: { computed: {
title() { title() {

View file

@ -2,12 +2,17 @@
<div class="user-message-wrap"> <div class="user-message-wrap">
<div class="user-message"> <div class="user-message">
<div class="message-wrap" :class="{ 'in-progress': isInProgress }"> <div class="message-wrap" :class="{ 'in-progress': isInProgress }">
<UserMessageBubble <user-message-bubble
v-if="showTextBubble" v-if="showTextBubble"
:message="message.content" :message="message.content"
:status="message.status" :status="message.status"
:widget-color="widgetColor"
/> />
<div v-if="hasAttachments" class="chat-bubble has-attachment user"> <div
v-if="hasAttachments"
class="chat-bubble has-attachment user"
:style="{ backgroundColor: widgetColor }"
>
<div v-for="attachment in message.attachments" :key="attachment.id"> <div v-for="attachment in message.attachments" :key="attachment.id">
<file-bubble <file-bubble
v-if="attachment.file_type !== 'image'" v-if="attachment.file_type !== 'image'"
@ -32,6 +37,7 @@ import UserMessageBubble from 'widget/components/UserMessageBubble';
import ImageBubble from 'widget/components/ImageBubble'; import ImageBubble from 'widget/components/ImageBubble';
import FileBubble from 'widget/components/FileBubble'; import FileBubble from 'widget/components/FileBubble';
import timeMixin from 'dashboard/mixins/time'; import timeMixin from 'dashboard/mixins/time';
import { mapGetters } from 'vuex';
export default { export default {
name: 'UserMessage', name: 'UserMessage',
@ -48,6 +54,10 @@ export default {
}, },
}, },
computed: { computed: {
...mapGetters({
widgetColor: 'appConfig/getWidgetColor',
}),
isInProgress() { isInProgress() {
const { status = '' } = this.message; const { status = '' } = this.message;
return status === 'in_progress'; return status === 'in_progress';

View file

@ -3,33 +3,29 @@
class="chat-bubble user" class="chat-bubble user"
:style="{ background: widgetColor }" :style="{ background: widgetColor }"
v-html="formatMessage(message)" v-html="formatMessage(message)"
></div> />
</template> </template>
<script> <script>
import messageFormatterMixin from 'shared/mixins/messageFormatterMixin'; import messageFormatterMixin from 'shared/mixins/messageFormatterMixin';
import { mapGetters } from 'vuex';
export default { export default {
name: 'UserMessageBubble', name: 'UserMessageBubble',
mixins: [messageFormatterMixin], mixins: [messageFormatterMixin],
props: { props: {
message: String, message: {
type: String,
default: '',
},
status: { status: {
type: String, type: String,
default: '', default: '',
}, },
computed: { widgetColor: {
...mapGetters({ type: String,
widgetColor: 'appConfig/getWidgetColor', default: '',
}),
}, },
}, },
computed: {
...mapGetters({
widgetColor: 'appConfig/getWidgetColor',
}),
},
}; };
</script> </script>