feat: Add an option to use darkMode only in the widget (#7151)
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
export const BUBBLE_DESIGN = ['standard', 'expanded_bubble'];
|
export const BUBBLE_DESIGN = ['standard', 'expanded_bubble'];
|
||||||
export const WIDGET_DESIGN = ['standard', 'flat'];
|
export const WIDGET_DESIGN = ['standard', 'flat'];
|
||||||
export const DARK_MODE = ['light', 'auto'];
|
export const DARK_MODE = ['light', 'auto', 'dark'];
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<div
|
<div
|
||||||
v-if="!conversationSize && isFetchingList"
|
v-if="!conversationSize && isFetchingList"
|
||||||
class="flex flex-1 items-center h-full bg-black-25 justify-center"
|
class="flex flex-1 items-center h-full bg-black-25 justify-center"
|
||||||
|
:class="{ dark: prefersDarkMode }"
|
||||||
>
|
>
|
||||||
<spinner size="" />
|
<spinner size="" />
|
||||||
</div>
|
</div>
|
||||||
@@ -13,6 +14,7 @@
|
|||||||
'is-widget-right': isRightAligned,
|
'is-widget-right': isRightAligned,
|
||||||
'is-bubble-hidden': hideMessageBubble,
|
'is-bubble-hidden': hideMessageBubble,
|
||||||
'is-flat-design': isWidgetStyleFlat,
|
'is-flat-design': isWidgetStyleFlat,
|
||||||
|
dark: prefersDarkMode,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<router-view />
|
<router-view />
|
||||||
@@ -65,6 +67,7 @@ export default {
|
|||||||
isFetchingList: 'conversation/getIsFetchingList',
|
isFetchingList: 'conversation/getIsFetchingList',
|
||||||
isRightAligned: 'appConfig/isRightAligned',
|
isRightAligned: 'appConfig/isRightAligned',
|
||||||
isWidgetOpen: 'appConfig/getIsWidgetOpen',
|
isWidgetOpen: 'appConfig/getIsWidgetOpen',
|
||||||
|
darkMode: 'appConfig/darkMode',
|
||||||
messageCount: 'conversation/getMessageCount',
|
messageCount: 'conversation/getMessageCount',
|
||||||
unreadMessageCount: 'conversation/getUnreadMessageCount',
|
unreadMessageCount: 'conversation/getUnreadMessageCount',
|
||||||
isWidgetStyleFlat: 'appConfig/isWidgetStyleFlat',
|
isWidgetStyleFlat: 'appConfig/isWidgetStyleFlat',
|
||||||
@@ -75,6 +78,12 @@ export default {
|
|||||||
isRNWebView() {
|
isRNWebView() {
|
||||||
return RNHelper.isRNWebView();
|
return RNHelper.isRNWebView();
|
||||||
},
|
},
|
||||||
|
prefersDarkMode() {
|
||||||
|
const isOSOnDarkMode =
|
||||||
|
this.darkMode === 'auto' &&
|
||||||
|
window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||||
|
return isOSOnDarkMode || this.darkMode === 'dark';
|
||||||
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
activeCampaign() {
|
activeCampaign() {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export default {
|
|||||||
isAgentTyping: 'conversation/getIsAgentTyping',
|
isAgentTyping: 'conversation/getIsAgentTyping',
|
||||||
}),
|
}),
|
||||||
colorSchemeClass() {
|
colorSchemeClass() {
|
||||||
return `${this.darkMode === 'light' ? 'light' : 'dark'}`;
|
return `${this.darkMode === 'dark' ? 'dark-scheme' : 'light-scheme'}`;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@@ -117,10 +117,10 @@ export default {
|
|||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
color-scheme: light dark;
|
color-scheme: light dark;
|
||||||
|
|
||||||
&.light {
|
&.light-scheme {
|
||||||
color-scheme: light;
|
color-scheme: light;
|
||||||
}
|
}
|
||||||
&.dark {
|
&.dark-scheme {
|
||||||
color-scheme: dark;
|
color-scheme: dark;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ export default {
|
|||||||
if (this.darkMode === 'light') {
|
if (this.darkMode === 'light') {
|
||||||
return light;
|
return light;
|
||||||
}
|
}
|
||||||
|
if (this.darkMode === 'dark') {
|
||||||
|
return dark;
|
||||||
|
}
|
||||||
return light + ' ' + dark;
|
return light + ' ' + dark;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
const { colors } = require('tailwindcss/defaultTheme');
|
const { colors } = require('tailwindcss/defaultTheme');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
dark: 'class',
|
||||||
purge: [
|
purge: [
|
||||||
'./app/javascript/widget/**/*.vue',
|
'./app/javascript/widget/**/*.vue',
|
||||||
'./app/javascript/portal/**/*.vue',
|
'./app/javascript/portal/**/*.vue',
|
||||||
@@ -11,6 +12,9 @@ module.exports = {
|
|||||||
future: {
|
future: {
|
||||||
removeDeprecatedGapUtilities: true,
|
removeDeprecatedGapUtilities: true,
|
||||||
},
|
},
|
||||||
|
experimental: {
|
||||||
|
darkModeVariant: true,
|
||||||
|
},
|
||||||
theme: {
|
theme: {
|
||||||
colors: {
|
colors: {
|
||||||
white: colors.white,
|
white: colors.white,
|
||||||
|
|||||||
Reference in New Issue
Block a user