diff options
author | 2019-09-06 11:33:21 +0200 | |
---|---|---|
committer | 2019-09-06 11:33:21 +0200 | |
commit | d4b9a14041ba04e4b671f7e86d10a735e09e166a (patch) | |
tree | 3fef10606cf403688464a62e5dada624c6d319ed /src/features/todos/store.js | |
parent | rename create todo action (diff) | |
download | ferdium-app-d4b9a14041ba04e4b671f7e86d10a735e09e166a.tar.gz ferdium-app-d4b9a14041ba04e4b671f7e86d10a735e09e166a.tar.zst ferdium-app-d4b9a14041ba04e4b671f7e86d10a735e09e166a.zip |
Add route listener to open todos via `/todos`
Diffstat (limited to 'src/features/todos/store.js')
-rw-r--r-- | src/features/todos/store.js | 20 |
1 files changed, 19 insertions, 1 deletions
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 | } |