diff --git a/client/admin/admin.jsx b/client/admin/admin.jsx
index f2f2667a4..9f84eaad4 100644
--- a/client/admin/admin.jsx
+++ b/client/admin/admin.jsx
@@ -1,47 +1,47 @@
-require('./admin.less');
-const React = require('react');
-const createClass = require('create-react-class');
-
+import './admin.less';
+import React, { useEffect, useState } from 'react';
const BrewUtils = require('./brewUtils/brewUtils.jsx');
const NotificationUtils = require('./notificationUtils/notificationUtils.jsx');
const tabGroups = ['brew', 'notifications'];
-const Admin = createClass({
- getDefaultProps : function() {
- return {};
- },
+const Admin = ()=>{
+ const [currentTab, setCurrentTab] = useState('brew');
- getInitialState : function(){
- return ({
- currentTab : 'brew'
- });
- },
+ useEffect(()=>{
+ setCurrentTab(localStorage.getItem('hbAdminTab'));
+ }, []);
- handleClick : function(newTab){
- if(this.state.currentTab === newTab) return;
- this.setState({
- currentTab : newTab
- });
- },
+ useEffect(()=>{
+ localStorage.setItem('hbAdminTab', currentTab);
+ }, [currentTab]);
- render : function(){
- return
+ return (
+
- {this.state.currentTab==='brew' && }
- {this.state.currentTab==='notifications' && }
+ {currentTab === 'brew' && }
+ {currentTab === 'notifications' && }
-
;
- }
-});
+
+ );
+};
module.exports = Admin;
diff --git a/client/admin/admin.less b/client/admin/admin.less
index c6c9b4662..47ef10528 100644
--- a/client/admin/admin.less
+++ b/client/admin/admin.less
@@ -30,6 +30,10 @@ body {
color : white;
background-color : @red;
i { margin-right : 30px; }
+
+ a {
+ float:right;
+ }
}
hr { margin : 30px 0px; }
@@ -48,10 +52,10 @@ body {
}
dl {
- @maxItemWidth : 132px;
+ @maxItemWidth : 180px;
dt {
float : left;
- width : @maxItemWidth;
+ max-width : @maxItemWidth;
clear : left;
text-align : right;
&::after { content : ' : '; }
diff --git a/client/admin/brewUtils/stats/stats.jsx b/client/admin/brewUtils/stats/stats.jsx
index 85ce10610..35f46d143 100644
--- a/client/admin/brewUtils/stats/stats.jsx
+++ b/client/admin/brewUtils/stats/stats.jsx
@@ -14,7 +14,8 @@ const Stats = createClass({
getInitialState(){
return {
stats : {
- totalBrews : 0
+ totalBrews : 0,
+ totalPublishedBrews : 0
},
fetching : false
};
@@ -34,6 +35,8 @@ const Stats = createClass({
- Total Brew Count
- {this.state.stats.totalBrews}
+ - Total Brews Published
+ - {this.state.stats.totalPublishedBrews}
{this.state.fetching
diff --git a/client/admin/brewUtils/stats/stats.less b/client/admin/brewUtils/stats/stats.less
index b5a4612e1..355845cbc 100644
--- a/client/admin/brewUtils/stats/stats.less
+++ b/client/admin/brewUtils/stats/stats.less
@@ -4,10 +4,13 @@
.pending {
position : absolute;
- top : 0px;
- left : 0px;
+ top : 0.5em;
+ left : 100px;
width : 100%;
height : 100%;
- background-color : rgba(238,238,238, 0.5);
+ }
+
+ &:has(.pending) {
+ opacity:0.5;
}
}
\ No newline at end of file
diff --git a/server/admin.api.js b/server/admin.api.js
index 1a39f020b..65c91fee8 100644
--- a/server/admin.api.js
+++ b/server/admin.api.js
@@ -135,7 +135,6 @@ router.put('/admin/compress/:id', (req, res)=>{
});
});
-
router.get('/admin/stats', mw.adminOnly, async (req, res)=>{
try {
const totalBrewsCount = await HomebrewModel.countDocuments({});