blob: 87b6062fbfd1aaa2cf20dfe395b5fb0c1000d4f4 (
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
|
import React, { Component } from 'react';
import { inject, observer } from 'mobx-react';
import ErrorBoundary from '../../../components/util/ErrorBoundary';
import { gaPage } from '../../../lib/analytics';
import { state } from '../state';
import EditWorkspaceForm from '../components/EditWorkspaceForm';
import PropTypes from 'prop-types';
@inject('stores', 'actions') @observer
class EditWorkspaceScreen extends Component {
static propTypes = {
actions: PropTypes.shape({
workspace: PropTypes.shape({
delete: PropTypes.func.isRequired,
}),
}).isRequired,
};
componentDidMount() {
gaPage('Settings/Workspace/Edit');
}
onDelete = () => {
const { workspaceBeingEdited } = state;
const { actions } = this.props;
if (!workspaceBeingEdited) return null;
actions.workspace.delete({ workspace: workspaceBeingEdited });
};
onSave = (values) => {
console.log('save workspace', values);
};
render() {
const { workspaceBeingEdited } = state;
if (!workspaceBeingEdited) return null;
return (
<ErrorBoundary>
<EditWorkspaceForm
workspace={workspaceBeingEdited}
onDelete={this.onDelete}
onSave={this.onSave}
isDeleting={false}
isSaving={false}
/>
</ErrorBoundary>
);
}
}
export default EditWorkspaceScreen;
|