email/static/js/nav.js
Bill Thiede 9bcfb1bf21 First version to show (raw) email bodies.
Made xwebmail work with new handlers package.
Pulls important headers from the database and provides extremely basic folder
view on webpage.
Reverted layout customizations returning folder view to original wider width.
JS App now handles all the rendering, index.html only contains placeholder
with background to indicate loading.
2014-04-16 22:23:45 -07:00

37 lines
892 B
JavaScript

/** @jsx React.DOM */
var NavView = React.createClass({
getInitialState: function() {
return {
unreadCount: {}
};
},
componentDidMount: function() {
$.get(this.props.source, function(result) {
console.log('NavView $.get', result);
this.setState({unreadCount: result});
}.bind(this));
},
render: function() {
var keys = Object.keys(this.state.unreadCount).sort();
var lis = [];
for (var i in keys) {
var key = keys[i];
var value = this.state.unreadCount[key];
lis.push(<li key={key}><a href="#">{key}</a></li>);
}
return (
<div id="nav" className="pure-u">
<div className="nav-inner">
<button className="primary-button pure-button">Compose</button>
<div id="unread-list" className="pure-menu pure-menu-open">
<ul>{lis}</ul>
</div>
</div>
</div>
);
}
});