blob: 0759c22db5fb23bb9adafd8036351ab48427aeec (
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
|
import React, { Component } from 'react';
import { inject, observer } from 'mobx-react';
import PropTypes from 'prop-types';
import TodosWebview from '../components/TodosWebview';
import ErrorBoundary from '../../../components/util/ErrorBoundary';
import UserStore from '../../../stores/UserStore';
import TodoStore from '../store';
import { TODOS_MIN_WIDTH } from '..';
@inject('stores', 'actions') @observer
class TodosScreen extends Component {
static propTypes = {
stores: PropTypes.shape({
user: PropTypes.instanceOf(UserStore).isRequired,
todos: PropTypes.instanceOf(TodoStore).isRequired,
}).isRequired,
actions: PropTypes.shape({
todos: PropTypes.shape({
resize: PropTypes.func.isRequired,
}),
}).isRequired,
};
render() {
const { stores, actions } = this.props;
if (!stores.todos || !stores.todos.isFeatureActive) {
return null;
}
return (
<ErrorBoundary>
<TodosWebview
authToken={stores.user.authToken}
width={stores.todos.width}
minWidth={TODOS_MIN_WIDTH}
resize={width => actions.todos.resize({ width })}
/>
</ErrorBoundary>
);
}
}
export default TodosScreen;
|