2021-01-13 13:58:10 -08:00
|
|
|
import { ThemePreference } from "../reducers/settingsReducer";
|
2020-11-24 06:54:00 -08:00
|
|
|
// List of settings related action types.
|
2021-01-13 13:58:10 -08:00
|
|
|
export const POLL_INTERVAL_CHANGE = "POLL_INTERVAL_CHANGE";
|
|
|
|
export const THEME_PREFERENCE_CHANGE = "THEME_PREFERENCE_CHANGE";
|
2020-11-24 06:54:00 -08:00
|
|
|
|
|
|
|
interface PollIntervalChangeAction {
|
|
|
|
type: typeof POLL_INTERVAL_CHANGE;
|
|
|
|
value: number; // new poll interval value in seconds
|
|
|
|
}
|
|
|
|
|
2021-01-12 15:55:56 -08:00
|
|
|
interface ToggleDarkThemeAction {
|
2021-01-13 13:58:10 -08:00
|
|
|
type: typeof THEME_PREFERENCE_CHANGE;
|
|
|
|
value: ThemePreference;
|
2021-01-12 15:55:56 -08:00
|
|
|
}
|
|
|
|
|
2020-11-24 06:54:00 -08:00
|
|
|
// Union of all settings related action types.
|
2021-01-13 13:58:10 -08:00
|
|
|
export type SettingsActionTypes =
|
|
|
|
| PollIntervalChangeAction
|
|
|
|
| ToggleDarkThemeAction;
|
2020-11-24 06:54:00 -08:00
|
|
|
|
|
|
|
export function pollIntervalChange(value: number) {
|
|
|
|
return {
|
|
|
|
type: POLL_INTERVAL_CHANGE,
|
|
|
|
value,
|
|
|
|
};
|
|
|
|
}
|
2021-01-12 15:55:56 -08:00
|
|
|
|
2021-01-13 13:58:10 -08:00
|
|
|
export function selectTheme(value: ThemePreference) {
|
2021-01-12 15:55:56 -08:00
|
|
|
return {
|
2021-01-13 13:58:10 -08:00
|
|
|
type: THEME_PREFERENCE_CHANGE,
|
|
|
|
value,
|
|
|
|
};
|
2021-01-12 15:55:56 -08:00
|
|
|
}
|