+

+
+
+ 404 Not Found
+
+
+ {hasStarted && !gameOver && (
+
Score: {score}
+ )}
+ {renderBlocks.map((block, index) => (
+
+
+
+
+ ))}
+ {gameOver && (
+
+
You have killed the bird
+
Your Score is {score}
+
window.location.reload()}
+ />
+
+ )}
+
+ );
+};
diff --git a/code/frontend/src/pages/404Page/notFound.css b/code/frontend/src/pages/404Page/notFound.css
new file mode 100644
index 0000000..9c33d17
--- /dev/null
+++ b/code/frontend/src/pages/404Page/notFound.css
@@ -0,0 +1,81 @@
+.text {
+ position: absolute;
+ width: 100%;
+ top: 50%;
+ left: 50%;
+ margin: 0;
+ transform: translate(-50%, -50%);
+ color: white;
+ font-size: 48px;
+ font-weight: bold;
+ z-index: 5;
+}
+.game-container {
+ width: 100vw;
+ height: calc(100vh - var(--header-height));
+ cursor: pointer;
+ overflow: hidden;
+ position: relative;
+}
+
+.bird {
+ position: relative;
+ width: 50px;
+ height: 50px;
+ top: 50%;
+ left: 50%;
+ transform: translate(0, -10px);
+ color: black;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+}
+.points {
+ position: fixed;
+ top: 70px;
+ left: 10px;
+ background-color: var(--Rotkehlchen-gray);
+ padding: 5px 10px;
+ border-radius: 10px;
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ user-select: none;
+ pointer-events: none;
+ z-index: 50;
+}
+.gameOver {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ transform: translate(-50%, -50%);
+ background-color: rgba(13, 10, 56, 0.71);
+ color: white;
+ padding: 30px;
+ border-radius: 15px;
+ box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
+ text-align: center;
+ z-index: 1000;
+}
+.tree-trunk {
+ width: 60px;
+ position: absolute;
+ background: repeating-linear-gradient(
+ 45deg,
+ #8b5a2b,
+ #8b5a2b 10px,
+ #a0522d 10px,
+ #a0522d 20px
+ );
+
+ box-shadow: inset 0 0 10px #5c4033;
+}
+.bottom {
+ border-start-start-radius: 20px;
+ border-start-end-radius: 20px;
+}
+.top {
+ border-end-start-radius: 20px;
+ border-end-end-radius: 20px;
+}
diff --git a/code/frontend/src/pages/LoginAndSignUpPage.tsx b/code/frontend/src/pages/LoginAndSignUpPage.tsx
index 29dcbf0..185ac7b 100644
--- a/code/frontend/src/pages/LoginAndSignUpPage.tsx
+++ b/code/frontend/src/pages/LoginAndSignUpPage.tsx
@@ -44,12 +44,12 @@ function LoginAndSignUpPage({ signupProp }: { signupProp: boolean }) {
setErrorMessages(undefined);
try {
const response = signup
- ? await api.post("http://localhost:3001/api/user/register", {
+ ? await api.post("/user/register", {
email: formData.email,
username: formData.username,
password: formData.password,
})
- : await api.post("http://localhost:3001/api/user/login", {
+ : await api.post("/user/login", {
username: formData.username,
password: formData.password,
});
@@ -65,7 +65,14 @@ function LoginAndSignUpPage({ signupProp }: { signupProp: boolean }) {
await setUserState();
navigate(returnTo, { replace: true });
} catch (err: any) {
- setErrorMessages(err.response.data);
+ if (err.response?.data) {
+ setErrorMessages(err.response.data);
+ } else {
+ setErrorMessages({
+ error: "Error",
+ details: [{ message: err.message || "Something went wrong." }],
+ });
+ }
}
};
@@ -142,10 +149,10 @@ function LoginAndSignUpPage({ signupProp }: { signupProp: boolean }) {
minLength={signup ? 8 : undefined}
/>
- {errorMessages && (
+ {errorMessages && errorMessages?.details?.length > 0 && (
- {errorMessages.details.map((detial, index) => (
-
{detial.message}
+ {errorMessages.details.map((detail, index) => (
+
{detail.message}
))}
)}