diff --git a/components/Forms/CreateAdminPopupWindow.tsx b/components/Forms/CreateAdminPopupWindow.tsx index 0e5555f..4c85b7b 100644 --- a/components/Forms/CreateAdminPopupWindow.tsx +++ b/components/Forms/CreateAdminPopupWindow.tsx @@ -4,7 +4,6 @@ import { ShortFormInput, LongFormInput, LargeFormInput, - InputFlex, FormInput, FormLabel, CreateEventForm, diff --git a/components/Home/FeaturedEvents.tsx b/components/Home/FeaturedEvents.tsx new file mode 100644 index 0000000..13051f5 --- /dev/null +++ b/components/Home/FeaturedEvents.tsx @@ -0,0 +1,57 @@ +// FeaturedEvents.tsx +import React, { Suspense, useEffect, useState } from 'react'; +import { useRouter } from 'next/router'; + +const EventCard = React.lazy(() => import('@/components/shared/EventCard')); // Lazy loading the EventCard +import { QueriedVolunteerEventData } from 'bookem-shared/src/types/database'; +import { fetchData } from '@/utils/utils'; + +import { + FeaturedEventsContainer, + EventsScrollContainer, + Header, + Events, +} from '@/styles/components/featuredEvents.styles'; // Assume you have similar styles to upcomingEvents.styles + +// Vertical list of sample FeaturedEvents +const FeaturedEvents = () => { + const [events, setEvents] = useState(); + const [error, setError] = useState(); + const router = useRouter(); + + // Fetch featured events when rendered + useEffect(() => { + fetchData('/api/events/featured') + .then(data => setEvents(data)) + .catch(err => setError(err)); + }, []); + + return ( + <> + {error &&
404 Event not found!
} + {!events && !error &&
Loading...
} + {events && ( +
+
Featured events
+ + + Please Wait...}> + {events.map(event => ( + + ))} + + + + +
+ )} + + ); +}; + +export default FeaturedEvents; diff --git a/components/Home/MainDashBoard.tsx b/components/Home/MainDashBoard.tsx index 9e62610..3b3dba2 100644 --- a/components/Home/MainDashBoard.tsx +++ b/components/Home/MainDashBoard.tsx @@ -1,6 +1,7 @@ import React, { useState, useEffect } from 'react'; import Image from 'next/image'; +import FeaturedEvents from '@/components/Home/FeaturedEvents'; import UpcomingEvents from '@/components/Home/UpcomingEvents'; import type { MenuProps } from 'antd'; @@ -78,7 +79,7 @@ const MainDashboard: React.FC = () => {
- Here are some quick stats for + Here are some quick stats: {/*