diff --git a/app/page.tsx b/app/page.tsx index aeaaf9b..b972bcf 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -9,7 +9,6 @@ import { auth } from "../lib/auth"; import prisma from "../lib/prisma"; import { Course, CoursePlan } from "@prisma/client"; import { getPlanCookie } from "../app/actions"; -import { PlanCardList } from "../components/PlanCardList"; async function getCourses() { const courses = await prisma.course.findMany(); diff --git a/components/CourseCard.tsx b/components/CourseCard.tsx index 555b483..6763a80 100644 --- a/components/CourseCard.tsx +++ b/components/CourseCard.tsx @@ -12,6 +12,7 @@ import { } from "@nextui-org/react"; import { tv } from "tailwind-variants"; import { generateColorFromName } from "../components/primitives"; +import { ScrollShadow } from "@nextui-org/react"; import { InstructorCard } from "./InstructorCard"; import AddIcon from "@mui/icons-material/Add"; diff --git a/components/FullCourseList.tsx b/components/FullCourseList.tsx index 8e5958a..5437bb5 100644 --- a/components/FullCourseList.tsx +++ b/components/FullCourseList.tsx @@ -16,7 +16,6 @@ async function getCourses( console.log(startTime); return await prisma.course.findMany({ relationLoadStrategy: "join", // or 'query' - include: { sectionAttributes: true, facultyMeet: { @@ -31,11 +30,10 @@ async function getCourses( { _relevance: { fields: ["courseTitle", "subject", "courseNumber"], - search: query.replace(/[\s\n\t]/g, "_"), + search: query.trim().split(" ").join(" & "), sort: "desc", }, }, - {}, ], where: { ...(term @@ -45,6 +43,12 @@ async function getCourses( : {}), //year: term, + OR: [ + { courseTitle: { search: query.trim().split(" ").join(" & ") } }, + { subject: { search: query.trim().split(" ").join(" & ") } }, + { courseNumber: { search: query.trim().split(" ").join(" & ") } }, + ], + ...(startTime.length > 0 ? { facultyMeet: { @@ -57,23 +61,23 @@ async function getCourses( } : {}), - OR: [ - { - facultyMeet: { - meetingTimes: { - is: { - monday: dotw.includes("monday") ? true : Prisma.skip, - tuesday: dotw.includes("tuesday") ? true : Prisma.skip, - wednesday: dotw.includes("wednesday") ? true : Prisma.skip, - thursday: dotw.includes("thursday") ? true : Prisma.skip, - friday: dotw.includes("friday") ? true : Prisma.skip, - saturday: dotw.includes("saturday") ? true : Prisma.skip, - sunday: dotw.includes("sunday") ? true : Prisma.skip, + ...(dotw.length > 0 + ? { + facultyMeet: { + meetingTimes: { + is: { + monday: dotw.includes("monday") ? true : Prisma.skip, + tuesday: dotw.includes("tuesday") ? true : Prisma.skip, + wednesday: dotw.includes("wednesday") ? true : Prisma.skip, + thursday: dotw.includes("thursday") ? true : Prisma.skip, + friday: dotw.includes("friday") ? true : Prisma.skip, + saturday: dotw.includes("saturday") ? true : Prisma.skip, + sunday: dotw.includes("sunday") ? true : Prisma.skip, + }, }, }, - }, - }, - ], + } + : {}), }, }); } diff --git a/components/Search.tsx b/components/Search.tsx index 688e4d2..d84a284 100644 --- a/components/Search.tsx +++ b/components/Search.tsx @@ -42,6 +42,7 @@ export default function Search(props: any) { useEffect(() => { // Update the document title using the browser API + setSelectedTerm(searchParams.get("term")?.toString().split(",")); setSelectedDOTW(searchParams.get("dotw")?.toString().split(",")); setSelectedStartTime(searchParams.get("stime")?.toString().split(",")); //handleSelectionChange({ target: { value: selectedTerm } }); @@ -111,7 +112,7 @@ export default function Search(props: any) {