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() {
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};
},
getCategoryCrum: function() {
return (
{this.state.category.name}
);
},
getFeedCrum: function() {
return (
{this.state.feed.title}
);
},
getArticleCrum: function() {
return Article;
},
render: function() {
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 (
{breadcrum}
{content}
);
},
selectCategory: function() {
this.setState({feed: null, article: null});
},
selectFeed: function() {
this.setState({article: null});
},
componentDidMount: function() {
RightPanelStore.addChangeListener(this._onChange);
},
componentWillUnmount: function() {
RightPanelStore.removeChangeListener(this._onChange);
},
_onChange: function() {
this.setState(RightPanelStore._datas);
},
});
module.exports = RightPanel;