diff --git a/app/api/arena/games/[id]/route.ts b/app/api/arena/games/[id]/route.ts index 958da7f..4f0e25c 100644 --- a/app/api/arena/games/[id]/route.ts +++ b/app/api/arena/games/[id]/route.ts @@ -3,10 +3,11 @@ import { getGameById } from '@/lib/db'; export async function GET( req: Request, - context: Promise<{ params: { id: string } }> + context: Promise<{ params: Promise<{ id: string }> }> ) { try { - const { id } = (await context).params; + const params = await context; + const { id } = await params.params; const gameId = parseInt(id); if (isNaN(gameId)) { diff --git a/app/arena/[id]/page.tsx b/app/arena/[id]/page.tsx index 47f9fe6..83a509c 100644 --- a/app/arena/[id]/page.tsx +++ b/app/arena/[id]/page.tsx @@ -4,9 +4,8 @@ import { useEffect, useState } from 'react'; import { useParams, useRouter } from 'next/navigation'; import { useSession } from 'next-auth/react'; import SignIn from '@/components/auth/SignIn'; -import styles from '../arena.module.css'; import { usePlayTimeSession } from '@/context/PlayTimeContext'; -import Popup from '@/components/popup/Popup'; +import Popup from '@/components/popup/Popup'; interface Game { id: number; @@ -18,6 +17,7 @@ interface Game { details: string; category: string[]; publisher: string; + type: string; } export default function GameDetailPage() { @@ -51,17 +51,6 @@ export default function GameDetailPage() { } }, [params?.id]); - if (status === 'loading' || loading) { - return ( -
-
-

Loading Game

-
- {/* ...loading skeleton UI... */} -
- ); - } - function handleOnClickPlay() { if (isExpired) { setPopup(true); @@ -70,11 +59,72 @@ export default function GameDetailPage() { router.push(`/arena/play-game?Id=${game?.id}&Name=${game?.buildName}`); } + if (status === 'loading' || loading) { + return ( +
+ {/* Header Skeleton */} +
+
+
+
+
+
+ +
+
+ {/* Media Preview Skeleton */} +
+
+
+
+ {[...Array(3)].map((_, i) => ( +
+ ))} +
+
+
+ + {/* Details Skeleton */} +
+
+
+
+
+
+
+
+
+
+
+
+ ); + } + if (!session) return ; - if (!game) return
Game not found.
; + + if (!game) { + return ( +
+
+
+ 😞 +
+

Game Not Found

+

The game you're looking for doesn't exist or may have been removed.

+ +
+
+ ); + } return ( -
+
+ {/* Popup */} {popup && ( )} -
-

{game.title}

-
- -
-
-
- {activeIndex < game.image.length ? ( - {`${game.title} - ) : ( -