From c6ade50a91b63113ba74740a1defcfcee996d062 Mon Sep 17 00:00:00 2001 From: dewanshDT Date: Thu, 9 Mar 2023 17:02:56 +0530 Subject: [PATCH 1/2] theme key --- client/constants.js | 1 + 1 file changed, 1 insertion(+) diff --git a/client/constants.js b/client/constants.js index 2678e6950b..cf8696a4fa 100644 --- a/client/constants.js +++ b/client/constants.js @@ -17,6 +17,7 @@ export const SET_LINE_NUMBERS = 'SET_LINE_NUMBERS'; export const AUTH_USER = 'AUTH_USER'; export const UNAUTH_USER = 'UNAUTH_USER'; export const AUTH_ERROR = 'AUTH_ERROR'; +export const THEME_KEY = 'THEME_KEY'; export const SETTINGS_UPDATED = 'SETTINGS_UPDATED'; From 1ebfeb6d7d2fcf7d9e117572eeb955999d279ef2 Mon Sep 17 00:00:00 2001 From: dewanshDT Date: Thu, 9 Mar 2023 17:03:36 +0530 Subject: [PATCH 2/2] theme-local-storage --- client/modules/IDE/reducers/preferences.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/modules/IDE/reducers/preferences.js b/client/modules/IDE/reducers/preferences.js index f308ffe524..d103b3ab70 100644 --- a/client/modules/IDE/reducers/preferences.js +++ b/client/modules/IDE/reducers/preferences.js @@ -1,3 +1,4 @@ +import { THEME_KEY } from '../../../constants'; import * as ActionTypes from '../../../constants'; const initialState = { @@ -8,7 +9,7 @@ const initialState = { lintWarning: false, textOutput: false, gridOutput: false, - theme: 'light', + theme: localStorage.getItem(THEME_KEY) || 'light', autorefresh: false, language: 'en-US', autocloseBracketsQuotes: true @@ -31,6 +32,7 @@ const preferences = (state = initialState, action) => { case ActionTypes.SET_PREFERENCES: return action.preferences; case ActionTypes.SET_THEME: + localStorage.setItem(THEME_KEY, action.value); return Object.assign({}, state, { theme: action.value }); case ActionTypes.SET_AUTOREFRESH: return Object.assign({}, state, { autorefresh: action.value });