diff --git a/client/modules/IDE/actions/ide.js b/client/modules/IDE/actions/ide.js
index 80a43443bc..fb03aa3d57 100644
--- a/client/modules/IDE/actions/ide.js
+++ b/client/modules/IDE/actions/ide.js
@@ -1,6 +1,7 @@
import * as ActionTypes from '../../../constants';
import { clearConsole } from './console';
import { dispatchMessage, MessageTypes } from '../../../utils/dispatcher';
+import { updatePreferences } from './preferences';
export function startVisualSketch() {
return {
@@ -293,3 +294,25 @@ export function createError(error) {
error
};
}
+
+export function setTheme(value) {
+ // return {
+ // type: ActionTypes.SET_THEME,
+ // value
+ // };
+ return (dispatch, getState) => {
+ dispatch({
+ type: ActionTypes.SET_THEME,
+ value
+ });
+ const state = getState();
+ if (state.user.authenticated) {
+ const formParams = {
+ preferences: {
+ theme: value
+ }
+ };
+ updatePreferences(formParams, dispatch);
+ }
+ };
+}
diff --git a/client/modules/IDE/actions/preferences.js b/client/modules/IDE/actions/preferences.js
index e0473bd995..eaf4b6c27d 100644
--- a/client/modules/IDE/actions/preferences.js
+++ b/client/modules/IDE/actions/preferences.js
@@ -2,7 +2,7 @@ import i18next from 'i18next';
import apiClient from '../../../utils/apiClient';
import * as ActionTypes from '../../../constants';
-function updatePreferences(formParams, dispatch) {
+export function updatePreferences(formParams, dispatch) {
apiClient
.put('/preferences', formParams)
.then(() => {})
diff --git a/client/modules/IDE/components/Header/Nav.jsx b/client/modules/IDE/components/Header/Nav.jsx
index b4f7cb151f..9738cca455 100644
--- a/client/modules/IDE/components/Header/Nav.jsx
+++ b/client/modules/IDE/components/Header/Nav.jsx
@@ -25,7 +25,8 @@ import {
newFolder,
showKeyboardShortcutModal,
startSketch,
- stopSketch
+ stopSketch,
+ setTheme
} from '../../actions/ide';
import { logoutUser } from '../../../User/actions';
import { CmControllerContext } from '../../pages/IDEView';
@@ -260,11 +261,29 @@ const LanguageMenu = () => {
);
};
+const ThemeMenu = () => {
+ const { t } = useTranslation();
+ const dispatch = useDispatch();
+ return (
+