11import Image from "next/image" ;
2+ import Link from "next/link" ;
23import { useRouter } from "next/router" ;
34import React from "react" ;
45import { SocialIcon } from "react-social-icons" ;
56
67import { GameEmbed } from "@/components/ui/GameEmbed" ;
78import { ItchEmbed } from "@/components/ui/ItchEmbed" ;
9+ import { useEvent } from "@/hooks/useEvent" ;
810import { useGame } from "@/hooks/useGames" ;
911
1012export default function IndividualGamePage ( ) {
@@ -17,6 +19,9 @@ export default function IndividualGamePage() {
1719 error,
1820 isError,
1921 } = useGame ( router . isReady ? id : undefined ) ;
22+ const { data : eventData } = useEvent (
23+ game ?. event ? String ( game . event ) : undefined ,
24+ ) ;
2025
2126 if ( isPending ) {
2227 return (
@@ -55,6 +60,8 @@ export default function IndividualGamePage() {
5560 const gamePlayableID = game . itchGamePlayableID ;
5661 const gameWidth = game . itchGameWidth ;
5762 const gameHeight = game . itchGameHeight ;
63+ const eventID = game . event ;
64+ const eventName = eventData ?. name || "" ;
5865
5966 const completionLabels : Record < number , string > = {
6067 1 : "WIP" ,
@@ -65,8 +72,6 @@ export default function IndividualGamePage() {
6572
6673 const devStage = completionLabels [ game . completion ] ?? "Stage Unknown" ;
6774
68- // TODO ADD EVENT
69- const event = "Game Jam November 2025" ;
7075 // TODO ADD ARTIMAGES
7176 const artImages : { src : string ; alt : string } [ ] = [ ] ;
7277 // const artImages = [
@@ -130,12 +135,12 @@ export default function IndividualGamePage() {
130135 key = { c . member_id }
131136 className = "flex items-center gap-x-2"
132137 >
133- < a
138+ < Link
134139 href = { `/members/${ c . member_id } ` }
135140 className = "text-primary hover:underline"
136141 >
137142 { c . name }
138- </ a >
143+ </ Link >
139144 { Array . isArray ( c . social_media ) &&
140145 c . social_media . map ( ( sm ) => (
141146 < SocialIcon
@@ -157,24 +162,39 @@ export default function IndividualGamePage() {
157162 </ td >
158163 < td className = "py-1 text-right sm:py-2" > { devStage } </ td >
159164 </ tr >
160- < tr className = "border-b-2 border-gray-300" >
161- < td className = "py-1 pr-2 text-muted-foreground sm:py-2" >
162- Host Site
163- </ td >
164- < td className = "py-1 text-right sm:py-2" >
165- < a
166- href = { game . hostURL }
167- className = "text-primary underline hover:underline"
168- >
169- { game . hostURL }
170- </ a >
171- </ td >
172- </ tr >
165+ { game . hostURL && (
166+ < tr className = "border-b-2 border-gray-300" >
167+ < td className = "py-1 pr-2 text-muted-foreground sm:py-2" >
168+ Host Site
169+ </ td >
170+ < td className = "py-1 text-right sm:py-2" >
171+ < a
172+ href = { game . hostURL }
173+ className = "text-primary underline hover:underline"
174+ >
175+ { game . hostURL }
176+ </ a >
177+ </ td >
178+ </ tr >
179+ ) }
173180 < tr >
174181 < td className = "py-1 pr-2 text-muted-foreground sm:py-2" >
175182 Event
176183 </ td >
177- < td className = "py-1 text-right sm:py-2" > { event } </ td >
184+ < td className = "py-1 text-right sm:py-2" >
185+ { eventID && eventName ? (
186+ < Link
187+ href = { `/events/${ eventID } ` }
188+ className = "text-primary hover:underline"
189+ >
190+ { eventName }
191+ </ Link >
192+ ) : (
193+ < span className = "text-muted-foreground" >
194+ No past/upcoming event
195+ </ span >
196+ ) }
197+ </ td >
178198 </ tr >
179199 </ tbody >
180200 </ table >
0 commit comments