mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2025-12-24 20:42:43 +00:00
65 lines
1.3 KiB
JavaScript
65 lines
1.3 KiB
JavaScript
require('./admin.less');
|
|
const React = require('react');
|
|
const createClass = require('create-react-class');
|
|
|
|
|
|
const BrewCleanup = require('./brewCleanup/brewCleanup.jsx');
|
|
const BrewLookup = require('./brewLookup/brewLookup.jsx');
|
|
const BrewCompress = require ('./brewCompress/brewCompress.jsx');
|
|
const Stats = require('./stats/stats.jsx');
|
|
|
|
const tabGroups = ['brews'];
|
|
|
|
const Admin = createClass({
|
|
getDefaultProps : function() {
|
|
return {};
|
|
},
|
|
|
|
getInitialState : function() {
|
|
return {
|
|
currentTab : 'brews'
|
|
};
|
|
},
|
|
|
|
handleClick : function(newTab) {
|
|
if(this.state.currentTab === newTab) return;
|
|
this.setState({
|
|
currentTab : newTab
|
|
});
|
|
},
|
|
|
|
renderBrewTools : function(){
|
|
return <>
|
|
<Stats />
|
|
<hr />
|
|
<BrewLookup />
|
|
<hr />
|
|
<BrewCleanup />
|
|
<hr />
|
|
<BrewCompress />
|
|
</>;
|
|
},
|
|
|
|
render : function(){
|
|
return <div className='admin'>
|
|
|
|
<header>
|
|
<div className='container'>
|
|
<i className='fas fa-rocket' />
|
|
homebrewery admin
|
|
</div>
|
|
</header>
|
|
<div className='container'>
|
|
<div className='tabs'>
|
|
{tabGroups.map((name, idx)=>{
|
|
return <button className='tab' key={idx} onClick={()=>{return this.handleClick(name);}}>{name.toUpperCase()}</button>;
|
|
})}
|
|
</div>
|
|
{this.state.currentTab == 'brews' && this.renderBrewTools()}
|
|
</div>
|
|
</div>;
|
|
}
|
|
});
|
|
|
|
module.exports = Admin;
|