From 03926ce2e1dc51e5363e758f90cec8064d6dbc68 Mon Sep 17 00:00:00 2001 From: rishit-singh Date: Fri, 29 Dec 2023 23:11:06 -0800 Subject: [PATCH] Added support for Event attachments to give each event an image --- frontend/src/app/events/Event.tsx | 2 +- frontend/src/app/events/EventsPage.tsx | 1 - frontend/src/app/thunks/EventThunks.ts | 6 ++---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/events/Event.tsx b/frontend/src/app/events/Event.tsx index adc7f3e..f7f8a80 100644 --- a/frontend/src/app/events/Event.tsx +++ b/frontend/src/app/events/Event.tsx @@ -14,7 +14,7 @@ export default function EventInstance({Event} : EventProps) return (<>
- {"event-image"} Event.Image} src={Event.Image} height={100} width={130} className={"rounded"}/> + {"event-image"}
{Event.Title}
diff --git a/frontend/src/app/events/EventsPage.tsx b/frontend/src/app/events/EventsPage.tsx index afa2cf4..459afd6 100644 --- a/frontend/src/app/events/EventsPage.tsx +++ b/frontend/src/app/events/EventsPage.tsx @@ -14,7 +14,6 @@ export default function EventsPage() const [events, setEvents] = useState(new Array()); - useEffect(() => { (async () => { setEvents((await mainDispatch(fetchEventsAsync() as AppDispatch)) as unknown as CalendarEvent[]); diff --git a/frontend/src/app/thunks/EventThunks.ts b/frontend/src/app/thunks/EventThunks.ts index 42db5de..4b15b9d 100644 --- a/frontend/src/app/thunks/EventThunks.ts +++ b/frontend/src/app/thunks/EventThunks.ts @@ -10,8 +10,6 @@ export const fetchEventsAsync = () => async (state: RootState, dispatch: AppDisp } }))).json(); - console.log(response); - return response["Payload"].map((item: any) => { return { Title: item.Title, @@ -19,7 +17,7 @@ export const fetchEventsAsync = () => async (state: RootState, dispatch: AppDisp End: new Date(item.End), Description: item.Description, Location: item.Location, - Image: "https://langaracpsc.github.io/assets/social.png" + Image: (item.Image != null) ? `data:image/png;base64, ${item.Image}` : "" } as CalendarEvent; }); -}; \ No newline at end of file +}; \ No newline at end of file