feat: Support Dark mode for the widget (#4137)

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Sivin Varghese
2022-04-01 20:59:03 +05:30
committed by GitHub
parent 3813b3b372
commit caee9535f1
36 changed files with 411 additions and 113 deletions

View File

@@ -15,6 +15,7 @@ const state = {
showPopoutButton: false,
widgetColor: '',
widgetStyle: 'standard',
darkMode: 'light',
};
export const getters = {
@@ -25,18 +26,26 @@ export const getters = {
getWidgetColor: $state => $state.widgetColor,
getReferrerHost: $state => $state.referrerHost,
isWidgetStyleFlat: $state => $state.widgetStyle === 'flat',
darkMode: $state => $state.darkMode,
};
export const actions = {
setAppConfig(
{ commit },
{ showPopoutButton, position, hideMessageBubble, widgetStyle = 'rounded' }
{
showPopoutButton,
position,
hideMessageBubble,
widgetStyle = 'rounded',
darkMode = 'light',
}
) {
commit(SET_WIDGET_APP_CONFIG, {
hideMessageBubble: !!hideMessageBubble,
position: position || 'right',
showPopoutButton: !!showPopoutButton,
widgetStyle,
darkMode,
});
},
toggleWidgetOpen({ commit }, isWidgetOpen) {
@@ -56,6 +65,7 @@ export const mutations = {
$state.position = data.position;
$state.hideMessageBubble = data.hideMessageBubble;
$state.widgetStyle = data.widgetStyle;
$state.darkMode = data.darkMode;
},
[TOGGLE_WIDGET_OPEN]($state, isWidgetOpen) {
$state.isWidgetOpen = isWidgetOpen;