diff --git a/bun.lockb b/bun.lockb index c0a45b6..e615322 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index ea09056..a7ca6ff 100644 --- a/package.json +++ b/package.json @@ -5,29 +5,29 @@ "dependencies": { "@chakra-ui/icons": "^2.1.1", "@chakra-ui/react": "^2.8.2", - "@emotion/react": "^11.11.1", - "@emotion/styled": "^11.11.0", + "@emotion/react": "^11.13.3", + "@emotion/styled": "^11.13.0", "@hookstate/core": "^4.0.1", "@hookstate/localstored": "^4.0.2", - "axios": "^1.5.0", + "axios": "1.7.5", "bson-objectid": "^2.0.4", - "chakra-react-select": "^4.7.2", + "chakra-react-select": "^4.9.1", "chakra-ui-contextmenu": "^1.0.5", - "framer-motion": "^10.16.4", + "framer-motion": "^11.3.30", "interweave": "^13.1.0", - "jodit-react": "^1.3.39", - "js-base64": "^3.7.5", - "react": "^18.2.0", + "jodit-react": "^4.1.2", + "js-base64": "^3.7.7", + "react": "^18.3.1", "react-device-detect": "^2.2.3", - "react-dom": "^18.2.0", - "react-hook-form": "^7.48.2", - "react-icons": "^4.11.0", + "react-dom": "^18.3.1", + "react-hook-form": "^7.53.0", + "react-icons": "^5.3.0", "react-rating": "^2.0.5", "react-responsive-carousel": "^3.2.23", - "react-router-dom": "^5.3.4", - "react-select": "^5.7.4", - "react-toastify": "^9.1.3", - "web-vitals": "^3.4.0" + "react-router-dom": "^6.26.1", + "react-select": "^5.8.0", + "react-toastify": "^10.0.5", + "web-vitals": "^4.2.3" }, "scripts": { "start": "bunx --bun vite", @@ -60,17 +60,16 @@ "devDependencies": { "@chakra-ui/cli": "^2.4.1", "@hookstate/devtools": "^4.0.1", - "@testing-library/jest-dom": "^6.1.3", - "@testing-library/react": "^14.0.0", - "@testing-library/user-event": "^14.4.3", - "@types/jest": "^29.5.4", - "@types/node": "^20.6.0", + "@testing-library/jest-dom": "^6.5.0", + "@testing-library/react": "^16.0.0", + "@testing-library/user-event": "^14.5.2", + "@types/jest": "^29.5.12", + "@types/node": "^22.5.1", "@types/react": "^18.2.21", "@types/react-dom": "^18.2.7", - "@types/react-router-dom": "^5.3.3", - "@types/react-table": "^7.7.15", - "@vitejs/plugin-react": "^4.0.4", - "typescript": "^5.2.2", - "vite": "^4.4.9" + "@types/react-table": "^7.7.20", + "@vitejs/plugin-react": "^4.3.1", + "typescript": "^5.5.4", + "vite": "^5.4.2" } } diff --git a/src/App.tsx b/src/App.tsx index fc7db19..45e72cb 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,11 +1,10 @@ import React, { useEffect } from 'react' import GameDashboard from './components/GamesDashboard' -import { Redirect, Route, Switch, useLocation } from 'react-router-dom' +import {Navigate, Route, Routes, useLocation, useNavigate} from 'react-router-dom' import Header from './components/Header' import Home from './components/Home' import GameDetails from './components/GameDetails' import GameForm from './components/GameForm' -import NotFound from './errors/NotFound' import TestErrors from './errors/TestError' import Footer from './components/Footer' import LoginForm from './components/authComponents/LoginForm' @@ -20,21 +19,22 @@ import { ToastContainer } from 'react-toastify' import NoGames from './components/NoGames' import CreateUser from './components/userComponents/CreateUser' import LoadingModal from './components/LoadingModal' -import SomethingWentWrong from './errors/SomethingWentWrong' import ForgotPassword from './components/authComponents/ForgotPassword' import ResetPassword from './components/authComponents/ResetPassword' import UserProfile from './components/userComponents/UserProfile' import EditUser from './components/userComponents/EditUser' import {Box, useColorMode} from "@chakra-ui/react"; +import globalRouter from "./api/globalRouter"; function App() { - const location = useLocation() + const location = useLocation() const appLoaded = useHookstate(appLoadedState) const appLoad = appLoaded.get() const isLoggedIn = useHookstate(loggedInState) const loggedIn = isLoggedIn.get() const originalToken = window.localStorage.getItem('jwt') const { colorMode, toggleColorMode } = useColorMode() + globalRouter.navigate = useNavigate() useEffect(() => { if (originalToken) getUser(originalToken).finally(() => setAppLoaded(true)) @@ -55,54 +55,27 @@ function App() { <> {loggedIn ?
: ''} - - {loggedIn ? : } - {/**/} - + + : } /> + } /> } + path={'games/:id/edit'} + element={} /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + } /> + {loggedIn ?