hack4impact-calpoly/cp-ccc-uss

Connect calendar events to UserEventDetail and AdminEventDetail

Closed this issue · 0 comments

For this issue, we want to have events on calendars once clicked to show either the UserEventDeail or AdminEventDetail component based on the admin boolean prop. admin prop should be part of the Calendar Component already.

  1. Set at least these 2 states (if not done already) selectedEventId, detailModalOpen (false as the default value).
  2. Set click event handler for the events in the calendar to do the following:
  • Set the state variable selectedEventId to the ID of the clicked event.
  • Set the state variable detailModalOpen to true (when this state is true, the modal becomes visible on the screen).
  1. Set up the Chakra UI modal component:
  1. Inside the modal, implement conditional rendering logic
  • If admin is true, render the AdminEventDetail component.
  • If admin is false, render the UserEventDetail component.
    Make sure to pass selectedEventId as a prop to the rendered component to display details of the correct selected event.
  1. Test and make sure that the modal pops up for all events on the calendar, and that manually changing the admin prop value renders the correct corresponding component.