From 5a38887af1d7e0d9083ad127c8acf461038de8ab Mon Sep 17 00:00:00 2001 From: Oliver Eyton-Williams Date: Fri, 23 Aug 2019 14:36:31 +0200 Subject: [PATCH] fix: make night mode default for code blocks --- client/src/redux/night-mode-saga.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/client/src/redux/night-mode-saga.js b/client/src/redux/night-mode-saga.js index 7723f06d99..5cc5fa6761 100644 --- a/client/src/redux/night-mode-saga.js +++ b/client/src/redux/night-mode-saga.js @@ -2,12 +2,13 @@ import { takeEvery } from 'redux-saga/effects'; import store from 'store'; +import { isEmpty } from 'lodash'; const themeKey = 'fcc-theme'; const defaultTheme = 'default'; const nightTheme = 'night'; -function setTheme(currentTheme = defaultTheme, theme) { +function setTheme(currentTheme = nightTheme, theme = nightTheme) { if (currentTheme !== theme) { store.set(themeKey, theme); } @@ -17,9 +18,9 @@ function setTheme(currentTheme = defaultTheme, theme) { } function* updateLocalThemeSaga({ payload: { user, theme } }) { - const currentTheme = store.get(themeKey) || defaultTheme; - if (user) { - const { theme = defaultTheme } = user; + const currentTheme = store.get(themeKey) || nightTheme; + if (!isEmpty(user)) { + const { theme = nightTheme } = user; return setTheme(currentTheme, theme); } if (theme) {