From faf506c3362db70557ce99955f5d21b96c8f2240 Mon Sep 17 00:00:00 2001 From: Elijah Lucian Date: Sun, 2 May 2021 21:31:04 -0600 Subject: [PATCH 1/3] unused vars --- webclient/src/App.js | 445 ++++++++++++++++------------- webclient/src/Auth.js | 154 ++++++---- webclient/src/Cards.js | 121 ++++---- webclient/src/Charts.js | 318 +++++++++++++-------- webclient/src/InstructorCourses.js | 176 +++++++----- webclient/src/LoginSignup.js | 132 +++++---- webclient/src/ManageScroll.js | 12 +- webclient/src/Misc.js | 31 +- webclient/src/PasswordReset.js | 95 +++--- webclient/src/Paste.js | 73 +++-- webclient/src/PayPal.js | 176 ++++++++---- webclient/src/Paymaster.js | 105 ++++--- webclient/src/Training.js | 207 ++++++++++---- webclient/src/utils.js | 100 +++---- 14 files changed, 1264 insertions(+), 881 deletions(-) diff --git a/webclient/src/App.js b/webclient/src/App.js index c3d52e92..c8a0fa27 100644 --- a/webclient/src/App.js +++ b/webclient/src/App.js @@ -1,9 +1,9 @@ -import React, { useState, useEffect, useReducer, useContext } from 'react'; -import { BrowserRouter as Router, Switch, Route, Link, useParams, useHistory } from 'react-router-dom'; +import React, { useState, useEffect, useReducer } from 'react'; +import { Switch, Route, Link, useHistory } from 'react-router-dom'; import './semantic-ui/semantic.min.css'; import './light.css'; import './dark.css'; -import { Container, Divider, Dropdown, Form, Grid, Header, Icon, Image, Menu, Message, Segment, Table } from 'semantic-ui-react'; +import { Container, Dropdown, Menu } from 'semantic-ui-react'; import Darkmode from 'darkmode-js'; import { isAdmin, requester } from './utils.js'; import { ManageScroll } from './ManageScroll.js'; @@ -27,8 +27,10 @@ import { Footer } from './Footer.js'; function App() { const [token, setToken] = useState(localStorage.getItem('token', '')); - const [user, setUser] = useState(JSON.parse(localStorage.getItem('user', 'false'))); - const [refreshCount, refreshUser] = useReducer(x => x + 1, 0); + const [user, setUser] = useState( + JSON.parse(localStorage.getItem('user', 'false')) + ); + const [refreshCount, refreshUser] = useReducer((x) => x + 1, 0); const [yousure, setYousure] = useState(false); const history = useHistory(); @@ -44,13 +46,13 @@ function App() { useEffect(() => { requester('/user/', 'GET', token) - .then(res => { - setUserCache(res); - }) - .catch(err => { - console.log(err); - setUserCache(null); - }); + .then((res) => { + setUserCache(res); + }) + .catch((err) => { + console.log(err); + setUserCache(null); + }); }, [token, refreshCount]); function logout() { @@ -73,14 +75,14 @@ function App() { path: history.location.pathname, }; requester('/ping/', 'POST', token, data) - .then() - .catch(err => { - console.log(err); - if (err.data && err.data.detail === 'Invalid token.') { - logout(); // You Sure? - logout(); - } - }); + .then() + .catch((err) => { + console.log(err); + if (err.data && err.data.detail === 'Invalid token.') { + logout(); // You Sure? + logout(); + } + }); } }, [history.location]); @@ -91,7 +93,7 @@ function App() { buttonColorDark: '#666', buttonColorLight: '#aaa', label: '🌙', - } + }; const darkmode = new Darkmode(options); darkmode.showWidget(); }, []); @@ -100,208 +102,241 @@ function App() {
-
-
- - -
- - - -
- - {window.location.hostname !== 'my.protospace.ca' && -

~~~~~ Development site ~~~~~

- } -
- - - - - - - - - - - - - - - - - - - - - - - {user && isAdmin(user) && } - - {user && isAdmin(user) && } - - - - {user && - +
+ +
+ + + +
+ + {window.location.hostname !== 'my.protospace.ca' && ( +

+ ~~~~~ Development site ~~~~~ +

+ )} +
+ + + + + + + + + + + + + + + + + + + + + + + {user && isAdmin(user) && ( + + )} + + {user && isAdmin(user) && ( + + )} + + + + {user && ( + + + + + )} + + + + + - - } - -
- - - - - -
- - - - - - - - - - - - - - - - - - - {user && user.member.set_details ? +
- - - - - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - {user && isAdmin(user) && - - + {user && user.member.set_details ? ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {user && isAdmin(user) && ( + + + + )} + + {user && isAdmin(user) && ( + + + + )} + + + + + + ) : ( + + - } - - {user && isAdmin(user) && - - - - } - - - - + )} - : - - - - } - -
- -
+
+