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
5 changes: 4 additions & 1 deletion client/src/hooks/useEvent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ type ApiEvent = {
startTime: string | null;
location: string;
cover_image: string | null;
workshop_link: string;
};

type UiEvent = Omit<ApiEvent, "cover_image"> & {
type UiEvent = Omit<ApiEvent, "cover_image" | "workshop_link"> & {
coverImage: string;
workshopLink: string;
};

/**
Expand All @@ -33,6 +35,7 @@ function transformApiEventToUiEvent(data: ApiEvent): UiEvent {
return {
...data,
coverImage: data.cover_image ?? "/game_dev_club_logo.svg",
workshopLink: data.workshop_link,
};
}

Expand Down
5 changes: 4 additions & 1 deletion client/src/hooks/useEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,19 @@ type ApiEvent = {
startTime: string | null;
location: string;
cover_image: string | null;
workshop_link: string;
};

export type UiEvent = Omit<ApiEvent, "cover_image"> & {
export type UiEvent = Omit<ApiEvent, "cover_image" | "workshop_link"> & {
coverImage: string;
workshopLink: string;
};

function transformApiEventToUiEvent(data: ApiEvent): UiEvent {
return {
...data,
coverImage: data.cover_image ?? "/game_dev_club_logo.svg",
workshopLink: data.workshop_link,
};
}

Expand Down
13 changes: 13 additions & 0 deletions client/src/pages/events/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ export default function EventPage() {
<p className="mt-4 max-w-lg text-base leading-relaxed">
{event.description}
</p>
{event.workshopLink && (
<p className="mt-4 text-base">
Workshop link:
<a
href={event.workshopLink}
target="_blank"
rel="noreferrer"
className="underline"
>
{event.workshopLink}
</a>
</p>
)}
</div>
<div className="lg:w-128 relative aspect-[4/3] w-full flex-shrink-0 overflow-hidden rounded-lg bg-gray-700 md:w-96">
<Image
Expand Down
16 changes: 16 additions & 0 deletions server/game_dev/migrations/0015_event_workshop_link.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("game_dev", "0014_merge_20260214_1420"),
]

operations = [
migrations.AddField(
model_name="event",
name="workshop_link",
field=models.URLField(blank=True, max_length=2083),
),
]
1 change: 1 addition & 0 deletions server/game_dev/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Event(models.Model):
publicationDate = models.DateField()
cover_image = models.ImageField(upload_to="events/", null=True)
location = models.CharField(max_length=256)
workshop_link = models.URLField(max_length=2083, blank=True)

def __str__(self):
return self.name
Expand Down
1 change: 1 addition & 0 deletions server/game_dev/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Meta:
"publicationDate",
"cover_image",
"location",
"workshop_link",
]


Expand Down
5 changes: 5 additions & 0 deletions server/game_dev/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def setUp(self):
publicationDate=self.pub_date,
cover_image=image_file,
location="Ezone",
workshop_link="https://example.com/workshop",
)

def test_publication_date_is_date(self):
Expand Down Expand Up @@ -73,6 +74,10 @@ def test_event_datetime_matches(self):
event = Event.objects.get(pk=self.event.pk)
self.assertEqual(event.date, self.event_datetime)

def test_workshop_link_matches(self):
event = Event.objects.get(pk=self.event.pk)
self.assertEqual(event.workshop_link, "https://example.com/workshop")


class CommitteeModelTest(TestCase):
def setUp(self):
Expand Down
Loading