diff options
Diffstat (limited to 'src/features/todos/store.js')
-rw-r--r-- | src/features/todos/store.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/features/todos/store.js b/src/features/todos/store.js index cd9c8e5f6..79c218b65 100644 --- a/src/features/todos/store.js +++ b/src/features/todos/store.js | |||
@@ -9,7 +9,7 @@ import { todoActions } from './actions'; | |||
9 | import { FeatureStore } from '../utils/FeatureStore'; | 9 | import { FeatureStore } from '../utils/FeatureStore'; |
10 | import { createReactions } from '../../stores/lib/Reaction'; | 10 | import { createReactions } from '../../stores/lib/Reaction'; |
11 | import { createActionBindings } from '../utils/ActionBinding'; | 11 | import { createActionBindings } from '../utils/ActionBinding'; |
12 | import { DEFAULT_TODOS_WIDTH, TODOS_MIN_WIDTH } from '.'; | 12 | import { DEFAULT_TODOS_WIDTH, TODOS_MIN_WIDTH, DEFAULT_TODOS_VISIBLE } from '.'; |
13 | 13 | ||
14 | const debug = require('debug')('Franz:feature:todos:store'); | 14 | const debug = require('debug')('Franz:feature:todos:store'); |
15 | 15 | ||
@@ -26,6 +26,12 @@ export default class TodoStore extends FeatureStore { | |||
26 | return width < TODOS_MIN_WIDTH ? TODOS_MIN_WIDTH : width; | 26 | return width < TODOS_MIN_WIDTH ? TODOS_MIN_WIDTH : width; |
27 | } | 27 | } |
28 | 28 | ||
29 | @computed get isTodosPanelVisible() { | ||
30 | if (this.settings.isTodosPanelVisible === undefined) return DEFAULT_TODOS_VISIBLE; | ||
31 | |||
32 | return this.settings.isTodosPanelVisible; | ||
33 | } | ||
34 | |||
29 | @computed get settings() { | 35 | @computed get settings() { |
30 | return localStorage.getItem('todos') || {}; | 36 | return localStorage.getItem('todos') || {}; |
31 | } | 37 | } |
@@ -41,6 +47,7 @@ export default class TodoStore extends FeatureStore { | |||
41 | 47 | ||
42 | this._registerActions(createActionBindings([ | 48 | this._registerActions(createActionBindings([ |
43 | [todoActions.resize, this._resize], | 49 | [todoActions.resize, this._resize], |
50 | [todoActions.toggleTodosPanel, this._toggleTodosPanel], | ||
44 | [todoActions.setTodosWebview, this._setTodosWebview], | 51 | [todoActions.setTodosWebview, this._setTodosWebview], |
45 | [todoActions.handleHostMessage, this._handleHostMessage], | 52 | [todoActions.handleHostMessage, this._handleHostMessage], |
46 | [todoActions.handleClientMessage, this._handleClientMessage], | 53 | [todoActions.handleClientMessage, this._handleClientMessage], |
@@ -81,6 +88,12 @@ export default class TodoStore extends FeatureStore { | |||
81 | }); | 88 | }); |
82 | }; | 89 | }; |
83 | 90 | ||
91 | @action _toggleTodosPanel = () => { | ||
92 | this._updateSettings({ | ||
93 | isTodosPanelVisible: !this.isTodosPanelVisible, | ||
94 | }); | ||
95 | }; | ||
96 | |||
84 | @action _setTodosWebview = ({ webview }) => { | 97 | @action _setTodosWebview = ({ webview }) => { |
85 | debug('_setTodosWebview', webview); | 98 | debug('_setTodosWebview', webview); |
86 | this.webview = webview; | 99 | this.webview = webview; |