From 2f9a5743cdf3d8bf0d92ed08a398077f596b0a51 Mon Sep 17 00:00:00 2001 From: Izan Gil <66965250+SrIzan10@users.noreply.github.com> Date: Tue, 19 Aug 2025 17:51:42 +0200 Subject: [PATCH] show all movies in calendr --- src/components/MovieCalendar.tsx | 56 ++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/src/components/MovieCalendar.tsx b/src/components/MovieCalendar.tsx index 12cbdc7..c3910a6 100644 --- a/src/components/MovieCalendar.tsx +++ b/src/components/MovieCalendar.tsx @@ -43,13 +43,13 @@ export default function MovieCalendar({ isAdmin = false }: CalendarProps) { } }; - const getScheduleForDate = (date: Date) => { + const getSchedulesForDate = (date: Date) => { // Format date as YYYY-MM-DD in local timezone const dateString = date.getFullYear() + '-' + String(date.getMonth() + 1).padStart(2, '0') + '-' + String(date.getDate()).padStart(2, '0'); - return schedules.find(schedule => { + return schedules.filter(schedule => { // Format schedule date as YYYY-MM-DD in local timezone const scheduleDate = new Date(schedule.date); const scheduleDateString = scheduleDate.getFullYear() + '-' + @@ -62,15 +62,17 @@ export default function MovieCalendar({ isAdmin = false }: CalendarProps) { const tileContent = ({ date, view }: { date: Date; view: string }) => { if (view === 'month') { - const schedule = getScheduleForDate(date); - if (schedule) { + const schedulesForDate = getSchedulesForDate(date); + if (schedulesForDate.length > 0) { return ( -
- {selectedSchedule.movie.description} -
-+ {schedule.movie.description} +
+No movie scheduled for this date.