From 56ab5f6df51ff301a4dccc458eb83917bba49afc Mon Sep 17 00:00:00 2001 From: François Schmidts Date: Fri, 29 Jan 2016 00:27:47 +0100 Subject: wip right panel --- src/web/js/components/MainApp.react.js | 16 ++-- src/web/js/components/Menu.react.js | 9 ++- src/web/js/components/RightPanel.react.js | 121 ++++++++++++++++++++++-------- 3 files changed, 101 insertions(+), 45 deletions(-) (limited to 'src/web/js/components') diff --git a/src/web/js/components/MainApp.react.js b/src/web/js/components/MainApp.react.js index 72504d89..b448f808 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/Col'); -var Row = require('react-bootstrap/Row'); +var Grid = require('react-bootstrap/Grid'); var Menu = require('./Menu.react'); var MiddlePanel = require('./MiddlePanel.react'); @@ -9,19 +9,15 @@ var RightPanel = require('./RightPanel.react'); var MainApp = React.createClass({ render: function() { - return ( + return ( - + - - - - - + + ); }, }); diff --git a/src/web/js/components/Menu.react.js b/src/web/js/components/Menu.react.js index d0bd719d..0d739e4e 100644 --- a/src/web/js/components/Menu.react.js +++ b/src/web/js/components/Menu.react.js @@ -201,6 +201,9 @@ var Menu = React.createClass({ var feeds = []; var unread = 0; this.state.categories[cat_id].feeds.map(function(feed_id) { + if(this.state.feeds[feed_id].error_count > 3) { + feed_in_error = true; + } unread += this.state.feeds[feed_id].unread; feeds.push(this.state.feeds[feed_id]); }.bind(this)); @@ -213,10 +216,10 @@ var Menu = React.createClass({ unread={unread} />); } - return ( + return ( + feed_in_error={feed_in_error} /> {rmPrntFilt} {categories} diff --git a/src/web/js/components/RightPanel.react.js b/src/web/js/components/RightPanel.react.js index d195dc08..a1e15e94 100644 --- a/src/web/js/components/RightPanel.react.js +++ b/src/web/js/components/RightPanel.react.js @@ -1,61 +1,117 @@ var React = require('react'); - +var Col = require('react-bootstrap/Col'); +var Panel = require('react-bootstrap/Panel'); var RightPanelStore = require('../stores/RightPanelStore'); var RightPanelActions = require('../actions/RightPanelActions'); - var Article = React.createClass({ - + propTypes: {article: React.PropTypes.object.isRequired}, render: function() { return (
); }, }); - var Feed = React.createClass({ + propTypes: {feed: React.PropTypes.object.isRequired}, render: function() { - return (
); + var icon = null; + if(this.props.feed.icon_url){ + icon = (); + } + var header = (

+ {icon}Title: {this.props.feed.title} +

); + return ( +
+
Description
+
{this.props.feed.description}
+
Created on
+
{this.props.feed.created_date}
+
Feed adress
+
+ + {this.props.feed.link} + +
+
Site link
+
+ + {this.props.feed.site_link} + +
+
Last fetched
+
{this.props.feed.last_retrieved}
+
Enabled
+
{this.props.feed.enabled}
+
+
+ ); }, }); - var Category = React.createClass({ + propTypes: {category: React.PropTypes.object.isRequired}, render: function() { - return (
); + return ( + test + + ); }, }); - -var RightPanelMenu = React.createClass({ +var RightPanel = React.createClass({ getInitialState: function() { - return {}; - }, - render: function() { - return (
); + return {category: null, feed: null, article: null}; }, - componentDidMount: function() { - RightPanelStore.addChangeListener(this._onChange); + getCategoryCrum: function() { + return (
  • + {this.state.category.name} +
  • ); }, - componentWillUnmount: function() { - RightPanelStore.removeChangeListener(this._onChange); + getFeedCrum: function() { + return (
  • + {this.state.feed.title} +
  • ); }, - _onChange: function() { - }, -}); - -var RightPanel = React.createClass({ - getInitialState: function() { - return {obj_type: null, obj_id: null}; + getArticleCrum: function() { + return
  • Article
  • ; }, render: function() { - if (this.state.obj_type == 'article') { - return
    ; - } else if (this.state.obj_type == 'feed') { - return ; - } else if (this.state.obj_type == 'category') { - return ; + var content = null; + var breadcrum = null; + if(this.state.article) { + var breadcrum = (
      + {this.getCategoryCrum()} + {this.getFeedCrum()} + {this.getArticleCrum()} +
    ); + var content =
    ; + } else if(this.state.feed) { + var breadcrum = (
      + {this.getCategoryCrum()} + {this.getFeedCrum()} +
    ); + var content = ; + } else if(this.state.category) { + var breadcrum = (
      + {this.getCategoryCrum()} +
    ); + var content = ; } - return
    ; + + return ( + {breadcrum} + {content} + + ); + }, + selectCategory: function() { + this.setState({feed: null, article: null}); + }, + selectFeed: function() { + this.setState({article: null}); }, componentDidMount: function() { RightPanelStore.addChangeListener(this._onChange); @@ -64,7 +120,8 @@ var RightPanel = React.createClass({ RightPanelStore.removeChangeListener(this._onChange); }, _onChange: function() { + this.setState(RightPanelStore._datas); }, }); -module.exports = {RightPanelMenu: RightPanelMenu, RightPanel: RightPanel}; +module.exports = RightPanel; -- cgit