diff options
-rw-r--r-- | src/features/todos/actions.js | 2 | ||||
-rw-r--r-- | src/features/todos/containers/TodosScreen.js | 23 | ||||
-rw-r--r-- | src/features/todos/index.js | 10 | ||||
-rw-r--r-- | src/stores/index.js | 2 |
4 files changed, 16 insertions, 21 deletions
diff --git a/src/features/todos/actions.js b/src/features/todos/actions.js index 696568f7f..a6090a259 100644 --- a/src/features/todos/actions.js +++ b/src/features/todos/actions.js | |||
@@ -6,7 +6,7 @@ export const todoActions = createActionsFromDefinitions({ | |||
6 | width: PropTypes.number.isRequired, | 6 | width: PropTypes.number.isRequired, |
7 | }, | 7 | }, |
8 | setTodosWebview: { | 8 | setTodosWebview: { |
9 | webview: PropTypes.element.isRequired, | 9 | webview: PropTypes.instanceOf(Element).isRequired, |
10 | }, | 10 | }, |
11 | handleHostMessage: { | 11 | handleHostMessage: { |
12 | action: PropTypes.string.isRequired, | 12 | action: PropTypes.string.isRequired, |
diff --git a/src/features/todos/containers/TodosScreen.js b/src/features/todos/containers/TodosScreen.js index 5b7c4531b..2b81bd728 100644 --- a/src/features/todos/containers/TodosScreen.js +++ b/src/features/todos/containers/TodosScreen.js | |||
@@ -5,26 +5,19 @@ import PropTypes from 'prop-types'; | |||
5 | import TodosWebview from '../components/TodosWebview'; | 5 | import TodosWebview from '../components/TodosWebview'; |
6 | import ErrorBoundary from '../../../components/util/ErrorBoundary'; | 6 | import ErrorBoundary from '../../../components/util/ErrorBoundary'; |
7 | import UserStore from '../../../stores/UserStore'; | 7 | import UserStore from '../../../stores/UserStore'; |
8 | import TodoStore from '../store'; | 8 | import { TODOS_MIN_WIDTH, todosStore } from '..'; |
9 | import { TODOS_MIN_WIDTH } from '..'; | 9 | import { todoActions } from '../actions'; |
10 | 10 | ||
11 | @inject('stores', 'actions') @observer | 11 | @inject('stores') @observer |
12 | class TodosScreen extends Component { | 12 | class TodosScreen extends Component { |
13 | static propTypes = { | 13 | static propTypes = { |
14 | stores: PropTypes.shape({ | 14 | stores: PropTypes.shape({ |
15 | user: PropTypes.instanceOf(UserStore).isRequired, | 15 | user: PropTypes.instanceOf(UserStore).isRequired, |
16 | todos: PropTypes.instanceOf(TodoStore).isRequired, | ||
17 | }).isRequired, | ||
18 | actions: PropTypes.shape({ | ||
19 | todos: PropTypes.shape({ | ||
20 | resize: PropTypes.func.isRequired, | ||
21 | handleIPCMessage: PropTypes.func.isRequired, | ||
22 | }), | ||
23 | }).isRequired, | 16 | }).isRequired, |
24 | }; | 17 | }; |
25 | 18 | ||
26 | render() { | 19 | render() { |
27 | const { stores, actions } = this.props; | 20 | const { stores } = this.props; |
28 | 21 | ||
29 | if (!stores.todos || !stores.todos.isFeatureActive) { | 22 | if (!stores.todos || !stores.todos.isFeatureActive) { |
30 | return null; | 23 | return null; |
@@ -34,11 +27,11 @@ class TodosScreen extends Component { | |||
34 | <ErrorBoundary> | 27 | <ErrorBoundary> |
35 | <TodosWebview | 28 | <TodosWebview |
36 | authToken={stores.user.authToken} | 29 | authToken={stores.user.authToken} |
37 | handleClientMessage={actions.todos.handleClientMessage} | 30 | handleClientMessage={todoActions.handleClientMessage} |
38 | setTodosWebview={webview => actions.todos.setTodosWebview({ webview })} | 31 | setTodosWebview={webview => todoActions.setTodosWebview({ webview })} |
39 | width={stores.todos.width} | 32 | width={todosStore.width} |
40 | minWidth={TODOS_MIN_WIDTH} | 33 | minWidth={TODOS_MIN_WIDTH} |
41 | resize={width => actions.todos.resize({ width })} | 34 | resize={width => todoActions.resize({ width })} |
42 | /> | 35 | /> |
43 | </ErrorBoundary> | 36 | </ErrorBoundary> |
44 | ); | 37 | ); |
diff --git a/src/features/todos/index.js b/src/features/todos/index.js index 0dfd35c78..f741561d6 100644 --- a/src/features/todos/index.js +++ b/src/features/todos/index.js | |||
@@ -8,10 +8,10 @@ export const GA_CATEGORY_TODOS = 'Todos'; | |||
8 | export const DEFAULT_TODOS_WIDTH = 300; | 8 | export const DEFAULT_TODOS_WIDTH = 300; |
9 | export const TODOS_MIN_WIDTH = 200; | 9 | export const TODOS_MIN_WIDTH = 200; |
10 | 10 | ||
11 | export const todoStore = new TodoStore(); | 11 | export const todosStore = new TodoStore(); |
12 | 12 | ||
13 | export default function initTodos(stores, actions) { | 13 | export default function initTodos(stores, actions) { |
14 | stores.todos = todoStore; | 14 | stores.todos = todosStore; |
15 | const { features } = stores; | 15 | const { features } = stores; |
16 | 16 | ||
17 | // Toggle todos feature | 17 | // Toggle todos feature |
@@ -20,10 +20,10 @@ export default function initTodos(stores, actions) { | |||
20 | (isEnabled) => { | 20 | (isEnabled) => { |
21 | if (isEnabled) { | 21 | if (isEnabled) { |
22 | debug('Initializing `todos` feature'); | 22 | debug('Initializing `todos` feature'); |
23 | todoStore.start(stores, actions); | 23 | todosStore.start(stores, actions); |
24 | } else if (todoStore.isFeatureActive) { | 24 | } else if (todosStore.isFeatureActive) { |
25 | debug('Disabling `todos` feature'); | 25 | debug('Disabling `todos` feature'); |
26 | todoStore.stop(); | 26 | todosStore.stop(); |
27 | } | 27 | } |
28 | }, | 28 | }, |
29 | { | 29 | { |
diff --git a/src/stores/index.js b/src/stores/index.js index 1912418a2..e9ef523f8 100644 --- a/src/stores/index.js +++ b/src/stores/index.js | |||
@@ -12,6 +12,7 @@ import RequestStore from './RequestStore'; | |||
12 | import GlobalErrorStore from './GlobalErrorStore'; | 12 | import GlobalErrorStore from './GlobalErrorStore'; |
13 | import { workspaceStore } from '../features/workspaces'; | 13 | import { workspaceStore } from '../features/workspaces'; |
14 | import { announcementsStore } from '../features/announcements'; | 14 | import { announcementsStore } from '../features/announcements'; |
15 | import { todosStore } from '../features/todos'; | ||
15 | 16 | ||
16 | export default (api, actions, router) => { | 17 | export default (api, actions, router) => { |
17 | const stores = {}; | 18 | const stores = {}; |
@@ -31,6 +32,7 @@ export default (api, actions, router) => { | |||
31 | globalError: new GlobalErrorStore(stores, api, actions), | 32 | globalError: new GlobalErrorStore(stores, api, actions), |
32 | workspaces: workspaceStore, | 33 | workspaces: workspaceStore, |
33 | announcements: announcementsStore, | 34 | announcements: announcementsStore, |
35 | todos: todosStore, | ||
34 | }); | 36 | }); |
35 | // Initialize all stores | 37 | // Initialize all stores |
36 | Object.keys(stores).forEach((name) => { | 38 | Object.keys(stores).forEach((name) => { |