feat: Add RTL Support to Widget (#11022)

This PR adds RTL support to the web widget for improved right-to-left language compatibility, updates colors, and cleans up code.

Fixes https://linear.app/chatwoot/issue/CW-4089/rtl-issues-on-widget

https://github.com/chatwoot/chatwoot/issues/9791

Other PR: https://github.com/chatwoot/chatwoot/pull/11016
This commit is contained in:
Sivin Varghese
2025-03-21 22:09:03 +05:30
committed by GitHub
parent e4ea078e52
commit 3a693947b5
76 changed files with 966 additions and 2406 deletions

View File

@@ -11,7 +11,6 @@ import { MESSAGE_TYPE } from 'widget/helpers/constants';
import configMixin from '../mixins/configMixin';
import messageMixin from '../mixins/messageMixin';
import { isASubmittedFormMessage } from 'shared/helpers/MessageTypeHelper';
import { useDarkMode } from 'widget/composables/useDarkMode';
import ReplyToChip from 'widget/components/ReplyToChip.vue';
import { BUS_EVENTS } from 'shared/constants/busEvents';
import { emitter } from 'shared/helpers/mitt';
@@ -39,12 +38,6 @@ export default {
default: () => {},
},
},
setup() {
const { getThemeClass } = useDarkMode();
return {
getThemeClass,
};
},
data() {
return {
hasImageError: false,
@@ -183,8 +176,15 @@ export default {
<div v-if="hasReplyTo" class="flex mt-2 mb-1 text-xs">
<ReplyToChip :reply-to="replyTo" />
</div>
<div class="flex gap-1">
<div class="space-y-2">
<div class="flex w-full gap-1">
<div
class="space-y-2"
:class="{
'w-full':
contentType === 'form' &&
!messageContentAttributes?.submitted_values,
}"
>
<AgentMessageBubble
v-if="shouldDisplayAgentMessage"
:content-type="contentType"
@@ -195,10 +195,8 @@ export default {
/>
<div
v-if="hasAttachments"
class="space-y-2 chat-bubble has-attachment agent"
:class="
(wrapClass, getThemeClass('bg-white', 'dark:bg-slate-700'))
"
class="space-y-2 chat-bubble has-attachment agent bg-n-background dark:bg-n-solid-3"
:class="wrapClass"
>
<div
v-for="attachment in message.attachments"
@@ -219,7 +217,11 @@ export default {
@error="onVideoLoadError"
/>
<audio v-else-if="attachment.file_type === 'audio'" controls>
<audio
v-else-if="attachment.file_type === 'audio'"
controls
class="h-10 dark:invert"
>
<source :src="attachment.data_url" />
</audio>
<FileBubble v-else :url="attachment.data_url" />
@@ -236,8 +238,7 @@ export default {
<p
v-if="message.showAvatar || hasRecordedResponse"
v-dompurify-html="agentName"
class="agent-name"
:class="getThemeClass('text-slate-700', 'dark:text-slate-200')"
class="agent-name text-n-slate-11"
/>
</div>
</div>