From 7a559977ca696d7b50a907f9445f57560e152a8c Mon Sep 17 00:00:00 2001 From: aarya-16 Date: Mon, 28 Oct 2024 17:03:52 +0530 Subject: [PATCH] Shifted mode ternary to a variable --- Client/src/Features/UI/uiSlice.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Client/src/Features/UI/uiSlice.js b/Client/src/Features/UI/uiSlice.js index d77e3d2c6..872691bbf 100644 --- a/Client/src/Features/UI/uiSlice.js +++ b/Client/src/Features/UI/uiSlice.js @@ -1,5 +1,7 @@ import { createSlice } from "@reduxjs/toolkit"; +const initialMode = window?.matchMedia?.('(prefers-color-scheme: dark)')?.matches ? "dark" : "light"; + // Initial state for UI settings. // Add more settings as needed (e.g., theme preferences, user settings) const initialState = { @@ -15,7 +17,7 @@ const initialState = { sidebar: { collapsed: false, }, - mode: window?.matchMedia?.('(prefers-color-scheme: dark)')?.matches? "dark": "light", + mode: initialMode, greeting: { index: 0, lastUpdate: null }, timezone: "America/Toronto", };