From 78c40c7e3df6d2b545b93c8065312e9fc449be70 Mon Sep 17 00:00:00 2001 From: saltyypringle Date: Sat, 21 Feb 2026 14:40:07 +0800 Subject: [PATCH 1/2] added workshop link to models and events --- client/src/hooks/useEvent.ts | 5 ++++- client/src/hooks/useEvents.ts | 5 ++++- client/src/pages/events/[id].tsx | 13 +++++++++++++ .../migrations/0015_event_workshop_link.py | 16 ++++++++++++++++ server/game_dev/models.py | 1 + server/game_dev/serializers.py | 1 + server/game_dev/tests.py | 5 +++++ 7 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 server/game_dev/migrations/0015_event_workshop_link.py diff --git a/client/src/hooks/useEvent.ts b/client/src/hooks/useEvent.ts index 27794c6b..830b3b7d 100644 --- a/client/src/hooks/useEvent.ts +++ b/client/src/hooks/useEvent.ts @@ -12,10 +12,12 @@ type ApiEvent = { startTime: string | null; location: string; cover_image: string | null; + workshop_link: string; }; -type UiEvent = Omit & { +type UiEvent = Omit & { coverImage: string; + workshopLink: string; }; /** @@ -33,6 +35,7 @@ function transformApiEventToUiEvent(data: ApiEvent): UiEvent { return { ...data, coverImage: data.cover_image ?? "/game_dev_club_logo.svg", + workshopLink: data.workshop_link, }; } diff --git a/client/src/hooks/useEvents.ts b/client/src/hooks/useEvents.ts index 674d1a06..5d8922d2 100644 --- a/client/src/hooks/useEvents.ts +++ b/client/src/hooks/useEvents.ts @@ -12,16 +12,19 @@ type ApiEvent = { startTime: string | null; location: string; cover_image: string | null; + workshop_link: string; }; -export type UiEvent = Omit & { +export type UiEvent = Omit & { coverImage: string; + workshopLink: string; }; function transformApiEventToUiEvent(data: ApiEvent): UiEvent { return { ...data, coverImage: data.cover_image ?? "/game_dev_club_logo.svg", + workshopLink: data.workshop_link, }; } diff --git a/client/src/pages/events/[id].tsx b/client/src/pages/events/[id].tsx index 8e8d8803..5f58a89a 100644 --- a/client/src/pages/events/[id].tsx +++ b/client/src/pages/events/[id].tsx @@ -75,6 +75,19 @@ export default function EventPage() {

{event.description}

+ {event.workshopLink && ( +

+ Workshop link: + + {event.workshopLink} + +

+ )}
Date: Sun, 1 Mar 2026 14:10:13 +0800 Subject: [PATCH 2/2] camelcased coverImage and workshopLink, minor css frontend tweaks --- client/src/components/ui/EventDateDisplay.tsx | 25 +++++++++++++------ client/src/hooks/useEvent.ts | 10 +++----- client/src/hooks/useEvents.ts | 9 +++---- client/src/pages/events/[id].tsx | 8 +++--- .../migrations/0015_event_workshop_link.py | 16 ------------ ...e_cover_image_event_coverimage_and_more.py | 23 +++++++++++++++++ server/game_dev/models.py | 4 +-- server/game_dev/serializers.py | 4 +-- server/game_dev/tests.py | 10 ++++---- 9 files changed, 63 insertions(+), 46 deletions(-) delete mode 100644 server/game_dev/migrations/0015_event_workshop_link.py create mode 100644 server/game_dev/migrations/0029_rename_cover_image_event_coverimage_and_more.py diff --git a/client/src/components/ui/EventDateDisplay.tsx b/client/src/components/ui/EventDateDisplay.tsx index d7b97c89..c8172b8e 100644 --- a/client/src/components/ui/EventDateDisplay.tsx +++ b/client/src/components/ui/EventDateDisplay.tsx @@ -32,6 +32,20 @@ export function getEventDateParts(dateString: string): EventDateParts | null { } } +const getOrdinal = (d: number) => { + if (d > 3 && d < 21) return `${d}th`; + switch (d % 10) { + case 1: + return `${d}st`; + case 2: + return `${d}nd`; + case 3: + return `${d}rd`; + default: + return `${d}th`; + } +}; + type EventDateDisplayProps = { date: string }; /** Renders event date as: weekday・ day month・ time. */ @@ -39,13 +53,10 @@ export function EventDateDisplay({ date }: EventDateDisplayProps) { const parts = getEventDateParts(date); if (!parts) return null; return ( -
- - {parts.weekday} - {"・"} - - - {parts.day} {parts.month} +
+ {parts.weekday}, + + {getOrdinal(parseInt(parts.day))} {parts.month} {"・"} {parts.time} diff --git a/client/src/hooks/useEvent.ts b/client/src/hooks/useEvent.ts index 830b3b7d..f5cd607a 100644 --- a/client/src/hooks/useEvent.ts +++ b/client/src/hooks/useEvent.ts @@ -11,13 +11,12 @@ type ApiEvent = { date: string; startTime: string | null; location: string; - cover_image: string | null; - workshop_link: string; + coverImage: string | null; + workshopLink: string; }; -type UiEvent = Omit & { +type UiEvent = Omit & { coverImage: string; - workshopLink: string; }; /** @@ -34,8 +33,7 @@ function normalizeEventId( function transformApiEventToUiEvent(data: ApiEvent): UiEvent { return { ...data, - coverImage: data.cover_image ?? "/game_dev_club_logo.svg", - workshopLink: data.workshop_link, + coverImage: data.coverImage ?? "/game_dev_club_logo.svg", }; } diff --git a/client/src/hooks/useEvents.ts b/client/src/hooks/useEvents.ts index 18e674ee..f97cb7fd 100644 --- a/client/src/hooks/useEvents.ts +++ b/client/src/hooks/useEvents.ts @@ -10,11 +10,11 @@ type ApiEvent = { publicationDate: string; date: string; location: string; - cover_image: string | null; - workshop_link: string; + coverImage: string | null; + workshopLink: string; }; -export type UiEvent = Omit & { +export type UiEvent = Omit & { coverImage: string; workshopLink: string; }; @@ -22,8 +22,7 @@ export type UiEvent = Omit & { function transformApiEventToUiEvent(data: ApiEvent): UiEvent { return { ...data, - coverImage: data.cover_image ?? "/game_dev_club_logo.svg", - workshopLink: data.workshop_link, + coverImage: data.coverImage ?? "/game_dev_club_logo.svg", }; } diff --git a/client/src/pages/events/[id].tsx b/client/src/pages/events/[id].tsx index 9374ff40..ec53f25a 100644 --- a/client/src/pages/events/[id].tsx +++ b/client/src/pages/events/[id].tsx @@ -58,13 +58,15 @@ export default function EventPage() {

-
{event.location}
+
+ {event.location}{" "} +

{event.description}

{event.workshopLink && ( -

- Workshop link: +

+ Workshop link:{" "}