Implemented stats page

This commit is contained in:
2019-06-07 17:09:18 +10:00
parent c0d018ac4a
commit 9f508a4aca
11 changed files with 181 additions and 14 deletions
+50
View File
@@ -0,0 +1,50 @@
import React from 'react';
//panels
import CommonLinks from '../panels/common_links.jsx';
import StatisticsPanel from '../panels/statistics.jsx';
class Statistics extends React.Component {
constructor(props) {
super(props);
this.state = {
warning: '', //TODO: unified warning?
fetch: null
};
}
componentDidUpdate(prevProps, prevState, snapshot) {
this.state.fetch();
}
render() {
let warningStyle = {
display: this.state.warning.length > 0 ? 'flex' : 'none'
};
return (
<div className='page'>
<div className='sidePanelPage'>
<div className='sidePanel'>
<CommonLinks />
</div>
<div className='mainPanel'>
<div className='warning' style={warningStyle}>
<p>{this.state.warning}</p>
</div>
<h1 className='centered'>Game Statistics</h1>
<StatisticsPanel setWarning={this.setWarning.bind(this)} getFetch={ (fn) => this.setState({ fetch: fn }) } />
</div>
</div>
</div>
);
}
setWarning(s) {
this.setState({ warning: s });
}
};
export default Statistics;