mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-10-26 08:16:10 +08:00
Use redux for drawer open state
This commit is contained in:
@@ -2,21 +2,27 @@ import { ThemePreference } from "../reducers/settingsReducer";
|
||||
// List of settings related action types.
|
||||
export const POLL_INTERVAL_CHANGE = "POLL_INTERVAL_CHANGE";
|
||||
export const THEME_PREFERENCE_CHANGE = "THEME_PREFERENCE_CHANGE";
|
||||
export const TOGGLE_DRAWER = "TOGGLE_DRAWER";
|
||||
|
||||
interface PollIntervalChangeAction {
|
||||
type: typeof POLL_INTERVAL_CHANGE;
|
||||
value: number; // new poll interval value in seconds
|
||||
}
|
||||
|
||||
interface ToggleDarkThemeAction {
|
||||
interface ThemePreferenceChangeAction {
|
||||
type: typeof THEME_PREFERENCE_CHANGE;
|
||||
value: ThemePreference;
|
||||
}
|
||||
|
||||
interface ToggleDrawerAction {
|
||||
type: typeof TOGGLE_DRAWER;
|
||||
}
|
||||
|
||||
// Union of all settings related action types.
|
||||
export type SettingsActionTypes =
|
||||
| PollIntervalChangeAction
|
||||
| ToggleDarkThemeAction;
|
||||
| ThemePreferenceChangeAction
|
||||
| ToggleDrawerAction;
|
||||
|
||||
export function pollIntervalChange(value: number) {
|
||||
return {
|
||||
@@ -31,3 +37,7 @@ export function selectTheme(value: ThemePreference) {
|
||||
value,
|
||||
};
|
||||
}
|
||||
|
||||
export function toggleDrawer() {
|
||||
return { type: TOGGLE_DRAWER };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user