diff --git a/app/calendar/page.tsx b/app/calendar/page.tsx index 5acf8c8..947a25c 100644 --- a/app/calendar/page.tsx +++ b/app/calendar/page.tsx @@ -5,6 +5,7 @@ import Calendar from "../../components/Calendar"; import prisma from "../../lib/prisma"; import { getPlanCookie } from "../actions/actions"; import { generateColorFromName } from "../../components/primitives"; +import { getCoursePlans, getPlanCourses1 } from "app/actions/getCourses"; interface Event { classNames: string; @@ -104,6 +105,9 @@ async function getEvents(): Promise { export default async function CalendarPage() { const events: Event[] = await getEvents(); + const planCourses: any = await getPlanCourses1(); + const coursePlans: any = await getCoursePlans(); + let endTime = "17:00"; let startTime = "09:00"; @@ -121,7 +125,7 @@ export default async function CalendarPage() {
- +
); diff --git a/components/CreatePlan.tsx b/components/CreatePlan.tsx index 0ccfc95..321782e 100644 --- a/components/CreatePlan.tsx +++ b/components/CreatePlan.tsx @@ -75,7 +75,6 @@ export default function CreatePlan(props: any) { } } async function updateLocalPlan() { - console.log("updating local plan"); const planCourses: any = await getPlanCourses1(); setCourses(planCourses.courses); if (scrollRef.current) { @@ -115,13 +114,14 @@ export default function CreatePlan(props: any) { }; useEffect(() => { - console.log("RUNNING THE SCROll"); updateLocalPlan(); }, [props.initialPlan, props.coursePlans, cookies.get("selectedCourses")]); useEffect(() => { setSelectedCoursePlan([cookies.get("plan")]); - setCourses(props.initialPlan.courses); + if (props.initialPlan.courses) { + setCourses(props.initialPlan.courses); + } }, [props.initialPlan, cookies.get("plan")]); const CoursesList = () => {