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.
40 lines
1.0 KiB
JavaScript
40 lines
1.0 KiB
JavaScript
/** @jsx React.DOM */
|
|
|
|
var App = React.createClass({
|
|
getInitialState: function() {
|
|
return {
|
|
// TODO make this change by clicking on folder view.
|
|
source: "/l/[all]",
|
|
folderContent: [],
|
|
currentMessage: null
|
|
};
|
|
},
|
|
|
|
componentWillMount: function() {
|
|
$.get(this.state.source, function(result) {
|
|
this.setState({folderContent: result});
|
|
this.setMessage(result[0]);
|
|
}.bind(this));
|
|
},
|
|
|
|
setMessage: function(msg) {
|
|
this.setState({currentMessage: msg});
|
|
},
|
|
|
|
render: function() {
|
|
if (this.state.currentMessage == null) {
|
|
return (<div id="content" className="loading">Loading...</div>);
|
|
}
|
|
return (
|
|
<div id="layout" className="content pure-g">
|
|
<NavView source="//mail.z.xinu.tv/unread"/>
|
|
{/* TODO make '[all]' be set by clicking folders. */}
|
|
<FolderView handleMessage={this.setMessage} folderContent={this.state.folderContent}/>
|
|
<MainView message={this.state.currentMessage}/>
|
|
</div>
|
|
);
|
|
}
|
|
});
|
|
|
|
React.renderComponent(<App/>, document.body);
|