From 8e942f6f5695c4788328b4959527b30ff31e771d Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Thu, 28 Jan 2016 22:47:36 +0100 Subject: redoing menu, sorting in place and not in python --- src/web/js/components/Menu.react.js | 39 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'src/web/js/components/Menu.react.js') diff --git a/src/web/js/components/Menu.react.js b/src/web/js/components/Menu.react.js index 32197b3d..d0bd719d 100644 --- a/src/web/js/components/Menu.react.js +++ b/src/web/js/components/Menu.react.js @@ -132,9 +132,6 @@ var CategoryGroup = React.createClass({ ); }, - handleClick: function() { - MiddlePanelActions.setCategoryFilter(this.props.cat_id); - }, toggleFolding: function(evnt) { this.setState({unfolded: !this.state.unfolded}); evnt.stopPropagation(); @@ -185,11 +182,11 @@ var MenuFilter = React.createClass({ var Menu = React.createClass({ getInitialState: function() { - return {filter: 'all', categories: [], all_unread_count: 0, + return {filter: 'all', categories: {}, feeds: {}, active_type: null, active_id: null}; }, render: function() { - var state = this.state; + var feed_in_error = false; var rmPrntFilt = ( ); + var categories = []; + for(var cat_id in this.state.categories) { + var feeds = []; + var unread = 0; + this.state.categories[cat_id].feeds.map(function(feed_id) { + unread += this.state.feeds[feed_id].unread; + feeds.push(this.state.feeds[feed_id]); + }.bind(this)); + categories.push(); + } return ( {rmPrntFilt} - {this.state.categories.map(function(category){ - return (); - })} + {categories} ); }, @@ -228,11 +232,10 @@ var Menu = React.createClass({ _onChange: function() { var datas = MenuStore.getAll(); this.setState({filter: datas.filter, + feeds: datas.feeds, categories: datas.categories, active_type: datas.active_type, - active_id: datas.active_id, - feed_in_error: datas.feed_in_error, - all_unread_count: datas.all_unread_count}); + active_id: datas.active_id}); }, }); -- cgit