diff options
Diffstat (limited to 'src/features/workspaces/components/WorkspacesDashboard.js')
-rw-r--r-- | src/features/workspaces/components/WorkspacesDashboard.js | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/features/workspaces/components/WorkspacesDashboard.js b/src/features/workspaces/components/WorkspacesDashboard.js new file mode 100644 index 000000000..2a8b3a5ee --- /dev/null +++ b/src/features/workspaces/components/WorkspacesDashboard.js | |||
@@ -0,0 +1,63 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import PropTypes from 'prop-types'; | ||
3 | import { observer, PropTypes as MobxPropTypes } from 'mobx-react'; | ||
4 | import { defineMessages, intlShape } from 'react-intl'; | ||
5 | |||
6 | import Loader from '../../../components/ui/Loader'; | ||
7 | import WorkspaceItem from './WorkspaceItem'; | ||
8 | |||
9 | const messages = defineMessages({ | ||
10 | headline: { | ||
11 | id: 'settings.workspaces.headline', | ||
12 | defaultMessage: '!!!Your workspaces', | ||
13 | }, | ||
14 | noServicesAdded: { | ||
15 | id: 'settings.workspaces.noWorkspacesAdded', | ||
16 | defaultMessage: '!!!You haven\'t added any workspaces yet.', | ||
17 | }, | ||
18 | }); | ||
19 | |||
20 | @observer | ||
21 | class WorkspacesDashboard extends Component { | ||
22 | static propTypes = { | ||
23 | workspaces: MobxPropTypes.arrayOrObservableArray.isRequired, | ||
24 | isLoading: PropTypes.bool.isRequired, | ||
25 | onWorkspaceClick: PropTypes.func.isRequired, | ||
26 | }; | ||
27 | |||
28 | static contextTypes = { | ||
29 | intl: intlShape, | ||
30 | }; | ||
31 | |||
32 | render() { | ||
33 | const { workspaces, isLoading, onWorkspaceClick } = this.props; | ||
34 | const { intl } = this.context; | ||
35 | |||
36 | return ( | ||
37 | <div className="settings__main"> | ||
38 | <div className="settings__header"> | ||
39 | <h1>{intl.formatMessage(messages.headline)}</h1> | ||
40 | </div> | ||
41 | <div className="settings__body"> | ||
42 | {isLoading ? ( | ||
43 | <Loader /> | ||
44 | ) : ( | ||
45 | <table className="workspace-table"> | ||
46 | <tbody> | ||
47 | {workspaces.map(workspace => ( | ||
48 | <WorkspaceItem | ||
49 | key={workspace.id} | ||
50 | workspace={workspace} | ||
51 | onItemClick={w => onWorkspaceClick(w)} | ||
52 | /> | ||
53 | ))} | ||
54 | </tbody> | ||
55 | </table> | ||
56 | )} | ||
57 | </div> | ||
58 | </div> | ||
59 | ); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | export default WorkspacesDashboard; | ||