diff options
Diffstat (limited to 'src/features/todos/containers')
-rw-r--r-- | src/features/todos/containers/TodosScreen.tsx (renamed from src/features/todos/containers/TodosScreen.js) | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/features/todos/containers/TodosScreen.js b/src/features/todos/containers/TodosScreen.tsx index b97506767..17f61bd95 100644 --- a/src/features/todos/containers/TodosScreen.js +++ b/src/features/todos/containers/TodosScreen.tsx | |||
@@ -1,22 +1,26 @@ | |||
1 | import { Component } from 'react'; | 1 | import { Component, ReactElement } from 'react'; |
2 | import { observer, inject } from 'mobx-react'; | 2 | import { observer, inject } from 'mobx-react'; |
3 | import PropTypes from 'prop-types'; | ||
4 | |||
5 | import FeaturesStore from '../../../stores/FeaturesStore'; | ||
6 | import TodosWebview from '../components/TodosWebview'; | 3 | import TodosWebview from '../components/TodosWebview'; |
7 | import ErrorBoundary from '../../../components/util/ErrorBoundary'; | 4 | import ErrorBoundary from '../../../components/util/ErrorBoundary'; |
8 | import { todosStore } from '..'; | 5 | import { todosStore } from '..'; |
9 | import { TODOS_MIN_WIDTH } from '../../../config'; | 6 | import { TODOS_MIN_WIDTH } from '../../../config'; |
10 | import { todoActions } from '../actions'; | 7 | import { todoActions } from '../actions'; |
11 | import ServicesStore from '../../../stores/ServicesStore'; | 8 | import { RealStores } from '../../../stores'; |
9 | |||
10 | interface IProps { | ||
11 | stores?: RealStores; | ||
12 | } | ||
12 | 13 | ||
13 | class TodosScreen extends Component { | 14 | @inject('stores', 'actions') |
14 | render() { | 15 | @observer |
15 | if ( | 16 | class TodosScreen extends Component<IProps> { |
17 | render(): ReactElement | null { | ||
18 | const showTodoScreen = | ||
16 | !todosStore || | 19 | !todosStore || |
17 | !todosStore.isFeatureActive || | 20 | !todosStore.isFeatureActive || |
18 | todosStore.isTodosPanelForceHidden | 21 | todosStore.isTodosPanelForceHidden; |
19 | ) { | 22 | |
23 | if (showTodoScreen) { | ||
20 | return null; | 24 | return null; |
21 | } | 25 | } |
22 | 26 | ||
@@ -24,15 +28,15 @@ class TodosScreen extends Component { | |||
24 | <ErrorBoundary> | 28 | <ErrorBoundary> |
25 | <TodosWebview | 29 | <TodosWebview |
26 | isTodosServiceActive={ | 30 | isTodosServiceActive={ |
27 | this.props.stores.services.isTodosServiceActive || false | 31 | this.props.stores!.services.isTodosServiceActive || false |
28 | } | 32 | } |
29 | isVisible={todosStore.isTodosPanelVisible} | 33 | isVisible={todosStore.isTodosPanelVisible} |
30 | togglePanel={todoActions.toggleTodosPanel} | 34 | // togglePanel={todoActions.toggleTodosPanel} // TODO - [TECH DEBT][PROP NOT USED IN COMPONENT] check it later |
31 | handleClientMessage={todoActions.handleClientMessage} | 35 | handleClientMessage={todoActions.handleClientMessage} |
32 | setTodosWebview={webview => todoActions.setTodosWebview({ webview })} | 36 | setTodosWebview={webview => todoActions.setTodosWebview(webview)} |
33 | width={todosStore.width} | 37 | width={todosStore.width} |
34 | minWidth={TODOS_MIN_WIDTH} | 38 | minWidth={TODOS_MIN_WIDTH} |
35 | resize={width => todoActions.resize({ width })} | 39 | resize={width => todoActions.resize(width)} |
36 | userAgent={todosStore.userAgent} | 40 | userAgent={todosStore.userAgent} |
37 | todoUrl={todosStore.todoUrl} | 41 | todoUrl={todosStore.todoUrl} |
38 | isTodoUrlValid={todosStore.isTodoUrlValid} | 42 | isTodoUrlValid={todosStore.isTodoUrlValid} |
@@ -42,11 +46,4 @@ class TodosScreen extends Component { | |||
42 | } | 46 | } |
43 | } | 47 | } |
44 | 48 | ||
45 | export default inject('stores', 'actions')(observer(TodosScreen)); | 49 | export default TodosScreen; |
46 | |||
47 | TodosScreen.propTypes = { | ||
48 | stores: PropTypes.shape({ | ||
49 | features: PropTypes.instanceOf(FeaturesStore).isRequired, | ||
50 | services: PropTypes.instanceOf(ServicesStore).isRequired, | ||
51 | }).isRequired, | ||
52 | }; | ||