From 7d9ef25fcd70cc8feea598a135010b74e5fbd266 Mon Sep 17 00:00:00 2001 From: Wind-Explorer <66894537+Wind-Explorer@users.noreply.github.com> Date: Tue, 13 Aug 2024 02:36:46 +0800 Subject: [PATCH] fake registered events section --- client/src/pages/SpringboardPage.tsx | 61 +++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/client/src/pages/SpringboardPage.tsx b/client/src/pages/SpringboardPage.tsx index 71ab05e..349f3a8 100644 --- a/client/src/pages/SpringboardPage.tsx +++ b/client/src/pages/SpringboardPage.tsx @@ -6,6 +6,8 @@ import SpringboardButton from "../components/SpringboardButton"; import { getTimeOfDay } from "../utilities"; import { retrieveUserInformation } from "../security/users"; import UserProfilePicture from "../components/UserProfilePicture"; +import instance from "../security/http"; +import config from "../config"; export default function SpringboardPage() { const navigate = useNavigate(); @@ -15,6 +17,7 @@ export default function SpringboardPage() { } const [userInformation, setUserInformation] = useState(); const [accountUnavailable, setAccountUnavaliable] = useState(false); + const [events, setEvents] = useState([]); let timeOfDay = getTimeOfDay(); let greeting = ""; @@ -37,6 +40,10 @@ export default function SpringboardPage() { .catch((_) => { setAccountUnavaliable(true); }); + + instance.get("/events").then((response) => { + setEvents(response.data); + }); return; }, []); @@ -107,7 +114,59 @@ export default function SpringboardPage() { linkToPage="/karang-guni-schedules" > -
+
+ {events.length > 0 && ( +
+

Registered events

+
+ {events.map((event, index) => ( + +
+
+ event +
+

{event.title}

+

+ Happening on{" "} + + {new Date(event.date).toDateString()} + +

+
+
+ +
+
+ ))} +
+
+

Need to get in touch regarding your attendance?

+ +
+
+ )} +
)}