Skip to content

Commit

Permalink
Merge pull request #139 from sopra-fs24-group-09/dev
Browse files Browse the repository at this point in the history
Merge main when we have a relatively stable version for deployed testing
  • Loading branch information
yixuan-zhou-uzh authored May 8, 2024
2 parents 2df2090 + 9afcbaa commit 736d9c4
Show file tree
Hide file tree
Showing 29 changed files with 943 additions and 983 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
"padding-line-between-statements": [
"warn",
{ "blankLine": "always", "prev": "*", "next": "export" }
],
"no-magic-numbers": [
"warn",
{ "ignore": [0, 1], "ignoreArrayIndexes": true }
]
},
"ignorePatterns": ["node_modules", "build", "dist", "public"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# SoPra FS24 - Client Template with build pack

## Getting started

Read and go through these Tutorials. It will make your life easier:)
Expand Down
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
"@ffmpeg/ffmpeg": "^0.12.10",
"axios": "^1.6.7",
"eslint-config-react-app": "^7.0.1",
"lodash": "^4.17.21",
"net": "^1.0.2",
"react": "^18.2.0",
"react-datepicker": "^6.2.0",
"react-dom": "^18.2.0",
"react-icons": "^5.0.1",
"react-router-dom": "^6.21.3",
"react-scripts": "^5.0.1",
"react-toastify": "^10.0.5",
"serve": "^14.2.1",
"sockjs-client": "^1.6.1",
"stompjs": "^2.3.3",
Expand Down
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<head>
<meta charset="utf-8">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="shortcut icon" href="%PUBLIC_URL%/webicon.svg">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
Expand Down
48 changes: 48 additions & 0 deletions public/webicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from "react";
import AppRouter from "./components/routing/routers/AppRouter";
import { ToastContainer } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";

/**
* Happy coding!
Expand All @@ -10,6 +12,7 @@ import AppRouter from "./components/routing/routers/AppRouter";
const App = () => {
return (
<div>
<ToastContainer />
<AppRouter />
</div>
);
Expand Down
19 changes: 7 additions & 12 deletions src/components/routing/routers/AppRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import {LoginGuard} from "../routeProtectors/LoginGuard";
import Register from "../../views/Register";
import Login from "../../views/Login";
import Gameroom from "../../views/Gameroom";
import Profile from "../../views/Profile";
import EditProfile from "../../views/Editprofile";
/**
* Main router of your application.
* In the following class, different routes are rendered. In our case, there is a Login Route with matches the path "/login"
Expand All @@ -21,9 +19,13 @@ const AppRouter = () => {
return (
<BrowserRouter>
<Routes>
{/* global guard for all the routes */}
<Route path="/*" element={<LoginGuard />}>
<Route path="*" element={<Navigate to="/login" />} />
</Route>

<Route path="/lobby/*" element={<LobbyGuard />}>
<Route path="/lobby/*" element={<LobbyRouter base="/lobby"/>} />
<Route path="*" element={<LobbyRouter base="/lobby"/>} />
</Route>

<Route path="/login" element={<LoginGuard />}>
Expand All @@ -34,17 +36,10 @@ const AppRouter = () => {
<Route path="/register" element={<Register/>} />
</Route>

{/* guard to user profile page */}
<Route path="/user/:id" element={<LobbyGuard />}>
<Route index element={<Profile />} />
</Route>

{/* no guard for gameroom page now*/}
{/* the parameter name should match with the useParam in the Gameroom */}
<Route path="/rooms/:currentRoomID/:currentRoomName" element={<Gameroom/>} />

<Route path="/editprofile" element={<LobbyGuard />}>
<Route index element={<EditProfile />} />
<Route path="/rooms/:currentRoomID/:currentRoomName" element={<LobbyGuard/>} >
<Route path="" element={<Gameroom />} />
</Route>

<Route path="/" element={
Expand Down
9 changes: 3 additions & 6 deletions src/components/routing/routers/LobbyRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ const LobbyRouter = () => {
<div style={{display: "flex", flexDirection: "column"}}>
<Routes>

<Route path="" element={<Lobby />} />

<Route path="dashboard" element={<Lobby />} />

<Route path="*" element={<Navigate to="dashboard" replace />} />
<Route path="/" element={<Lobby />} />
<Route path="*" element={<Navigate to="/" />} />

</Routes>

</div>
);
};
Expand Down
Loading

0 comments on commit 736d9c4

Please sign in to comment.