diff options
-rw-r--r-- | src/features/todos/index.js | 4 | ||||
-rw-r--r-- | src/features/todos/store.js | 20 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/features/todos/index.js b/src/features/todos/index.js index 00b165cc5..9b6ab00a0 100644 --- a/src/features/todos/index.js +++ b/src/features/todos/index.js | |||
@@ -9,6 +9,10 @@ export const DEFAULT_TODOS_WIDTH = 300; | |||
9 | export const TODOS_MIN_WIDTH = 200; | 9 | export const TODOS_MIN_WIDTH = 200; |
10 | export const DEFAULT_TODOS_VISIBLE = true; | 10 | export const DEFAULT_TODOS_VISIBLE = true; |
11 | 11 | ||
12 | export const TODOS_ROUTES = { | ||
13 | TARGET: '/todos', | ||
14 | }; | ||
15 | |||
12 | export const todosStore = new TodoStore(); | 16 | export const todosStore = new TodoStore(); |
13 | 17 | ||
14 | export default function initTodos(stores, actions) { | 18 | export default function initTodos(stores, actions) { |
diff --git a/src/features/todos/store.js b/src/features/todos/store.js index ea05077ab..5d67c5ba0 100644 --- a/src/features/todos/store.js +++ b/src/features/todos/store.js | |||
@@ -10,7 +10,9 @@ import { todoActions } from './actions'; | |||
10 | import { FeatureStore } from '../utils/FeatureStore'; | 10 | import { FeatureStore } from '../utils/FeatureStore'; |
11 | import { createReactions } from '../../stores/lib/Reaction'; | 11 | import { createReactions } from '../../stores/lib/Reaction'; |
12 | import { createActionBindings } from '../utils/ActionBinding'; | 12 | import { createActionBindings } from '../utils/ActionBinding'; |
13 | import { DEFAULT_TODOS_WIDTH, TODOS_MIN_WIDTH, DEFAULT_TODOS_VISIBLE } from '.'; | 13 | import { |
14 | DEFAULT_TODOS_WIDTH, TODOS_MIN_WIDTH, DEFAULT_TODOS_VISIBLE, TODOS_ROUTES, | ||
15 | } from '.'; | ||
14 | import { IPC } from './constants'; | 16 | import { IPC } from './constants'; |
15 | import { state as delayAppState } from '../delayApp'; | 17 | import { state as delayAppState } from '../delayApp'; |
16 | 18 | ||
@@ -66,6 +68,7 @@ export default class TodoStore extends FeatureStore { | |||
66 | this._setFeatureEnabledReaction, | 68 | this._setFeatureEnabledReaction, |
67 | this._updateTodosConfig, | 69 | this._updateTodosConfig, |
68 | this._firstLaunchReaction, | 70 | this._firstLaunchReaction, |
71 | this._routeCheckReaction, | ||
69 | ]); | 72 | ]); |
70 | 73 | ||
71 | this._registerReactions(this._allReactions); | 74 | this._registerReactions(this._allReactions); |
@@ -176,4 +179,19 @@ export default class TodoStore extends FeatureStore { | |||
176 | }); | 179 | }); |
177 | } | 180 | } |
178 | }; | 181 | }; |
182 | |||
183 | _routeCheckReaction = () => { | ||
184 | const { pathname } = this.stores.router.location; | ||
185 | |||
186 | if (pathname === TODOS_ROUTES.TARGET) { | ||
187 | debug('Router is on todos route, show todos panel'); | ||
188 | // todosStore.start(stores, actions); | ||
189 | |||
190 | if (!this.isTodosPanelVisible) { | ||
191 | this._updateSettings({ | ||
192 | isTodosPanelVisible: true, | ||
193 | }); | ||
194 | } | ||
195 | } | ||
196 | } | ||
179 | } | 197 | } |