diff --git a/components/events/UpcomingEventData.jsx b/components/events/UpcomingEventData.jsx index 141b4e9..b529b2b 100644 --- a/components/events/UpcomingEventData.jsx +++ b/components/events/UpcomingEventData.jsx @@ -3,124 +3,128 @@ import Link from 'next/link' import moment from "moment"; import { useState } from "react" - export default function UpcomingEventData() { - const [isTab, setIsTab] = useState(1) - const handleTab = (i) => { - setIsTab(i) - } - const [currentMonth, setCurrentMonth] = useState(moment()); - + + // Events normalized with YYYY-MM-DD format const events = [ { id: 1, - date: "Sun Jan-14", + date: "2024-01-14", time: "05:30 PM", title: "Thai Pongal 2024", + location: "Holy Family Croatian Roman Catholic Parish Hall, Kitchener, Canada", + image: "/assets/img/event/upcoming-event/thai-pongal.webp", url: "#", }, { - - id: 2, - date: "Apr 14, 2024", - title: "AGM", - url: "#", - }, - - { - id: 3, - date: "Jun 22-23, 2024", - title: "KW Multicultural Festival", - url: "#", - }, - { - id: 4, - date: "Sun Jul 7, 2024", - time: "10:00 AM", - title: "TCA Picnic – Potlock", - url: "#", - }, - { - id: 5, - date: "Jul 27-28, 2024", - title: "South Asian Family Sports Day", - url: "#", - }, - { - id: 6, - date: "Aug 23, 2023", - time: "06:30-08:30 PM", - title: "Conestoga College Workshop", - url: "#", - }, - { - id: 7, - date: "Aug 23, 2023", - time: "06:30-08:30 PM", - title: "Conestoga College Workshop", - url: "#", - }, + id: 2, + date: "2024-04-14", + title: "AGM", + location: "Christ Lutheran Church, Waterloo, ON", + image: "/assets/img/event/upcoming-event/agm.webp", + url: "#", + }, { - id: 8, - date: "Sat Oct 26, 2024", - time: "1.00 PM-4.30 PM", - title: "TCA – WPL Deepavali Celebrations", - url: "#", - }, - + id: 3, + date: "2024-06-22", + title: "KW Multicultural Festival", + location: "Indian & Sri Lankan Food Court, Victoria Park, Kitchener, ON", + image: "/assets/img/event/upcoming-event/kw.webp", + url: "#", + }, { - id: 9, - date: "Sat Dec 21, 2024", - time: "05:00 PM-09:00 PM", - title: "RIM Park", - url: "#", - }, + id: 4, + date: "2024-07-07", + time: "10:00 AM", + title: "TCA Picnic – Potlock", + location: "Pinehurst Lake – Sutor Shelter, Ayr, ON", + image: "/assets/img/event/upcoming-event/picnic.webp", + url: "#", + }, + { + id: 5, + date: "2024-07-27", + title: "South Asian Family Sports Day", + location: "Waterloo Park, Waterloo, ON", + image: "/assets/img/event/upcoming-event/sports.webp", + url: "#", + }, + { + id: 6, + date: "2023-08-23", + time: "06:30-08:30 PM", + title: "Conestoga College Workshop", + location: "Conestoga College – WC 241, Doon Campus, Ontario", + image: "/assets/img/event/upcoming-event/workshop.webp", + url: "#", + }, + { + id: 7, + date: "2023-08-23", + time: "06:30-08:30 PM", + title: "Tamil Cultural Nite", + location: "Doon Campus, Ontario (TBA)", + image: "/assets/img/event/upcoming-event/cultural.webp", + url: "#", + }, + { + id: 8, + date: "2024-10-26", + time: "1.00 PM-4.30 PM", + title: "TCA – WPL Deepavali Celebrations", + location: "Waterloo Public Library, John M. Harper Branch", + image: "/assets/img/event/upcoming-event/deepavali.webp", + url: "#", + }, + { + id: 9, + date: "2024-12-21", + time: "05:00 PM-09:00 PM", + title: "Christmas & 2024 Year End Celebration", + location: "RIM Park, 2001 University Ave E, Waterloo, ON", + image: "/assets/img/event/upcoming-event/christmas.webp", + url: "#", + }, + ]; - -]; - - // Get the start and end of the current month + // Get start and end of current month const startOfMonth = currentMonth.clone().startOf("month"); const endOfMonth = currentMonth.clone().endOf("month"); - // Generate the calendar days + // Generate calendar days const daysInMonth = []; for (let i = 0; i < startOfMonth.day(); i++) { - daysInMonth.push(null); // Adding null for empty days before the start of the month + daysInMonth.push(null); } for (let i = 1; i <= endOfMonth.date(); i++) { daysInMonth.push(moment(currentMonth).date(i)); } - // Function to check if a date has an event + // Get events for a given date const getEventForDate = (date) => { const dateString = date?.format("YYYY-MM-DD"); return events.filter(event => event.date === dateString); }; - // Function to navigate to the next/previous month + // Navigate months const handleMonthChange = (direction) => { setCurrentMonth(currentMonth.clone().add(direction, "months")); }; return ( - <> - -
-
-
-
-
- {/*
Event Schedule
*/} -
-

Upcoming Events

-
+
+
+
+
+
+

Upcoming Events

-
-
- +
+
+ {/* Calendar (left side) */} +