mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-26 08:16:10 +08:00
add dark theme preference
This commit is contained in:
@@ -1,17 +1,22 @@
|
||||
import {
|
||||
POLL_INTERVAL_CHANGE,
|
||||
SettingsActionTypes,
|
||||
TOGGLE_DARK_THEME,
|
||||
SELECT_THEME,
|
||||
} from "../actions/settingsActions";
|
||||
|
||||
export enum themeKind {
|
||||
SystemDefault = "SYETEM DEFAULT",
|
||||
Always = "ALWAYS",
|
||||
Never = "NEVER",
|
||||
}
|
||||
interface SettingsState {
|
||||
pollInterval: number;
|
||||
isDarkTheme: boolean;
|
||||
themePreference: themeKind;
|
||||
}
|
||||
|
||||
const initialState: SettingsState = {
|
||||
pollInterval: 8,
|
||||
isDarkTheme: true,
|
||||
themePreference: themeKind.SystemDefault,
|
||||
};
|
||||
|
||||
function settingsReducer(
|
||||
@@ -21,10 +26,10 @@ function settingsReducer(
|
||||
switch (action.type) {
|
||||
case POLL_INTERVAL_CHANGE:
|
||||
return { ...state, pollInterval: action.value };
|
||||
case TOGGLE_DARK_THEME:
|
||||
case SELECT_THEME:
|
||||
return {
|
||||
...state,
|
||||
isDarkTheme: !state.isDarkTheme,
|
||||
themePreference: action.value,
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
|
||||
Reference in New Issue
Block a user