From f825d57e4b4365e8326e9f4565a3b33f9c229f6e Mon Sep 17 00:00:00 2001
From: liquidwater0 <32186774+liquidwater0@users.noreply.github.com>
Date: Thu, 3 Apr 2025 01:34:25 -0500
Subject: [PATCH 1/5] maybe fix build errors
---
web/src/app/maps/[mapId]/page.tsx | 6 +++---
web/src/app/maps/page.tsx | 12 ++++++++----
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/web/src/app/maps/[mapId]/page.tsx b/web/src/app/maps/[mapId]/page.tsx
index 48e8bcc..36cbdbd 100644
--- a/web/src/app/maps/[mapId]/page.tsx
+++ b/web/src/app/maps/[mapId]/page.tsx
@@ -2,16 +2,16 @@ import Webpage from "@/app/_components/webpage";
interface MapParams {
params: {
- mapid: string;
+ mapId: string;
};
}
export default function Map({ params }: MapParams) {
- const { mapid } = params;
+ const { mapId } = params;
return (
- map { mapid }
+ map { mapId }
);
}
\ No newline at end of file
diff --git a/web/src/app/maps/page.tsx b/web/src/app/maps/page.tsx
index 5729a36..3272077 100644
--- a/web/src/app/maps/page.tsx
+++ b/web/src/app/maps/page.tsx
@@ -1,12 +1,16 @@
import Webpage from "@/app/_components/webpage";
export default async function MapsPage() {
- const ingameMaps = fetch("/api/maps?Page=1&Limit=10");
-
try {
- console.log(ingameMaps);
+ const response = await fetch("/api/maps?Page=1&Limit=10");
+ const json = await response.json();
+ console.log(json);
} catch(error) {
- console.log(error);
+ return (
+
+ No Maps!
+
+ )
}
return (
--
2.49.1
From 6af018a3ab4bd1a3b05eb43da5a9c6be61884942 Mon Sep 17 00:00:00 2001
From: liquidwater0 <32186774+liquidwater0@users.noreply.github.com>
Date: Thu, 3 Apr 2025 01:47:33 -0500
Subject: [PATCH 2/5] log the error
---
web/src/app/maps/page.tsx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/web/src/app/maps/page.tsx b/web/src/app/maps/page.tsx
index 3272077..4307d42 100644
--- a/web/src/app/maps/page.tsx
+++ b/web/src/app/maps/page.tsx
@@ -6,6 +6,8 @@ export default async function MapsPage() {
const json = await response.json();
console.log(json);
} catch(error) {
+ console.log(error);
+
return (
No Maps!
--
2.49.1
From 2837743f0a3f51719e5823cc9def4e1eb65228e3 Mon Sep 17 00:00:00 2001
From: Quaternions
Date: Thu, 3 Apr 2025 00:49:32 -0700
Subject: [PATCH 3/5] web: useParams
---
web/src/app/maps/[mapId]/page.tsx | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/web/src/app/maps/[mapId]/page.tsx b/web/src/app/maps/[mapId]/page.tsx
index 36cbdbd..f2152ea 100644
--- a/web/src/app/maps/[mapId]/page.tsx
+++ b/web/src/app/maps/[mapId]/page.tsx
@@ -1,17 +1,12 @@
import Webpage from "@/app/_components/webpage";
+import { useParams } from "next/navigation";
-interface MapParams {
- params: {
- mapId: string;
- };
-}
-
-export default function Map({ params }: MapParams) {
- const { mapId } = params;
+export default function Map() {
+ const { mapId } = useParams<{mapId: string}>()
return (
map { mapId }
);
-}
\ No newline at end of file
+}
--
2.49.1
From 791f4f4051cb26a5514bf4f3d00a89965d39f235 Mon Sep 17 00:00:00 2001
From: liquidwater0 <32186774+liquidwater0@users.noreply.github.com>
Date: Thu, 3 Apr 2025 02:55:36 -0500
Subject: [PATCH 4/5] turn maps page into client component
---
web/src/app/maps/page.tsx | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/web/src/app/maps/page.tsx b/web/src/app/maps/page.tsx
index 4307d42..1e28448 100644
--- a/web/src/app/maps/page.tsx
+++ b/web/src/app/maps/page.tsx
@@ -1,19 +1,20 @@
+"use client"
+
+import { useState, useEffect } from "react";
import Webpage from "@/app/_components/webpage";
-export default async function MapsPage() {
- try {
- const response = await fetch("/api/maps?Page=1&Limit=10");
- const json = await response.json();
- console.log(json);
- } catch(error) {
- console.log(error);
-
- return (
-
- No Maps!
-
- )
- }
+export default function MapsPage() {
+ const [ingameMaps, setIngameMaps] = useState();
+
+ useEffect(() => {
+ fetch("/api/maps?Page=1&Limit=10")
+ .then(response => response.json())
+ .then(setIngameMaps);
+ }, []);
+
+ useEffect(() => {
+ console.log(ingameMaps);
+ }, [ingameMaps]);
return (
--
2.49.1
From 60fb728a97071d6ce46f34644ace30a792c5b951 Mon Sep 17 00:00:00 2001
From: Quaternions
Date: Thu, 3 Apr 2025 00:59:36 -0700
Subject: [PATCH 5/5] web: use client
---
web/src/app/maps/[mapId]/page.tsx | 2 ++
1 file changed, 2 insertions(+)
diff --git a/web/src/app/maps/[mapId]/page.tsx b/web/src/app/maps/[mapId]/page.tsx
index f2152ea..2b49117 100644
--- a/web/src/app/maps/[mapId]/page.tsx
+++ b/web/src/app/maps/[mapId]/page.tsx
@@ -1,3 +1,5 @@
+"use client"
+
import Webpage from "@/app/_components/webpage";
import { useParams } from "next/navigation";
--
2.49.1