From 8ddb24fc27eac0f659ed6881b2f20eef9de34dea Mon Sep 17 00:00:00 2001 From: Damian <37555910+DCRepublic@users.noreply.github.com> Date: Wed, 6 Nov 2024 15:24:03 -0500 Subject: [PATCH] search, filters, calendar --- app/calendar/page.tsx | 39 ++- app/page.tsx | 33 ++- components/Calendar.tsx | 4 +- components/CourseCard.tsx | 2 +- components/CreatePlan.tsx | 21 +- components/FullCourseList.tsx | 258 +++--------------- components/PlanCard.tsx | 41 +++ components/PlanCardList.tsx | 38 +++ components/Search.tsx | 42 ++- package-lock.json | 3 +- .../20241106191528_reset/migration.sql | 12 + .../migration.sql | 3 + prisma/schema.prisma | 4 +- 13 files changed, 248 insertions(+), 252 deletions(-) create mode 100644 components/PlanCard.tsx create mode 100644 components/PlanCardList.tsx create mode 100644 prisma/migrations/20241106191528_reset/migration.sql create mode 100644 prisma/migrations/20241106191607_reset_strings/migration.sql diff --git a/app/calendar/page.tsx b/app/calendar/page.tsx index 5f24686..8b4c4c3 100644 --- a/app/calendar/page.tsx +++ b/app/calendar/page.tsx @@ -58,13 +58,13 @@ export default async function CalendarPage() { ], startTime: - meetingTimes?.beginTime.slice(0, 2) + + meetingTimes?.beginTime?.slice(0, 2) + ":" + - meetingTimes?.beginTime.slice(2), + meetingTimes?.beginTime?.slice(2), endTime: - meetingTimes?.endTime.slice(0, 2) + + meetingTimes?.endTime?.slice(0, 2) + ":" + - meetingTimes?.endTime.slice(2), + meetingTimes?.endTime?.slice(2), }); } } @@ -72,11 +72,40 @@ export default async function CalendarPage() { return output; } + async function getUniqueStartEndTimes() { + const maxstart = await prisma.meetingTime.findFirst({ + where: { + beginTime: { not: "" }, + }, + orderBy: { + beginTime: "desc", + }, + }); + const maxend = await prisma.meetingTime.findFirst({ + where: { + endTime: { not: "" }, + }, + orderBy: { + beginTime: "desc", + }, + }); + + let times = { + minTime: + maxstart?.beginTime.slice(0, 2) + ":" + maxstart?.beginTime.slice(2), + maxTime: + maxstart?.endTime.slice(0, 2) + ":" + maxstart?.beginTime.slice(2), + }; + console.log(times); + return times; + } + let events = await getEvents(); + let times = await getUniqueStartEndTimes(); return (