diff --git a/web/src/Pages/Admin.css b/web/src/Pages/Admin.css
new file mode 100644
index 00000000..edfa695e
--- /dev/null
+++ b/web/src/Pages/Admin.css
@@ -0,0 +1,15 @@
+.adminBody {
+ padding: 20px 5px 5px 5px;
+ font-size: 16pt;
+ width: 300px;
+}
+
+.adminFields {
+ width: 100%;
+}
+
+.admin {
+ height: 50px;
+ width: 100%;
+ margin-top:-5px;
+}
\ No newline at end of file
diff --git a/web/src/Pages/Admin.js b/web/src/Pages/Admin.js
new file mode 100644
index 00000000..b492b913
--- /dev/null
+++ b/web/src/Pages/Admin.js
@@ -0,0 +1,107 @@
+import React, { useContext, useState, useEffect } from 'react';
+import '../App.css';
+import './Login.css';
+import { Button } from 'reactstrap';
+import { Formik, Form, Field } from 'formik';
+import ScaleLoader from 'react-spinners/ScaleLoader';
+import AuthContext from '../Contexts/AuthContext';
+import { Switch } from 'formik-material-ui';
+import { getConfigs, postConfigs } from '../Api/index'
+
+const Admin = () => {
+ const { user } = useContext(AuthContext);
+ const [loading, setLoading] = useState(true);
+ const [configs, setConfigs] = useState({})
+ const [toggle, setToggle] = useState(false);
+
+ useEffect(() => {
+ getConfigs()
+ .then(data => {
+ setConfigs(data.configs);
+ setToggle(data.configs.REGISTRATION_ENABLED === "1")
+ setLoading(false);
+ })
+ }, [])
+
+ if (!user || !user.admin) {
+ return (
+
+
Unauthorized
+
+ )
+ }
+
+ if (loading) {
+ return (
+
+
+
+ )
+ }
+
+ const handleToggle = () => {
+ setToggle(!toggle);
+ };
+
+ return (
+
+
+ Admin Panel
+
+
+ postConfigs(values, toggle)}
+ >
+
+
+
+
+ );
+}
+
+export default Admin;
diff --git a/web/src/Pages/Dashboard.js b/web/src/Pages/Dashboard.js
index a714005d..b5ad3a21 100644
--- a/web/src/Pages/Dashboard.js
+++ b/web/src/Pages/Dashboard.js
@@ -10,7 +10,7 @@ import AuthContext from '../Contexts/AuthContext';
const Dashboard = () => {
const history = useHistory();
let { user } = useContext(AuthContext);
- let [isLoading, setIsLoading] = useState(true);
+ let [loading, setLoading] = useState(true);
let [dashboardData, setDashboardData] = useState({});
if (!user) {
@@ -24,7 +24,7 @@ const Dashboard = () => {
getRecentScrobbles(user.uuid)
.then(data => {
setDashboardData(data);
- setIsLoading(false);
+ setLoading(false);
})
}, [user])
@@ -33,8 +33,8 @@ const Dashboard = () => {
Dashboard!
- {isLoading
- ?
+ {loading
+ ?
:
}