diff options
Diffstat (limited to 'src/features')
-rw-r--r-- | src/features/workspaces/actions.ts | 1 | ||||
-rw-r--r-- | src/features/workspaces/components/WorkspaceDrawer.tsx (renamed from src/features/workspaces/components/WorkspaceDrawer.jsx) | 32 |
2 files changed, 18 insertions, 15 deletions
diff --git a/src/features/workspaces/actions.ts b/src/features/workspaces/actions.ts index 4c8b74450..b32bd7c86 100644 --- a/src/features/workspaces/actions.ts +++ b/src/features/workspaces/actions.ts | |||
@@ -7,6 +7,7 @@ export interface WorkspaceActions { | |||
7 | toggleWorkspaceDrawer: () => void; | 7 | toggleWorkspaceDrawer: () => void; |
8 | deactivate: () => void; | 8 | deactivate: () => void; |
9 | activate: (options: any) => void; | 9 | activate: (options: any) => void; |
10 | edit: ({ workspace }: { workspace: Workspace }) => void; | ||
10 | } | 11 | } |
11 | 12 | ||
12 | export default createActionsFromDefinitions<WorkspaceActions>( | 13 | export default createActionsFromDefinitions<WorkspaceActions>( |
diff --git a/src/features/workspaces/components/WorkspaceDrawer.jsx b/src/features/workspaces/components/WorkspaceDrawer.tsx index b0b0e639a..bdbebdb0a 100644 --- a/src/features/workspaces/components/WorkspaceDrawer.jsx +++ b/src/features/workspaces/components/WorkspaceDrawer.tsx | |||
@@ -1,18 +1,18 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component, ReactElement } from 'react'; |
2 | import PropTypes from 'prop-types'; | ||
3 | import { observer } from 'mobx-react'; | 2 | import { observer } from 'mobx-react'; |
4 | import injectSheet from 'react-jss'; | 3 | import withStyles, { WithStylesProps } from 'react-jss'; |
5 | import { defineMessages, injectIntl } from 'react-intl'; | 4 | import { defineMessages, injectIntl, WrappedComponentProps } from 'react-intl'; |
6 | import ReactTooltip from 'react-tooltip'; | 5 | import ReactTooltip from 'react-tooltip'; |
7 | |||
8 | import { mdiPlusBox, mdiCog } from '@mdi/js'; | 6 | import { mdiPlusBox, mdiCog } from '@mdi/js'; |
9 | 7 | import { noop } from 'lodash'; | |
10 | import { H1 } from '../../../components/ui/headline'; | 8 | import { H1 } from '../../../components/ui/headline'; |
11 | import Icon from '../../../components/ui/icon'; | 9 | import Icon from '../../../components/ui/icon'; |
12 | import WorkspaceDrawerItem from './WorkspaceDrawerItem'; | 10 | import WorkspaceDrawerItem from './WorkspaceDrawerItem'; |
13 | import workspaceActions from '../actions'; | 11 | import workspaceActions from '../actions'; |
14 | import { workspaceStore } from '../index'; | 12 | import { workspaceStore } from '../index'; |
15 | import { getUserWorkspacesRequest } from '../api'; | 13 | import { getUserWorkspacesRequest } from '../api'; |
14 | import Service from '../../../models/Service'; | ||
15 | import Workspace from '../models/Workspace'; | ||
16 | 16 | ||
17 | const messages = defineMessages({ | 17 | const messages = defineMessages({ |
18 | headline: { | 18 | headline: { |
@@ -89,22 +89,22 @@ const styles = theme => ({ | |||
89 | }, | 89 | }, |
90 | }); | 90 | }); |
91 | 91 | ||
92 | class WorkspaceDrawer extends Component { | 92 | interface IProps extends WithStylesProps<typeof styles>, WrappedComponentProps { |
93 | static propTypes = { | 93 | getServicesForWorkspace: (workspace: Workspace | null) => Service[]; |
94 | classes: PropTypes.object.isRequired, | 94 | } |
95 | getServicesForWorkspace: PropTypes.func.isRequired, | ||
96 | }; | ||
97 | 95 | ||
98 | componentDidMount() { | 96 | @observer |
99 | ReactTooltip.rebuild(); | 97 | class WorkspaceDrawer extends Component<IProps> { |
98 | componentDidMount(): void { | ||
100 | try { | 99 | try { |
100 | ReactTooltip.rebuild(); | ||
101 | getUserWorkspacesRequest.execute(); | 101 | getUserWorkspacesRequest.execute(); |
102 | } catch (error) { | 102 | } catch (error) { |
103 | console.log(error); | 103 | console.log(error); |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | render() { | 107 | render(): ReactElement { |
108 | const { classes, getServicesForWorkspace } = this.props; | 108 | const { classes, getServicesForWorkspace } = this.props; |
109 | const { intl } = this.props; | 109 | const { intl } = this.props; |
110 | const { activeWorkspace, isSwitchingWorkspace, nextWorkspace, workspaces } = | 110 | const { activeWorkspace, isSwitchingWorkspace, nextWorkspace, workspaces } = |
@@ -118,6 +118,7 @@ class WorkspaceDrawer extends Component { | |||
118 | {intl.formatMessage(messages.headline)} | 118 | {intl.formatMessage(messages.headline)} |
119 | <span | 119 | <span |
120 | className={classes.workspacesSettingsButton} | 120 | className={classes.workspacesSettingsButton} |
121 | onKeyDown={noop} | ||
121 | onClick={() => { | 122 | onClick={() => { |
122 | workspaceActions.openWorkspaceSettings(); | 123 | workspaceActions.openWorkspaceSettings(); |
123 | }} | 124 | }} |
@@ -165,6 +166,7 @@ class WorkspaceDrawer extends Component { | |||
165 | onClick={() => { | 166 | onClick={() => { |
166 | workspaceActions.openWorkspaceSettings(); | 167 | workspaceActions.openWorkspaceSettings(); |
167 | }} | 168 | }} |
169 | onKeyDown={noop} | ||
168 | > | 170 | > |
169 | <Icon | 171 | <Icon |
170 | icon={mdiPlusBox} | 172 | icon={mdiPlusBox} |
@@ -180,5 +182,5 @@ class WorkspaceDrawer extends Component { | |||
180 | } | 182 | } |
181 | 183 | ||
182 | export default injectIntl( | 184 | export default injectIntl( |
183 | injectSheet(styles, { injectTheme: true })(observer(WorkspaceDrawer)), | 185 | withStyles(styles, { injectTheme: true })(WorkspaceDrawer), |
184 | ); | 186 | ); |