var React = require('react'); var Col = require('react-bootstrap/Col'); var Panel = require('react-bootstrap/Panel'); var RightPanelStore = require('../stores/RightPanelStore'); var Article = React.createClass({ propTypes: {article: React.PropTypes.object.isRequired}, render: function() { var icon = null; if(this.props.article.icon_url){ icon = (); } var header = (

{icon}Title: {this.props.article.title}

); return (
); }, }); var Feed = React.createClass({ propTypes: {feed: React.PropTypes.object.isRequired}, render: function() { 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 ( test ); }, }); var RightPanel = React.createClass({ getInitialState: function() { return {category: null, feed: null, article: null, current: null}; }, getCategoryCrum: function() { return (
  • {this.state.category.name}
  • ); }, getFeedCrum: function() { return (
  • {this.state.feed.title}
  • ); }, getArticleCrum: function() { return
  • {this.state.article.title}
  • ; }, render: function() { var content = null; var brd_category = null; var brd_feed = null; var brd_article = null; var breadcrum = null; if(this.state.category) { brd_category = (
  • {this.state.category.name}
  • ); } if(this.state.feed) { brd_feed = (
  • {this.state.feed.title}
  • ); } if(this.state.article) { brd_article =
  • {this.state.article.title}
  • ; } if(brd_category || brd_feed || brd_article) { breadcrum = (
      {brd_category} {brd_feed} {brd_article}
    ); } if(this.state.current == 'article') { var content =
    ; } else if(this.state.current == 'feed') { var content = ; } else if(this.state.current == 'category') { var content = ; } return ( {breadcrum} {content} ); }, selectCategory: function() { this.setState({current: 'category'}); }, selectFeed: function() { this.setState({current: 'feed'}); }, selectArticle: function() { this.setState({current: 'article'}); }, componentDidMount: function() { RightPanelStore.addChangeListener(this._onChange); }, componentWillUnmount: function() { RightPanelStore.removeChangeListener(this._onChange); }, _onChange: function() { this.setState(RightPanelStore._datas); }, }); module.exports = RightPanel;