aboutsummaryrefslogtreecommitdiffstats
path: root/src/stores/UIStore.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/stores/UIStore.js')
-rw-r--r--src/stores/UIStore.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/stores/UIStore.js b/src/stores/UIStore.js
new file mode 100644
index 000000000..cb45b88b5
--- /dev/null
+++ b/src/stores/UIStore.js
@@ -0,0 +1,34 @@
1import { action, observable } from 'mobx';
2
3import Store from './lib/Store';
4
5export default class UIStore extends Store {
6 @observable showServicesUpdatedInfoBar = false;
7
8 constructor(...args) {
9 super(...args);
10
11 // Register action handlers
12 this.actions.ui.openSettings.listen(this._openSettings.bind(this));
13 this.actions.ui.closeSettings.listen(this._closeSettings.bind(this));
14 this.actions.ui.toggleServiceUpdatedInfoBar.listen(this._toggleServiceUpdatedInfoBar.bind(this));
15 }
16
17 // Actions
18 @action _openSettings({ path = '/settings' }) {
19 const settingsPath = path !== '/settings' ? `/settings/${path}` : path;
20 this.stores.router.push(settingsPath);
21 }
22
23 @action _closeSettings(): void {
24 this.stores.router.push('/');
25 }
26
27 @action _toggleServiceUpdatedInfoBar({ visible }) {
28 let visibility = visible;
29 if (visibility === null) {
30 visibility = !this.showServicesUpdatedInfoBar;
31 }
32 this.showServicesUpdatedInfoBar = visibility;
33 }
34}