From 4cbf67dcbba031970d5bdea237d1e91a157e0568 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Mon, 1 Aug 2022 10:34:35 +0100 Subject: [PATCH] Updated dependencies --- client/client.jsx | 16 +- client/pages/accounts/account.jsx | 4 +- client/pages/accounts/login.jsx | 6 +- client/pages/accounts/recover.jsx | 4 +- client/pages/accounts/reset.jsx | 4 +- client/pages/accounts/signup.jsx | 4 +- client/pages/administration/admin.jsx | 4 +- client/pages/administration/mod.jsx | 4 +- client/pages/app.jsx | 55 +- client/pages/dashboard.jsx | 4 +- client/pages/homepage.jsx | 4 +- client/pages/panels/news-feed.jsx | 1 - client/pages/utilities/lazy-route.jsx | 13 - client/template.html | 2 +- configure-script.js | 2 +- package-lock.json | 1066 +++++++++++-------------- package.json | 22 +- 17 files changed, 523 insertions(+), 692 deletions(-) delete mode 100644 client/pages/utilities/lazy-route.jsx diff --git a/client/client.jsx b/client/client.jsx index b6b08de..135b865 100644 --- a/client/client.jsx +++ b/client/client.jsx @@ -2,14 +2,16 @@ import 'regenerator-runtime/runtime'; import React from 'react'; -import ReactDOM from 'react-dom'; +import ReactDOM from 'react-dom/client'; import App from './pages/app'; import TokenProvider from './pages/utilities/token-provider'; -ReactDOM.render( - - - , - document.querySelector('#root') -); +ReactDOM + .createRoot(document.getElementById('root')) + .render( + + + + ) +; diff --git a/client/pages/accounts/account.jsx b/client/pages/accounts/account.jsx index 28693d2..fb36b56 100644 --- a/client/pages/accounts/account.jsx +++ b/client/pages/accounts/account.jsx @@ -1,5 +1,5 @@ import React, { useEffect, useContext, useRef } from 'react'; -import { Link, Redirect } from 'react-router-dom'; +import { Link, Navigate } from 'react-router-dom'; import ApplyToBody from '../utilities/apply-to-body'; @@ -13,7 +13,7 @@ const Account = props => { //misplaced? if (!authTokens.accessToken) { - return ; + return ; } //refs diff --git a/client/pages/accounts/login.jsx b/client/pages/accounts/login.jsx index e455412..c8a8af2 100644 --- a/client/pages/accounts/login.jsx +++ b/client/pages/accounts/login.jsx @@ -1,5 +1,5 @@ import React, { useContext, useRef } from 'react'; -import { Link, Redirect } from 'react-router-dom'; +import { Link, Navigate } from 'react-router-dom'; import ApplyToBody from '../utilities/apply-to-body'; @@ -13,7 +13,7 @@ const Login = props => { //misplaced? if (authTokens.accessToken) { - return ; + return ; } //refs @@ -40,7 +40,7 @@ const Login = props => { if (accessToken) { authTokens.setAccessToken(accessToken); - props.history.push('/'); + return ; } } }> diff --git a/client/pages/accounts/recover.jsx b/client/pages/accounts/recover.jsx index d0d7d7f..d96015b 100644 --- a/client/pages/accounts/recover.jsx +++ b/client/pages/accounts/recover.jsx @@ -1,5 +1,5 @@ import React, { useContext, useRef } from 'react'; -import { Link, Redirect } from 'react-router-dom'; +import { Link, Navigate } from 'react-router-dom'; import ApplyToBody from '../utilities/apply-to-body'; @@ -14,7 +14,7 @@ const Recover = props => { //misplaced? if (authTokens.accessToken) { - return ; + return ; } //refs diff --git a/client/pages/accounts/reset.jsx b/client/pages/accounts/reset.jsx index 4f3e042..cb55ce1 100644 --- a/client/pages/accounts/reset.jsx +++ b/client/pages/accounts/reset.jsx @@ -1,5 +1,5 @@ import React, { useContext, useRef } from 'react'; -import { Link, Redirect } from 'react-router-dom'; +import { Link, Navigate } from 'react-router-dom'; import queryString from 'query-string'; import ApplyToBody from '../utilities/apply-to-body'; @@ -15,7 +15,7 @@ const Reset = props => { //misplaced? if (authTokens.accessToken || !query.email || !query.token) { - return ; + return ; } //refs diff --git a/client/pages/accounts/signup.jsx b/client/pages/accounts/signup.jsx index 20b4db3..d0268b9 100644 --- a/client/pages/accounts/signup.jsx +++ b/client/pages/accounts/signup.jsx @@ -1,5 +1,5 @@ import React, { useContext, useRef } from 'react'; -import { Link, Redirect } from 'react-router-dom'; +import { Link, Navigate } from 'react-router-dom'; import ApplyToBody from '../utilities/apply-to-body'; @@ -15,7 +15,7 @@ const Signup = props => { //misplaced? if (authTokens.accessToken) { - return ; + return ; } //refs diff --git a/client/pages/administration/admin.jsx b/client/pages/administration/admin.jsx index 6000848..cba4c0d 100644 --- a/client/pages/administration/admin.jsx +++ b/client/pages/administration/admin.jsx @@ -1,5 +1,5 @@ import React, { useContext } from 'react'; -import { Link, Redirect } from 'react-router-dom'; +import { Link, Navigate } from 'react-router-dom'; import ApplyToBody from '../utilities/apply-to-body'; @@ -14,7 +14,7 @@ const Admin = props => { //misplaced? (admin only) if (!authTokens.accessToken || !authTokens.getPayload().admin) { - return ; + return ; } return ( diff --git a/client/pages/administration/mod.jsx b/client/pages/administration/mod.jsx index 64d28ea..419393f 100644 --- a/client/pages/administration/mod.jsx +++ b/client/pages/administration/mod.jsx @@ -1,5 +1,5 @@ import React, { useContext } from 'react'; -import { Link, Redirect } from 'react-router-dom'; +import { Link, Navigate } from 'react-router-dom'; import ApplyToBody from '../utilities/apply-to-body'; @@ -17,7 +17,7 @@ const Mod = props => { //misplaced? (admin only) if (!authTokens.accessToken || !(authTokens.getPayload().admin || authTokens.getPayload().mod)) { - return ; + return ; } return ( diff --git a/client/pages/app.jsx b/client/pages/app.jsx index c00e927..78a35b8 100644 --- a/client/pages/app.jsx +++ b/client/pages/app.jsx @@ -1,11 +1,8 @@ //react -import React, { useContext } from 'react'; -import { BrowserRouter, Switch } from 'react-router-dom'; +import React, { useContext, Suspense, lazy } from 'react'; +import { BrowserRouter, Routes, Route } from 'react-router-dom'; import { TokenContext } from './utilities/token-provider'; -//library components -import LazyRoute from './utilities/lazy-route'; - //styling import '../styles/styles.css'; @@ -13,33 +10,49 @@ import '../styles/styles.css'; import Footer from './panels/footer'; import PopupChat from './panels/popup-chat'; +//lazy wrappers +const Homepage = lazy(() => import('./homepage')); +const Signup = lazy(() => import('./accounts/signup')); +const Login = lazy(() => import('./accounts/login')); +const Account = lazy(() => import('./accounts/account')); +const Dashboard = lazy(() => import('./dashboard')); +const Recover = lazy(() => import('./accounts/recover')); +const Reset = lazy(() => import('./accounts/reset')); +const Admin = lazy(() => import('./administration/admin')); +const Mod = lazy(() => import('./administration/mod')); +const PrivacyPolicy = lazy(() => import('./static/privacy-policy')); +const Credits = lazy(() => import('./static/credits')); +const NotFound = lazy(() => import('./not-found')); + const App = props => { const authTokens = useContext(TokenContext); //default render return ( - - import('./homepage')} /> + + + } /> - import('./accounts/signup')} /> - import('./accounts/login')} /> - import('./accounts/account')} /> - import('./dashboard')} /> + } /> + } /> + } /> + } /> - import('./accounts/recover')} /> - import('./accounts/reset')} /> + } /> + } /> - import('./administration/admin')} /> - import('./administration/mod')} /> + } /> + } /> - import('./static/privacy-policy')} /> - import('./static/credits')} /> + } /> + } /> - import('./not-found')} /> - - { authTokens.accessToken ? : <> } -