diff options
author | François Schmidts <francois.schmidts@gmail.com> | 2016-01-31 22:32:10 +0100 |
---|---|---|
committer | François Schmidts <francois.schmidts@gmail.com> | 2016-01-31 22:32:10 +0100 |
commit | db6e918ee5a92429738f2e87afb1af8f024d5053 (patch) | |
tree | 5df4a69af341b0879ff6fac2022d0c662f0353d6 /src/web/js/components | |
parent | handling errors from one page app (diff) | |
download | newspipe-db6e918ee5a92429738f2e87afb1af8f024d5053.tar.gz newspipe-db6e918ee5a92429738f2e87afb1af8f024d5053.tar.bz2 newspipe-db6e918ee5a92429738f2e87afb1af8f024d5053.zip |
enhancement: ordering categories and hidding empty 'no category' category
Diffstat (limited to 'src/web/js/components')
-rw-r--r-- | src/web/js/components/Menu.react.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/web/js/components/Menu.react.js b/src/web/js/components/Menu.react.js index b68a84eb..76304f9a 100644 --- a/src/web/js/components/Menu.react.js +++ b/src/web/js/components/Menu.react.js @@ -89,6 +89,10 @@ var CategoryGroup = React.createClass({ return {unfolded: true}; }, render: function() { + // hidden the no category if empty + if(!this.props.cat_id && !this.props.feeds.length) { + return <ul className="hidden" />; + } var filter = this.props.filter; var a_type = this.props.active_type; var a_id = this.props.active_id; @@ -197,7 +201,8 @@ var Menu = React.createClass({ </ul> ); var categories = []; - for(var cat_id in this.state.categories) { + for(var index in this.state.categories_order) { + var cat_id = this.state.categories_order[index]; var feeds = []; var unread = 0; this.state.categories[cat_id].feeds.map(function(feed_id) { @@ -237,6 +242,7 @@ var Menu = React.createClass({ this.setState({filter: datas.filter, feeds: datas.feeds, categories: datas.categories, + categories_order: datas.categories_order, active_type: datas.active_type, active_id: datas.active_id}); }, |