0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-03-24 02:08:12 +00:00

Revert "renamed client to src"

This reverts commit c28736bd01.
This commit is contained in:
Víctor Losada Hernández
2026-02-01 17:36:53 +01:00
parent c28736bd01
commit 3e76046868
140 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
import React from 'react';
import createReactClass from 'create-react-class';
import request from 'superagent';
const Stats = createReactClass({
displayName : 'Stats',
getDefaultProps(){
return {};
},
getInitialState(){
return {
stats : {
totalBrews : 0,
totalPublishedBrews : 0
},
fetching : false
};
},
componentDidMount(){
this.fetchStats();
},
fetchStats(){
this.setState({ fetching: true });
request.get('/admin/stats')
.then((res)=>this.setState({ stats: res.body }))
.finally(()=>this.setState({ fetching: false }));
},
render(){
return <div className='brewUtil stats'>
<h2> Stats </h2>
<dl>
<dt>Total Brew Count</dt>
<dd>{this.state.stats.totalBrews}</dd>
<dt>Total Brews Published</dt>
<dd>{this.state.stats.totalPublishedBrews}</dd>
</dl>
{this.state.fetching
&& <div className='pending'><i className='fas fa-spin fa-spinner' /></div>
}
</div>;
}
});
export default Stats;