diff options
author | François Schmidts <francois.schmidts@gmail.com> | 2016-01-23 12:47:18 +0100 |
---|---|---|
committer | François Schmidts <francois.schmidts@gmail.com> | 2016-01-26 23:47:10 +0100 |
commit | 3644d4ef190d2d509c64fdf5c29382cb8a41e235 (patch) | |
tree | f95124c888be848294daa4015dda36bf9c73c51d /src/web/js/stores/MenuStore.js | |
parent | meh, kinda works, sleep now (diff) | |
download | newspipe-3644d4ef190d2d509c64fdf5c29382cb8a41e235.tar.gz newspipe-3644d4ef190d2d509c64fdf5c29382cb8a41e235.tar.bz2 newspipe-3644d4ef190d2d509c64fdf5c29382cb8a41e235.zip |
doing some design
wip toogle read / like
Diffstat (limited to 'src/web/js/stores/MenuStore.js')
-rw-r--r-- | src/web/js/stores/MenuStore.js | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/web/js/stores/MenuStore.js b/src/web/js/stores/MenuStore.js index 016b33f2..6809d8b0 100644 --- a/src/web/js/stores/MenuStore.js +++ b/src/web/js/stores/MenuStore.js @@ -6,7 +6,7 @@ var assign = require('object-assign'); var MenuStore = assign({}, EventEmitter.prototype, { - _datas: {filter: 'all', categories: [], + _datas: {filter: 'all', categories: [], active_type: null, active_id: null, all_unread_count: 0, feed_in_error: false}, getAll: function() { return this._datas; @@ -17,6 +17,13 @@ var MenuStore = assign({}, EventEmitter.prototype, { this.emitChange(); } }, + setActive: function(type, value) { + if(this._datas.active_id != value || this._datas.active_type != type) { + this._datas.active_type = type; + this._datas.active_id = value; + this.emitChange(); + } + }, readFeedArticle: function(feed_id) { // TODO }, @@ -40,14 +47,17 @@ MenuStore.dispatchToken = JarrDispatcher.register(function(action) { MenuStore._datas['all_unread_count'] = action.all_unread_count; MenuStore.emitChange(); break; - case MenuActionTypes.MENU_FILTER_ALL: - MenuStore.setFilter('all'); + case MenuActionTypes.PARENT_FILTER: + MenuStore.setActive(action.filter_type, action.filter_id); + break; + case MenuActionTypes.MENU_FILTER: + MenuStore.setFilter(action.filter); break; - case MenuActionTypes.MENU_FILTER_UNREAD: - MenuStore.setFilter('unread'); + case MenuActionTypes.MENU_FILTER: + MenuStore.setFilter(action.filter); break; - case MenuActionTypes.MENU_FILTER_ERROR: - MenuStore.setFilter('error'); + case MenuActionTypes.MENU_FILTER: + MenuStore.setFilter(action.filter); break; default: |