2015-06-09 16:40:42 +00:00
|
|
|
var React = require('react');
|
|
|
|
|
|
|
|
var ThreadSection = require('../organisms/ThreadSection');
|
|
|
|
var MessageSection = require('../organisms/MessageSection');
|
|
|
|
|
|
|
|
var Login = require('../templates/Login');
|
|
|
|
|
2015-06-11 17:25:29 +00:00
|
|
|
var mxCliPeg = require("../MatrixClientPeg");
|
|
|
|
|
2015-06-12 12:45:22 +00:00
|
|
|
//var dis = require("../dispatcher");
|
2015-06-09 16:40:42 +00:00
|
|
|
|
|
|
|
module.exports = React.createClass({
|
2015-06-11 17:25:29 +00:00
|
|
|
getInitialState: function() {
|
|
|
|
return {
|
2015-06-12 12:45:22 +00:00
|
|
|
logged_in: !!(mxCliPeg.get() && mxCliPeg.get().credentials)
|
2015-06-11 17:25:29 +00:00
|
|
|
};
|
|
|
|
},
|
|
|
|
|
2015-06-12 12:45:22 +00:00
|
|
|
onLoggedIn: function() {
|
|
|
|
this.setState({logged_in: true});
|
2015-06-11 17:25:29 +00:00
|
|
|
},
|
|
|
|
|
2015-06-09 16:40:42 +00:00
|
|
|
render: function() {
|
2015-06-11 17:25:29 +00:00
|
|
|
if (this.state.logged_in) {
|
2015-06-09 16:40:42 +00:00
|
|
|
return (
|
|
|
|
<div>
|
|
|
|
<ThreadSection />
|
|
|
|
<MessageSection />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (
|
2015-06-12 12:45:22 +00:00
|
|
|
<Login onLoggedIn={this.onLoggedIn} />
|
2015-06-09 16:40:42 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|