blob: 17b7233035092de4c3aad8d2ad697612b7c990d7 (
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
|
import React, { Component } from 'react';
import { inject, observer } from 'mobx-react';
import PropTypes from 'prop-types';
import ErrorBoundary from '../../../components/util/ErrorBoundary';
import EditWorkspaceForm from '../components/EditWorkspaceForm';
import { state } from '../state';
@inject('stores', 'actions') @observer
class EditWorkspaceScreen extends Component {
static propTypes = {
actions: PropTypes.shape({
workspace: PropTypes.shape({
delete: PropTypes.func.isRequired,
}),
}).isRequired,
};
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;
|