Add queued snackbar, fix progress reducer
[arvados-workbench2.git] / src / store / snackbar / snackbar-actions.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { unionize, ofType, UnionOf } from "~/common/unionize";
6
7 export interface SnackbarMessage {
8     message: string;
9     hideDuration: number;
10     kind: SnackbarKind;
11 }
12
13 export enum SnackbarKind {
14     SUCCESS = 1,
15     ERROR = 2,
16     INFO = 3,
17     WARNING = 4
18 }
19
20 export const snackbarActions = unionize({
21     OPEN_SNACKBAR: ofType<{message: string; hideDuration?: number, kind?: SnackbarKind}>(),
22     CLOSE_SNACKBAR: ofType<{}>(),
23     SHIFT_MESSAGES: ofType<{}>()
24 });
25
26 export type SnackbarAction = UnionOf<typeof snackbarActions>;