aboutsummaryrefslogtreecommitdiffstats
path: root/src/containers/settings/EditWorkspaceScreen.js
blob: 665b405bd7f3f72f150f7c04e8e6250338ca10a2 (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
43
44
45
46
47
48
49
50
51
52
53
54
import React, { Component } from 'react';
import { inject, observer } from 'mobx-react';
import { defineMessages, intlShape } from 'react-intl';
import Form from '../../lib/Form';
import ErrorBoundary from '../../components/util/ErrorBoundary';
import { gaPage } from '../../lib/analytics';
import { state } from '../../features/workspaces/state';

const messages = defineMessages({
  name: {
    id: 'settings.workspace.form.name',
    defaultMessage: '!!!Name',
  },
});

@inject('stores', 'actions') @observer
class EditWorkspaceScreen extends Component {
  static contextTypes = {
    intl: intlShape,
  };

  componentDidMount() {
    gaPage('Settings/Workspace/Edit');
  }

  prepareForm(workspace) {
    const { intl } = this.context;
    const config = {
      fields: {
        name: {
          label: intl.formatMessage(messages.name),
          placeholder: intl.formatMessage(messages.name),
          value: workspace.name,
        },
      },
    };
    return new Form(config);
  }

  render() {
    const { workspaceBeingEdited } = state;
    if (!workspaceBeingEdited) return null;

    // const form = this.prepareForm(workspaceBeingEdited);

    return (
      <ErrorBoundary>
        <div>{workspaceBeingEdited.name}</div>
      </ErrorBoundary>
    );
  }
}

export default EditWorkspaceScreen;