aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/todos/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/todos/index.js')
-rw-r--r--src/features/todos/index.js39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/features/todos/index.js b/src/features/todos/index.js
new file mode 100644
index 000000000..7388aebaf
--- /dev/null
+++ b/src/features/todos/index.js
@@ -0,0 +1,39 @@
1import { reaction } from 'mobx';
2import TodoStore from './store';
3
4const debug = require('debug')('Franz:feature:todos');
5
6export const GA_CATEGORY_TODOS = 'Todos';
7
8export const DEFAULT_TODOS_WIDTH = 300;
9export const TODOS_MIN_WIDTH = 200;
10export const DEFAULT_TODOS_VISIBLE = true;
11export const DEFAULT_IS_FEATURE_ENABLED_BY_USER = true;
12
13export const TODOS_ROUTES = {
14 TARGET: '/todos',
15};
16
17export const todosStore = new TodoStore();
18
19export default function initTodos(stores, actions) {
20 stores.todos = todosStore;
21 const { features } = stores;
22
23 // Toggle todos feature
24 reaction(
25 () => features.features.isTodosEnabled,
26 (isEnabled) => {
27 if (isEnabled) {
28 debug('Initializing `todos` feature');
29 todosStore.start(stores, actions);
30 } else if (todosStore.isFeatureActive) {
31 debug('Disabling `todos` feature');
32 todosStore.stop();
33 }
34 },
35 {
36 fireImmediately: true,
37 },
38 );
39}