@@ -56,7 +56,7 @@ async function Home(props: any) {
-
diff --git a/components/Calendar.tsx b/components/Calendar.tsx
index 4111310..5ba2ebc 100644
--- a/components/Calendar.tsx
+++ b/components/Calendar.tsx
@@ -4,6 +4,7 @@ import FullCalendar from "@fullcalendar/react";
import timeGridPlugin from "@fullcalendar/timegrid"; // a plugin!
import { Card } from "@nextui-org/react";
import moment from "moment";
+import { generateColorFromName } from "./primitives";
export default function Calendar(props: any) {
function dayHeaderContent(args: any) {
@@ -14,11 +15,24 @@ export default function Calendar(props: any) {
console.log(eventInfo);
return (
- {eventInfo.timeText}
- {eventInfo.event.title}
+ {/*
+
+
+
+ */}
+
+ {eventInfo.timeText}
+ {eventInfo.event.title}
);
}
@@ -28,11 +42,10 @@ export default function Calendar(props: any) {
height="100%"
plugins={[timeGridPlugin]}
initialView="timeGridWeek"
- eventMinHeight={70}
allDaySlot={false}
expandRows
slotDuration="01:00:00"
- slotMinTime="08:30:00"
+ slotMinTime="08:00:00"
slotMaxTime="22:00:00"
dayHeaderFormat={dayHeaderContent}
events={props.events}
diff --git a/components/CourseCard.tsx b/components/CourseCard.tsx
index 7c9388e..09f0665 100644
--- a/components/CourseCard.tsx
+++ b/components/CourseCard.tsx
@@ -11,6 +11,7 @@ import {
Button,
} from "@nextui-org/react";
import { tv } from "tailwind-variants";
+import { courseColors } from "@/components/primitives";
import { InstructorCard } from "./InstructorCard";
import AddIcon from "@mui/icons-material/Add";
@@ -28,22 +29,6 @@ const {
role,
} = card();
-const courseColors = [
- "#FF8360",
- "#E8E288",
- "#7DCE82",
- "#3CDBD3",
- "#A491D3",
- "#1E2D2F",
- "#7CC6FE",
- "#5DFDCB",
- "#C3423F",
- "#05668D",
- "#037171",
- "#9067C6",
- "#E6AF2E",
-];
-
function generateColorFromName(name: string) {
let hash = 0;
diff --git a/components/CreatePlan.tsx b/components/CreatePlan.tsx
index 11bfca6..201fd05 100644
--- a/components/CreatePlan.tsx
+++ b/components/CreatePlan.tsx
@@ -11,6 +11,7 @@ import {
Input,
Button,
Skeleton,
+ CardHeader,
} from "@nextui-org/react";
import {
Dropdown,
@@ -27,6 +28,7 @@ import IosShareIcon from "@mui/icons-material/IosShare";
import { tv } from "tailwind-variants";
import axios from "axios";
import { Select, SelectItem } from "@nextui-org/react";
+import { useRouter } from "next/navigation";
import { InstructorCard } from "./InstructorCard";
import { usePathname } from "next/navigation";
@@ -35,9 +37,10 @@ import { useEffect, useState } from "react";
import useSWR from "swr";
import { setPlanCookie } from "@/app/actions";
import { useCookies } from "next-client-cookies";
-
+import { courseColors } from "@/components/primitives";
export default function CreatePlan(props: any) {
const cookies = useCookies();
+ const router = useRouter();
const pathname = usePathname();
const { data: session, status } = useSession();
@@ -75,6 +78,20 @@ export default function CreatePlan(props: any) {
});
}
}
+ async function removeCourseFromPlan(plan: any, course: any) {
+ await axios
+ .post("/api/getplancourses", {
+ plan: plan,
+ course: course,
+ })
+ .then(function (response: any) {
+ //console.log(response);
+ router.refresh();
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+ }
async function deletePlan() {
if (cookies.get("plan")) {
axios
@@ -100,21 +117,6 @@ export default function CreatePlan(props: any) {
setPlanCookie(e.target.value);
};
- const courseColors = [
- "#FF8360",
- "#E8E288",
- "#7DCE82",
- "#3CDBD3",
- "#A491D3",
- "#1E2D2F",
- "#7CC6FE",
- "#5DFDCB",
- "#C3423F",
- "#05668D",
- "#037171",
- "#9067C6",
- "#E6AF2E",
- ];
function generateColorFromName(name: string) {
let hash = 0;
@@ -147,10 +149,11 @@ export default function CreatePlan(props: any) {
removeCourseFromPlan(selectedCoursePlan, course)}
>
-
- {course.courseTitle}
-
+
+
+ {course.courseTitle.replace(/&/g, "&")}
+
+
+
)
);
@@ -173,7 +188,7 @@ export default function CreatePlan(props: any) {
return (
<>
-
+
Create a Plan
@@ -190,11 +205,10 @@ export default function CreatePlan(props: any) {
/>
diff --git a/components/PlanCard.tsx b/components/PlanCard.tsx
deleted file mode 100644
index 45e1324..0000000
--- a/components/PlanCard.tsx
+++ /dev/null
@@ -1,37 +0,0 @@
-"use client";
-import {
- Card,
- CardBody,
- Divider,
- Link,
- User,
- Popover,
- PopoverTrigger,
- PopoverContent,
- Button,
-} from "@nextui-org/react";
-import { tv } from "tailwind-variants";
-
-import { InstructorCard } from "./InstructorCard";
-import AddIcon from "@mui/icons-material/Add";
-import axios from "axios";
-export const card = tv({
- slots: {
- base: "bg-light_foreground min-h-32 max-h-32 w-[98%] rounded-sm scroll-none drop-shadow-lg transition-colors",
- role: "font-bold text-primary ",
- },
-});
-
-const { base, role } = card();
-
-export default function PlanCard(props: any) {
- return (
-
-
-
-
- {props.course.courseTitle}
-
-
- );
-}
diff --git a/components/PlanCardList.tsx b/components/PlanCardList.tsx
deleted file mode 100644
index c037251..0000000
--- a/components/PlanCardList.tsx
+++ /dev/null
@@ -1,40 +0,0 @@
-import { Course, CoursePlan } from "@prisma/client";
-import prisma from "../lib/prisma";
-import PlanCard from "./PlanCard";
-
-async function getPlans(planId: any) {
- const courses = await prisma.course.findMany({
- where: {
- id: planId,
- },
- });
- /*
- const plans = await prisma.coursePlan.findMany({
- where: {
- User: {
- //@ts-ignore
- uuid: session?.user?.id,
- },
- },
- include: {
- courses: true,
- },
- });*/
- return courses;
-}
-
-export async function PlanCardList(planId: any) {
- const courses: Course[] = await getPlans(planId);
-
- return (
- <>
-
- {courses?.map((course: any) => (
-
- ))}
-
- >
- );
-}
diff --git a/components/primitives.ts b/components/primitives.ts
index 66d31b2..5b16a76 100644
--- a/components/primitives.ts
+++ b/components/primitives.ts
@@ -54,3 +54,29 @@ export const subtitle = tv({
fullWidth: true,
},
});
+
+export const courseColors = [
+ "#093145",
+ "#107896",
+ "#829356",
+
+ "#C2571A",
+ "#9A2617",
+ "#636363",
+ "#087E8B",
+ "#590925",
+ "#034748",
+ "#19381F",
+ "#631D76",
+ "#4B4E6D",
+];
+
+export function generateColorFromName(name: string) {
+ let hash = 0;
+
+ for (let i = 0; i < name.length; i++) {
+ hash += name.charCodeAt(i);
+ }
+
+ return courseColors[hash % courseColors.length];
+}
diff --git a/styles/globals.css b/styles/globals.css
index 395a507..ffb33bb 100644
--- a/styles/globals.css
+++ b/styles/globals.css
@@ -22,7 +22,9 @@
transition: all 0.5s ease;
font-family: var(--font-sans);
}
-
+.fc-day-today {
+ background-color: inherit !important;
+}
.fc-col-header-cell-cushion {
color: white;
}