diff --git a/src/components/dashboard/EventsSection/EventLoad.tsx b/src/components/dashboard/EventsSection/EventLoad.tsx index 20a680b..263476d 100644 --- a/src/components/dashboard/EventsSection/EventLoad.tsx +++ b/src/components/dashboard/EventsSection/EventLoad.tsx @@ -1,6 +1,7 @@ import { useEffect, useState } from "react"; import { Icon } from "@iconify/react"; import { Get } from "../../../scripts/pocketbase/Get"; +import { Authentication } from "../../../scripts/pocketbase/Authentication"; interface Event { id: string; @@ -82,6 +83,11 @@ const EventLoad = () => { const now = new Date(); const isPastEvent = endDate < now; + // Get current user to check attendance + const auth = Authentication.getInstance(); + const currentUser = auth.getCurrentUser(); + const hasAttended = currentUser && event.attendees?.some(entry => entry.user_id === currentUser.id); + // Store event data in window object with unique ID const eventDataId = `event_${event.id}`; window[eventDataId] = event; @@ -126,7 +132,13 @@ const EventLoad = () => { )} {isPastEvent && ( -