diff options
author | Dominik Guzei <dominik.guzei@gmail.com> | 2019-02-12 14:59:58 +0100 |
---|---|---|
committer | Dominik Guzei <dominik.guzei@gmail.com> | 2019-02-12 15:02:23 +0100 |
commit | 90399cc608b93cc185b0ee1c9b79e98cfafb8bc1 (patch) | |
tree | e8678c71c9ebf10bb0c3ac62291b396c32e686c9 /src/features/workspaces/containers | |
parent | setup logic to display workspace edit page (diff) | |
download | ferdium-app-90399cc608b93cc185b0ee1c9b79e98cfafb8bc1.tar.gz ferdium-app-90399cc608b93cc185b0ee1c9b79e98cfafb8bc1.tar.zst ferdium-app-90399cc608b93cc185b0ee1c9b79e98cfafb8bc1.zip |
consolidate workspace feature for further development
Diffstat (limited to 'src/features/workspaces/containers')
-rw-r--r-- | src/features/workspaces/containers/EditWorkspaceScreen.js | 75 | ||||
-rw-r--r-- | src/features/workspaces/containers/WorkspacesScreen.js | 37 |
2 files changed, 112 insertions, 0 deletions
diff --git a/src/features/workspaces/containers/EditWorkspaceScreen.js b/src/features/workspaces/containers/EditWorkspaceScreen.js new file mode 100644 index 000000000..d8c52f586 --- /dev/null +++ b/src/features/workspaces/containers/EditWorkspaceScreen.js | |||
@@ -0,0 +1,75 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import { inject, observer } from 'mobx-react'; | ||
3 | import { defineMessages, intlShape } from 'react-intl'; | ||
4 | import { Link } from 'react-router'; | ||
5 | import Form from '../../../lib/Form'; | ||
6 | import ErrorBoundary from '../../../components/util/ErrorBoundary'; | ||
7 | import { gaPage } from '../../../lib/analytics'; | ||
8 | import { state } from '../state'; | ||
9 | |||
10 | const messages = defineMessages({ | ||
11 | name: { | ||
12 | id: 'settings.workspace.form.name', | ||
13 | defaultMessage: '!!!Name', | ||
14 | }, | ||
15 | yourWorkspaces: { | ||
16 | id: 'settings.workspace.form.yourWorkspaces', | ||
17 | defaultMessage: '!!!Your workspaces', | ||
18 | }, | ||
19 | }); | ||
20 | |||
21 | @inject('stores', 'actions') @observer | ||
22 | class EditWorkspaceScreen extends Component { | ||
23 | static contextTypes = { | ||
24 | intl: intlShape, | ||
25 | }; | ||
26 | |||
27 | componentDidMount() { | ||
28 | gaPage('Settings/Workspace/Edit'); | ||
29 | } | ||
30 | |||
31 | prepareForm(workspace) { | ||
32 | const { intl } = this.context; | ||
33 | const config = { | ||
34 | fields: { | ||
35 | name: { | ||
36 | label: intl.formatMessage(messages.name), | ||
37 | placeholder: intl.formatMessage(messages.name), | ||
38 | value: workspace.name, | ||
39 | }, | ||
40 | }, | ||
41 | }; | ||
42 | return new Form(config); | ||
43 | } | ||
44 | |||
45 | render() { | ||
46 | const { intl } = this.context; | ||
47 | const { workspaceBeingEdited } = state; | ||
48 | if (!workspaceBeingEdited) return null; | ||
49 | |||
50 | // const form = this.prepareForm(workspaceBeingEdited); | ||
51 | |||
52 | return ( | ||
53 | <ErrorBoundary> | ||
54 | <div className="settings__main"> | ||
55 | <div className="settings__header"> | ||
56 | <span className="settings__header-item"> | ||
57 | <Link to="/settings/workspaces"> | ||
58 | {intl.formatMessage(messages.yourWorkspaces)} | ||
59 | </Link> | ||
60 | </span> | ||
61 | <span className="separator" /> | ||
62 | <span className="settings__header-item"> | ||
63 | {workspaceBeingEdited.name} | ||
64 | </span> | ||
65 | </div> | ||
66 | <div className="settings__body"> | ||
67 | test | ||
68 | </div> | ||
69 | </div> | ||
70 | </ErrorBoundary> | ||
71 | ); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | export default EditWorkspaceScreen; | ||
diff --git a/src/features/workspaces/containers/WorkspacesScreen.js b/src/features/workspaces/containers/WorkspacesScreen.js new file mode 100644 index 000000000..f129edec5 --- /dev/null +++ b/src/features/workspaces/containers/WorkspacesScreen.js | |||
@@ -0,0 +1,37 @@ | |||
1 | import React, { Component } from 'react'; | ||
2 | import { inject, observer } from 'mobx-react'; | ||
3 | import PropTypes from 'prop-types'; | ||
4 | import { gaPage } from '../../../lib/analytics'; | ||
5 | import { state } from '../state'; | ||
6 | import WorkspacesDashboard from '../components/WorkspacesDashboard'; | ||
7 | import ErrorBoundary from '../../../components/util/ErrorBoundary'; | ||
8 | |||
9 | @inject('actions') @observer | ||
10 | class WorkspacesScreen extends Component { | ||
11 | static propTypes = { | ||
12 | actions: PropTypes.shape({ | ||
13 | workspace: PropTypes.shape({ | ||
14 | edit: PropTypes.func.isRequired, | ||
15 | }), | ||
16 | }).isRequired, | ||
17 | }; | ||
18 | |||
19 | componentDidMount() { | ||
20 | gaPage('Settings/Workspaces Dashboard'); | ||
21 | } | ||
22 | |||
23 | render() { | ||
24 | const { workspace } = this.props.actions; | ||
25 | return ( | ||
26 | <ErrorBoundary> | ||
27 | <WorkspacesDashboard | ||
28 | workspaces={state.workspaces} | ||
29 | isLoading={state.isLoading} | ||
30 | onWorkspaceClick={w => workspace.edit({ workspace: w })} | ||
31 | /> | ||
32 | </ErrorBoundary> | ||
33 | ); | ||
34 | } | ||
35 | } | ||
36 | |||
37 | export default WorkspacesScreen; | ||