fix: Text color bug on attachment bubble in widget (#6399)

* fix: Text color bug on attachment bubble

* chore: Fix file bubble text color issue

---------

Co-authored-by: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Co-authored-by: iamsivin <iamsivin@gmail.com>
This commit is contained in:
Fayaz Ahmed
2023-02-09 16:50:11 +05:30
committed by GitHub
parent c5b245977a
commit e18f4aeee9
3 changed files with 20 additions and 3 deletions

View File

@@ -24,7 +24,7 @@
<div <div
v-if="hasAttachments" v-if="hasAttachments"
class="chat-bubble has-attachment agent" class="chat-bubble has-attachment agent"
:class="(wrapClass, $dm('bg-white', 'dark:bg-slate-50'))" :class="(wrapClass, $dm('bg-white', 'dark:bg-slate-700'))"
> >
<div v-for="attachment in message.attachments" :key="attachment.id"> <div v-for="attachment in message.attachments" :key="attachment.id">
<image-bubble <image-bubble

View File

@@ -4,7 +4,7 @@
<fluent-icon icon="document" size="28" /> <fluent-icon icon="document" size="28" />
</div> </div>
<div class="meta"> <div class="meta">
<div class="title" :style="{ color: textColor }"> <div class="title" :class="titleColor" :style="{ color: textColor }">
{{ title }} {{ title }}
</div> </div>
<div class="link-wrap mb-1"> <div class="link-wrap mb-1">
@@ -24,12 +24,14 @@
<script> <script>
import FluentIcon from 'shared/components/FluentIcon/Index.vue'; import FluentIcon from 'shared/components/FluentIcon/Index.vue';
import darkModeMixin from 'widget/mixins/darkModeMixin.js';
import { getContrastingTextColor } from '@chatwoot/utils'; import { getContrastingTextColor } from '@chatwoot/utils';
export default { export default {
components: { components: {
FluentIcon, FluentIcon,
}, },
mixins: [darkModeMixin],
props: { props: {
url: { url: {
type: String, type: String,
@@ -43,6 +45,10 @@ export default {
type: String, type: String,
default: '', default: '',
}, },
isUserBubble: {
type: Boolean,
default: false,
},
}, },
computed: { computed: {
title() { title() {
@@ -53,9 +59,19 @@ export default {
fileName() { fileName() {
return this.url.substring(this.url.lastIndexOf('/') + 1); return this.url.substring(this.url.lastIndexOf('/') + 1);
}, },
textColor() { contrastingTextColor() {
return getContrastingTextColor(this.widgetColor); return getContrastingTextColor(this.widgetColor);
}, },
textColor() {
return this.isUserBubble && this.widgetColor
? this.contrastingTextColor
: '';
},
titleColor() {
return !this.isUserBubble
? this.$dm('text-black-900', 'dark:text-slate-50')
: '';
},
}, },
methods: { methods: {
openLink() { openLink() {

View File

@@ -29,6 +29,7 @@
:url="attachment.data_url" :url="attachment.data_url"
:is-in-progress="isInProgress" :is-in-progress="isInProgress"
:widget-color="widgetColor" :widget-color="widgetColor"
is-user-bubble
/> />
</div> </div>
</div> </div>