From 452096f4b2b54ca7f05400643765405d0f57c41d Mon Sep 17 00:00:00 2001
From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com>
Date: Mon, 12 Aug 2024 15:50:21 +0530
Subject: [PATCH] feat: Replace `rtlMixin` to a composable (#9924)
This PR will replace the usage of `rtlMixin` to the `useUISettings` composable, and moved the method to component itself.
---
app/javascript/dashboard/App.vue | 10 ++----
.../widgets/conversation/ReplyBox.vue | 5 ++-
.../contacts/components/ContactsTable.vue | 24 +++++++------
.../components/NotificationPanel.vue | 9 ++---
.../settings/reports/components/CsatTable.vue | 11 +++---
.../components/overview/AgentTable.vue | 12 ++++---
.../dashboard/store/modules/accounts.js | 8 +++++
.../modules/specs/account/getters.spec.js | 34 +++++++++++++++++++
app/javascript/shared/mixins/rtlMixin.js | 27 ---------------
.../shared/mixins/specs/rtlMixin.spec.js | 29 ----------------
10 files changed, 74 insertions(+), 95 deletions(-)
delete mode 100644 app/javascript/shared/mixins/rtlMixin.js
delete mode 100644 app/javascript/shared/mixins/specs/rtlMixin.spec.js
diff --git a/app/javascript/dashboard/App.vue b/app/javascript/dashboard/App.vue
index efb89f489..da169d61f 100644
--- a/app/javascript/dashboard/App.vue
+++ b/app/javascript/dashboard/App.vue
@@ -10,7 +10,6 @@ import PaymentPendingBanner from './components/app/PaymentPendingBanner.vue';
import PendingEmailVerificationBanner from './components/app/PendingEmailVerificationBanner.vue';
import vueActionCable from './helper/actionCable';
import WootSnackbarBox from './components/SnackbarContainer.vue';
-import rtlMixin from 'shared/mixins/rtlMixin';
import { setColorTheme } from './helper/themeHelper';
import { isOnOnboardingView } from 'v3/helpers/RouteHelper';
import {
@@ -32,9 +31,6 @@ export default {
UpgradeBanner,
PendingEmailVerificationBanner,
},
-
- mixins: [rtlMixin],
-
data() {
return {
showAddAccountModal: false,
@@ -46,6 +42,7 @@ export default {
computed: {
...mapGetters({
getAccount: 'accounts/getAccount',
+ isRTL: 'accounts/isRTL',
currentUser: 'getCurrentUser',
authUIFlags: 'getAuthUIFlags',
accountUIFlags: 'accounts/getUIFlags',
@@ -102,7 +99,6 @@ export default {
this.getAccount(this.currentAccountId);
const { pubsub_token: pubsubToken } = this.currentUser || {};
this.setLocale(locale);
- this.updateRTLDirectionView(locale);
this.latestChatwootVersion = latestChatwootVersion;
vueActionCable.init(pubsubToken);
this.reconnectService = new ReconnectService(this.$store, router);
@@ -124,8 +120,8 @@ export default {
v-if="!authUIFlags.isFetching && !accountUIFlags.isFetchingItem"
id="app"
class="flex-grow-0 w-full h-full min-h-0 app-wrapper"
- :class="{ 'app-rtl--wrapper': isRTLView }"
- :dir="isRTLView ? 'rtl' : 'ltr'"
+ :class="{ 'app-rtl--wrapper': isRTL }"
+ :dir="isRTL ? 'rtl' : 'ltr'"
>
diff --git a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue
index f2e1b7a65..1a901d449 100644
--- a/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue
+++ b/app/javascript/dashboard/components/widgets/conversation/ReplyBox.vue
@@ -31,7 +31,6 @@ import inboxMixin, { INBOX_FEATURES } from 'shared/mixins/inboxMixin';
import { trimContent, debounce } from '@chatwoot/utils';
import wootConstants from 'dashboard/constants/globals';
import { CONVERSATION_EVENTS } from '../../../helper/AnalyticsHelper/events';
-import rtlMixin from 'shared/mixins/rtlMixin';
import fileUploadMixin from 'dashboard/mixins/fileUploadMixin';
import {
appendSignature,
@@ -65,7 +64,6 @@ export default {
mixins: [
inboxMixin,
messageFormatterMixin,
- rtlMixin,
fileUploadMixin,
keyboardEventListenerMixins,
],
@@ -121,6 +119,7 @@ export default {
},
computed: {
...mapGetters({
+ isRTL: 'accounts/isRTL',
currentChat: 'getSelectedChat',
messageSignature: 'getMessageSignature',
currentUser: 'getCurrentUser',
@@ -307,7 +306,7 @@ export default {
if (this.isOnExpandedLayout || this.popoutReplyBox) {
return 'emoji-dialog--expanded';
}
- if (this.isRTLView) {
+ if (this.isRTL) {
return 'emoji-dialog--rtl';
}
return '';
diff --git a/app/javascript/dashboard/routes/dashboard/contacts/components/ContactsTable.vue b/app/javascript/dashboard/routes/dashboard/contacts/components/ContactsTable.vue
index 3486f6f96..2c5b4b538 100644
--- a/app/javascript/dashboard/routes/dashboard/contacts/components/ContactsTable.vue
+++ b/app/javascript/dashboard/routes/dashboard/contacts/components/ContactsTable.vue
@@ -1,4 +1,5 @@