aboutsummaryrefslogtreecommitdiff
path: root/components/preferencesContext.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'components/preferencesContext.tsx')
-rw-r--r--components/preferencesContext.tsx7
1 files changed, 3 insertions, 4 deletions
diff --git a/components/preferencesContext.tsx b/components/preferencesContext.tsx
index 965b185..f7b6db8 100644
--- a/components/preferencesContext.tsx
+++ b/components/preferencesContext.tsx
@@ -5,9 +5,8 @@ import { userPreferences } from '../api/api';
function applyPreferences(preferences: userPreferences) {
if (typeof preferences === 'undefined') return;
- if (typeof preferences.darkMode !== 'undefined') {
- document.getElementsByTagName('html')[0].classList[preferences.darkMode ? 'add' : 'remove']('dark');
- }
+ document.getElementsByTagName('html')[0].classList[preferences.darkMode ? 'add' : 'remove']('dark');
+ document.getElementById('theme').setAttribute('href', '/themes/' + preferences.theme);
}
var PreferencesContext = createContext<
@@ -20,7 +19,7 @@ export function PreferencesContextWrapper(props: { children?: ReactNode; }) {
var [preferences, setPreferences] = useState<userPreferences>();
- var [dummy, setDummy] = useState(false); //FIXME: janky fix to cause rerender
+ var [dummy, setDummy] = useState(false); // FIXME: janky fix to cause rerender
useEffect(() => {
(async () => {