From df7b381bed85321be781f5f2d3b8d51675684a40 Mon Sep 17 00:00:00 2001
From: Shivansh Bhatnagar
Date: Mon, 10 Jun 2024 21:01:33 +0530
Subject: [PATCH] Linked to the error page
---
frontend/src/App.tsx | 1 +
frontend/src/Navbar.tsx | 6 ++++++
frontend/src/pages/Error.tsx | 12 ++++++++----
frontend/src/pages/Home.tsx | 3 ++-
4 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 2789dda..ad2063a 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -21,6 +21,7 @@ const router = createBrowserRouter([
element: ,
},
{ path: '/about', element: },
+ { path: '/error', element: },
],
},
]);
diff --git a/frontend/src/Navbar.tsx b/frontend/src/Navbar.tsx
index cb6298a..b5b59e8 100644
--- a/frontend/src/Navbar.tsx
+++ b/frontend/src/Navbar.tsx
@@ -88,6 +88,9 @@ const Navbar: React.FC = ({
fontSize="text-2xl"
buttonSize="w-[170px] h-12"
px="px-0"
+ onClick={() => {
+ window.location.href = '/error';
+ }}
/>
@@ -97,6 +100,9 @@ const Navbar: React.FC = ({
fontSize="text-2xl"
buttonSize="w-[170px] h-12"
px="px-0"
+ onClick={() => {
+ window.location.href = '/error';
+ }}
/>
diff --git a/frontend/src/pages/Error.tsx b/frontend/src/pages/Error.tsx
index 6f6b8dd..d6d23c0 100644
--- a/frontend/src/pages/Error.tsx
+++ b/frontend/src/pages/Error.tsx
@@ -1,5 +1,5 @@
-import { Link } from 'react-router-dom';
import ErrorImage from '../assets/tornCard.svg';
+import Button from '../library/button';
function Error() {
return (
@@ -21,9 +21,13 @@ function Error() {
Sorry, the page you're looking for can't be found.
Please return to the Homepage!
-
- Go back to Homepage
-
+ (window.location.href = '/')}
+ />
diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx
index 9bdd3bd..f334317 100644
--- a/frontend/src/pages/Home.tsx
+++ b/frontend/src/pages/Home.tsx
@@ -9,12 +9,13 @@ const Home: React.FC = () => {
const CreateGame = () => {
// Logic to create a game
console.log('Create Game');
- navigate('/game');
+ navigate('/error');
};
const JoinGame = () => {
// Logic to join a game
console.log('Join Game with code');
+ navigate('/error');
};
const [isLoggedIn, setIsLoggedIn] = useState(false);