From 370d51244922ba6634831a406e268a6537053a3d Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Wed, 27 Jan 2016 12:36:35 +0100 Subject: bumping react and removing react-bootstrap listgroup which are not working wit last react version --- package.json | 4 +- src/web/js/components/MainApp.react.js | 13 +-- src/web/js/components/Menu.react.js | 148 ++++++++++++++++------------- src/web/js/components/MiddlePanel.react.js | 24 ++--- src/web/templates/home2.html | 103 +++++++++++++++++++- 5 files changed, 199 insertions(+), 93 deletions(-) diff --git a/package.json b/package.json index ba072568..64569b63 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,9 @@ "jquery": "^2.2.0", "keymirror": "~0.1.0", "object-assign": "^1.0.0", - "react": "^0.14.0", + "react": "^0.14.6", "react-bootstrap": "^0.14.1", - "react-dom": "^0.14.0" + "react-dom": "^0.14.6" }, "devDependencies": { "browserify": "^6.2.0", diff --git a/src/web/js/components/MainApp.react.js b/src/web/js/components/MainApp.react.js index bd643be1..816e8c82 100644 --- a/src/web/js/components/MainApp.react.js +++ b/src/web/js/components/MainApp.react.js @@ -1,6 +1,6 @@ var React = require('react'); -var Col = require('react-bootstrap/lib/Col'); -var Grid = require('react-bootstrap/lib/Grid'); +var Col = require('react-bootstrap/Col'); +var Row = require('react-bootstrap/Row'); var Menu = require('./Menu.react'); var MiddlePanel = require('./MiddlePanel.react'); @@ -9,11 +9,8 @@ var RightPanel = require('./RightPanel.react'); var MainApp = React.createClass({ render: function() { - return ( - - - - + return ( + @@ -22,7 +19,7 @@ var MainApp = React.createClass({ - + ); }, }); diff --git a/src/web/js/components/Menu.react.js b/src/web/js/components/Menu.react.js index becc7a2e..4b8c167c 100644 --- a/src/web/js/components/Menu.react.js +++ b/src/web/js/components/Menu.react.js @@ -1,11 +1,9 @@ var React = require('react'); -var Row = require('react-bootstrap/lib/Row'); -var Badge = require('react-bootstrap/lib/Badge'); -var Button = require('react-bootstrap/lib/Button'); -var ButtonGroup = require('react-bootstrap/lib/ButtonGroup'); -var ListGroup = require('react-bootstrap/lib/ListGroup'); -var ListGroupItem = require('react-bootstrap/lib/ListGroupItem'); -var Glyphicon = require('react-bootstrap/lib/Glyphicon'); +var Col = require('react-bootstrap/Col'); +var Badge = require('react-bootstrap/Badge'); +var Button = require('react-bootstrap/Button'); +var ButtonGroup = require('react-bootstrap/ButtonGroup'); +var Glyphicon = require('react-bootstrap/Glyphicon'); var MenuStore = require('../stores/MenuStore'); var MenuActions = require('../actions/MenuActions'); @@ -36,10 +34,9 @@ var FeedItem = React.createClass({ } else if(this.props.error_count > 3) { style = "warning"; } - return ( + return (
  • {icon}{this.props.title}{badge_unread} - +
  • ); }, handleClick: function() { @@ -48,6 +45,34 @@ var FeedItem = React.createClass({ }); var Category = React.createClass({ + propTypes: {category_id: React.PropTypes.number.isRequired, + filter: React.PropTypes.string.isRequired, + active_type: React.PropTypes.string, + active_id: React.PropTypes.number}, + render: function() { + if(this.props.active_type == 'active_id' + && this.props.active_id == this.props.category_id) { + var classes = "success active"; + } else { + var classes = "success"; + } + return (
  • +

    + {this.props.children} +

    +
  • + ); + }, + handleClick: function() { + if(this.props.category_id != null) { + MiddlePanelActions.setCategoryFilter(this.props.category_id); + } else { + MiddlePanelActions.removeParentFilter(); + } + }, +}); + +var CategoryGroup = React.createClass({ propTypes: {cat_id: React.PropTypes.number.isRequired, filter: React.PropTypes.string.isRequired, active_type: React.PropTypes.string, @@ -89,19 +114,18 @@ var Category = React.createClass({ if(this.props.unread){ unread = {this.props.unread}; } - var active = a_type == 'category_id' && a_id == this.props.cat_id; var ctrl = ( ); - return ( - + return (
      + {ctrl} {this.props.name} {unread} - + {feeds} - +
    ); }, handleClick: function() { @@ -114,43 +138,27 @@ var Category = React.createClass({ }); var MenuFilter = React.createClass({ - getInitialState: function() { - return {filter: 'all', feed_in_error: false}; - }, + propTypes: {feed_in_error: React.PropTypes.bool, + filter: React.PropTypes.string.isRequired}, render: function() { var error_button = null; - if (this.state.feed_in_error) { - error_button = ( ); } - return ( - - - - {error_button} - - + return ( + + + {error_button} + ); }, - setFilter: function(filter) { - this.setState({filter: filter}); - MenuActions.setFilter(filter); - }, - componentDidMount: function() { - MenuStore.addChangeListener(this._onChange); - }, - componentWillUnmount: function() { - MenuStore.removeChangeListener(this._onChange); - }, - _onChange: function() { - this.setState({feed_in_error: MenuStore._datas.feed_in_error}); - }, }); var Menu = React.createClass({ @@ -160,25 +168,36 @@ var Menu = React.createClass({ }, render: function() { var state = this.state; - var rmPrntFilt = (); + if (this.state.active_type == null || this.state.active_id == null) { + var all_classname = "success active"; + } else { + var all_classname = "success"; + } + var rmPrntFilt = ( +
      + + All + +
    + ); - return ( - {rmPrntFilt} + return ( + + {rmPrntFilt} {this.state.categories.map(function(category){ - return (); + return (); })} - + ); }, componentDidMount: function() { @@ -194,8 +213,9 @@ var Menu = React.createClass({ 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}); }, }); -module.exports = {Menu: Menu, MenuFilter: MenuFilter}; +module.exports = Menu; diff --git a/src/web/js/components/MiddlePanel.react.js b/src/web/js/components/MiddlePanel.react.js index 756a811b..0a1dad45 100644 --- a/src/web/js/components/MiddlePanel.react.js +++ b/src/web/js/components/MiddlePanel.react.js @@ -1,10 +1,8 @@ var React = require('react'); -var Row = require('react-bootstrap/lib/Row'); -var Button = require('react-bootstrap/lib/Button'); -var ButtonGroup = require('react-bootstrap/lib/ButtonGroup'); -var ListGroup = require('react-bootstrap/lib/ListGroup'); -var ListGroupItem = require('react-bootstrap/lib/ListGroupItem'); -var Glyphicon = require('react-bootstrap/lib/Glyphicon'); +var Row = require('react-bootstrap/Row'); +var Button = require('react-bootstrap/Button'); +var ButtonGroup = require('react-bootstrap/ButtonGroup'); +var Glyphicon = require('react-bootstrap/Glyphicon'); var MiddlePanelStore = require('../stores/MiddlePanelStore'); var MiddlePanelActions = require('../actions/MiddlePanelActions'); @@ -36,12 +34,10 @@ var TableLine = React.createClass({ onClick={this.toogleRead} />); var liked = (); - return ( - - {read} - {liked} - {this.props.title} - + return (
    +

    {title}

    + {read} {liked} {this.props.title} +
    ); }, toogleRead: function() { @@ -92,7 +88,7 @@ var MiddlePanel = React.createClass({ }, render: function() { return ( - +
    {this.state.articles.map(function(article){ return ();})} - +
    ); }, diff --git a/src/web/templates/home2.html b/src/web/templates/home2.html index 3e9d4a6f..673d9041 100644 --- a/src/web/templates/home2.html +++ b/src/web/templates/home2.html @@ -1,6 +1,99 @@ -{% extends "layout.html" %} -{% block content %} -
    - + + + + {% block head %} + + + + + JARR{% if head_titles %} - {{ ' - '.join(head_titles) }}{% endif %} + + + + + + {% endblock %} + + + +
    + + + -- cgit