aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/workspaces/containers
diff options
context:
space:
mode:
authorLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-02-12 14:59:58 +0100
committerLibravatar Dominik Guzei <dominik.guzei@gmail.com>2019-02-12 15:02:23 +0100
commit90399cc608b93cc185b0ee1c9b79e98cfafb8bc1 (patch)
treee8678c71c9ebf10bb0c3ac62291b396c32e686c9 /src/features/workspaces/containers
parentsetup logic to display workspace edit page (diff)
downloadferdium-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.js75
-rw-r--r--src/features/workspaces/containers/WorkspacesScreen.js37
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 @@
1import React, { Component } from 'react';
2import { inject, observer } from 'mobx-react';
3import { defineMessages, intlShape } from 'react-intl';
4import { Link } from 'react-router';
5import Form from '../../../lib/Form';
6import ErrorBoundary from '../../../components/util/ErrorBoundary';
7import { gaPage } from '../../../lib/analytics';
8import { state } from '../state';
9
10const 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
22class 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
75export 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 @@
1import React, { Component } from 'react';
2import { inject, observer } from 'mobx-react';
3import PropTypes from 'prop-types';
4import { gaPage } from '../../../lib/analytics';
5import { state } from '../state';
6import WorkspacesDashboard from '../components/WorkspacesDashboard';
7import ErrorBoundary from '../../../components/util/ErrorBoundary';
8
9@inject('actions') @observer
10class 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
37export default WorkspacesScreen;