From fac720c4a17cf194e1bfb427d4fbafded2cb03c0 Mon Sep 17 00:00:00 2001 From: itsfinniii <102350242+itsfinniii@users.noreply.github.com> Date: Fri, 20 Mar 2026 21:51:54 +0100 Subject: [PATCH] Create the upcoming events component --- astro/src/components/web/UpcomingEvents.astro | 41 +++++++++++++++++++ astro/src/components/webpage/Webpage.astro | 2 + astro/src/content/pages/pages.ts | 5 +++ astro/src/graphql/pages/getAllPages.graphql | 9 +++- astro/src/graphql/pages/getPage.graphql | 9 +++- astro/src/icons/CalendarIcon.astro | 8 ++++ astro/src/types/components/events.d.ts | 3 +- 7 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 astro/src/components/web/UpcomingEvents.astro create mode 100644 astro/src/icons/CalendarIcon.astro diff --git a/astro/src/components/web/UpcomingEvents.astro b/astro/src/components/web/UpcomingEvents.astro new file mode 100644 index 0000000..fee6fd1 --- /dev/null +++ b/astro/src/components/web/UpcomingEvents.astro @@ -0,0 +1,41 @@ +--- +import CalendarIcon from '@/icons/CalendarIcon.astro'; +import { Image } from 'astro:assets'; + +interface Props { + upcomingEvents: UpcomingEventsComponent; +} + +const upcomingEvents = Astro.props.upcomingEvents; +--- + +
+

Upcoming Events

+ +
+ { upcomingEvents.events.map((event) => ( +
+
+ +
+
+

{event.title}

+
+ + { event.endDate !== null ? ( +

{event.startDate} - {event.endDate}

+ ) : ( +

{event.startDate}

+ ) } +
+
+
+ )) } +
+
diff --git a/astro/src/components/webpage/Webpage.astro b/astro/src/components/webpage/Webpage.astro index ef32f9b..4c51473 100644 --- a/astro/src/components/webpage/Webpage.astro +++ b/astro/src/components/webpage/Webpage.astro @@ -1,6 +1,7 @@ --- import Hero from '../web/Hero.astro'; import TextWithImage from '../web/TextWithImage.astro'; +import UpcomingEvents from '../web/UpcomingEvents.astro'; import WallOfText from '../web/WallOfText.astro'; interface Props { @@ -18,6 +19,7 @@ console.log(Astro.props.webpage); { component.component === "Hero" && } { component.component === "TextWithImage" && } { component.component === "WallOfText" && } + { component.component === "UpcomingEvents" && } )) } diff --git a/astro/src/content/pages/pages.ts b/astro/src/content/pages/pages.ts index 99f398f..d857b37 100644 --- a/astro/src/content/pages/pages.ts +++ b/astro/src/content/pages/pages.ts @@ -118,6 +118,11 @@ export function dataToPage(pageRecord: any): WebPage { eventRecord["map_location"]["coordinates"][1], eventRecord["map_location"]["coordinates"][0] ], + thumbnail: { + url: getImageUrl(eventRecord["thumbnail"]["filename_disk"]), + width: eventRecord["thumbnail"]["width"], + height: eventRecord["thumbnail"]["height"] + }, startDate: eventRecord["start_date"], endDate: eventRecord["end_date"] }); diff --git a/astro/src/graphql/pages/getAllPages.graphql b/astro/src/graphql/pages/getAllPages.graphql index 245448c..1028cab 100644 --- a/astro/src/graphql/pages/getAllPages.graphql +++ b/astro/src/graphql/pages/getAllPages.graphql @@ -112,7 +112,14 @@ query getAllPages($date: String!) { location, map_location, start_date, - end_date + end_date, + thumbnail { + id, + created_on, + filename_disk, + width, + height + } } } diff --git a/astro/src/graphql/pages/getPage.graphql b/astro/src/graphql/pages/getPage.graphql index fe51929..a91a6d9 100644 --- a/astro/src/graphql/pages/getPage.graphql +++ b/astro/src/graphql/pages/getPage.graphql @@ -112,7 +112,14 @@ query getAllPages($date: String!, $route: String!) { location, map_location, start_date, - end_date + end_date, + thumbnail { + id, + created_on, + filename_disk, + width, + height + } } } diff --git a/astro/src/icons/CalendarIcon.astro b/astro/src/icons/CalendarIcon.astro new file mode 100644 index 0000000..450b4d4 --- /dev/null +++ b/astro/src/icons/CalendarIcon.astro @@ -0,0 +1,8 @@ +--- +interface Props { + width?: number; + height?: number; +} +--- + + diff --git a/astro/src/types/components/events.d.ts b/astro/src/types/components/events.d.ts index 10b840d..5bbf1c8 100644 --- a/astro/src/types/components/events.d.ts +++ b/astro/src/types/components/events.d.ts @@ -14,5 +14,6 @@ type UpcomingEvent = { location: string; mapLocation: [number, number]; startDate: Date; - endDate: Date; + endDate: Date; + thumbnail: PhotoProps; }