Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions client/src/pages/games/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { SocialIcon } from "react-social-icons";

import { GameEmbed } from "@/components/ui/GameEmbed";
import { ItchEmbed } from "@/components/ui/ItchEmbed";
import { useEvent } from "@/hooks/useEvent";
import { useGame } from "@/hooks/useGames";

export default function IndividualGamePage() {
Expand All @@ -17,6 +18,9 @@ export default function IndividualGamePage() {
error,
isError,
} = useGame(router.isReady ? id : undefined);
const { data: eventData } = useEvent(
game?.event ? String(game.event) : undefined,
);

if (isPending) {
return (
Expand Down Expand Up @@ -55,6 +59,8 @@ export default function IndividualGamePage() {
const gameEmbedID = game.itchGameEmbedID;
const gameWidth = game.itchGameWidth;
const gameHeight = game.itchGameHeight;
const eventID = game.event;
const eventName = eventData?.name || "";

const completionLabels: Record<number, string> = {
1: "WIP",
Expand All @@ -65,8 +71,6 @@ export default function IndividualGamePage() {

const devStage = completionLabels[game.completion] ?? "Stage Unknown";

// TODO ADD EVENT
const event = "Game Jam November 2025";
// TODO ADD ARTIMAGES
const artImages: { src: string; alt: string }[] = [];
// const artImages = [
Expand Down Expand Up @@ -173,7 +177,20 @@ export default function IndividualGamePage() {
<td className="py-1 pr-2 text-muted-foreground sm:py-2">
Event
</td>
<td className="py-1 text-right sm:py-2">{event}</td>
<td className="py-1 text-right sm:py-2">
{eventID && eventName ? (
<a
href={`/events/${eventID}`}
className="text-primary hover:underline"
>
{eventName}
</a>
) : (
<span className="text-muted-foreground">
No past/upcoming event
</span>
)}
</td>
</tr>
</tbody>
</table>
Expand Down
11 changes: 10 additions & 1 deletion server/game_dev/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,16 @@ class EventDetailAPIView(generics.RetrieveAPIView):
lookup_url_kwarg = "id"

def get_queryset(self):
return Event.objects.filter(id=self.kwargs["id"])
now = timezone.now().date()
return Event.objects.filter(id=self.kwargs["id"], publicationDate__lte=now)

def get_object(self):
queryset = self.get_queryset()
try:
return queryset.get()
except Event.DoesNotExist:
from rest_framework.exceptions import NotFound
raise NotFound(detail="The event is not yet published by admin or does not exist.")


class GameshowcaseAPIView(APIView):
Expand Down
Loading