github.com/wfusion/gofusion@v1.1.14/common/infra/asynq/asynqmon/ui/src/actions/settingsActions.ts (about)

     1  import { ThemePreference } from "../reducers/settingsReducer";
     2  import { DailyStatsKey } from "../views/DashboardView";
     3  // List of settings related action types.
     4  export const POLL_INTERVAL_CHANGE = "POLL_INTERVAL_CHANGE";
     5  export const THEME_PREFERENCE_CHANGE = "THEME_PREFERENCE_CHANGE";
     6  export const TOGGLE_DRAWER = "TOGGLE_DRAWER";
     7  export const TASK_ROWS_PER_PAGE_CHANGE = "TASK_ROWS_PER_PAGE_CHANGE";
     8  export const DAILY_STATS_KEY_CHANGE = "DAILY_STATS_KEY_CHANGE";
     9  
    10  interface PollIntervalChangeAction {
    11    type: typeof POLL_INTERVAL_CHANGE;
    12    value: number; // new poll interval value in seconds
    13  }
    14  
    15  interface ThemePreferenceChangeAction {
    16    type: typeof THEME_PREFERENCE_CHANGE;
    17    value: ThemePreference;
    18  }
    19  
    20  interface ToggleDrawerAction {
    21    type: typeof TOGGLE_DRAWER;
    22  }
    23  
    24  interface TaskRowsPerPageChange {
    25    type: typeof TASK_ROWS_PER_PAGE_CHANGE;
    26    value: number;
    27  }
    28  
    29  interface DailyStatsKeyChange {
    30    type: typeof DAILY_STATS_KEY_CHANGE;
    31    value: DailyStatsKey;
    32  }
    33  
    34  // Union of all settings related action types.
    35  export type SettingsActionTypes =
    36    | PollIntervalChangeAction
    37    | ThemePreferenceChangeAction
    38    | ToggleDrawerAction
    39    | TaskRowsPerPageChange
    40    | DailyStatsKeyChange;
    41  
    42  export function pollIntervalChange(value: number) {
    43    return {
    44      type: POLL_INTERVAL_CHANGE,
    45      value,
    46    };
    47  }
    48  
    49  export function selectTheme(value: ThemePreference) {
    50    return {
    51      type: THEME_PREFERENCE_CHANGE,
    52      value,
    53    };
    54  }
    55  
    56  export function toggleDrawer() {
    57    return { type: TOGGLE_DRAWER };
    58  }
    59  
    60  export function taskRowsPerPageChange(value: number) {
    61    return {
    62      type: TASK_ROWS_PER_PAGE_CHANGE,
    63      value,
    64    };
    65  }
    66  
    67  export function dailyStatsKeyChange(value: DailyStatsKey) {
    68    return {
    69      type: DAILY_STATS_KEY_CHANGE,
    70      value,
    71    }
    72  }