aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/workspaces/actions.ts
blob: cfe4f9e8e4a11bab77ea725b7979ab0f89b50c38 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import PropTypes from 'prop-types';
import Workspace from './models/Workspace';
import { createActionsFromDefinitions } from '../../actions/lib/actions';

type WorkspaceArg = { workspace: Workspace };

interface WorkspaceActions {
  openWorkspaceSettings: () => void;
  toggleWorkspaceDrawer: () => void;
  deactivate: () => void;
  activate: (options: any) => void;
  edit: (workspaceArg: WorkspaceArg) => void;
  create: ({ name }: { name: string }) => void;
  delete: (workspaceArg: WorkspaceArg) => void;
  update: (workspaceArg: WorkspaceArg) => void;
  toggleKeepAllWorkspacesLoadedSetting: () => void;
}

export default createActionsFromDefinitions<WorkspaceActions>(
  {
    edit: {
      workspace: PropTypes.instanceOf(Workspace).isRequired,
    },
    create: {
      name: PropTypes.string.isRequired,
    },
    delete: {
      workspace: PropTypes.instanceOf(Workspace).isRequired,
    },
    update: {
      workspace: PropTypes.instanceOf(Workspace).isRequired,
    },
    activate: {
      workspace: PropTypes.instanceOf(Workspace).isRequired,
    },
    deactivate: {},
    toggleWorkspaceDrawer: {},
    openWorkspaceSettings: {},
    toggleKeepAllWorkspacesLoadedSetting: {},
  },
  PropTypes.checkPropTypes,
);