Skip to content

Commit

Permalink
Merge pull request #16 from swat-sccs/v6ctor-dev
Browse files Browse the repository at this point in the history
Merge: V6ctor dev
  • Loading branch information
DCRepublic authored Nov 10, 2024
2 parents de85238 + 97c74bb commit edd3113
Show file tree
Hide file tree
Showing 10 changed files with 381 additions and 212 deletions.
15 changes: 15 additions & 0 deletions app/api/getCourses/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { NextResponse, NextRequest } from "next/server";
import prisma from "../../../lib/prisma";
import { auth } from "../../../lib/auth";

export async function GET(request: NextRequest) {
const courses = await prisma.course.findMany({
select: {
id: true,
courseTitle: true,
},
where: { year: "S2025" },
});
//console.log(plans);
return NextResponse.json(courses, { status: 200 });
}
13 changes: 13 additions & 0 deletions app/rating/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default function DocsLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<section className="flex flex-col items-center justify-center gap-4 ">
<div className="inline-block max-w-lg text-center justify-center ">
{children}
</div>
</section>
);
}
56 changes: 56 additions & 0 deletions app/rating/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
"use client";
import {
Card,
CardBody,
CardHeader,
Textarea,
Select,
SelectItem,
Popover,
Autocomplete,
AutocompleteItem,
Button,
Chip,
Input,
} from "@nextui-org/react";
import useSWR from "swr";

export default function RatingPage() {
const fetcher = (url: any) => fetch(url).then((r) => r.json());
const {
data: courses,
isLoading,
error,
} = useSWR("/api/getCourses", fetcher, {});
return (
<Card className="">
<CardHeader className="">
<h1 className=" text-center ml-auto mr-auto col-span-3 row-start-1 row-span-1 text-2xl">
Leave a Rating
</h1>
</CardHeader>
<CardBody className="grid grid-cols-10 grid-rows-6 gap-10 px-10 justify-center items-center">
<Autocomplete
variant={"bordered"}
labelPlacement="outside-left"
label="Select a Class"
placeholder="Search for a class"
className="col-span-8 col-start-2 max-w-xs "
>
{courses?.map((course: any) => (
<AutocompleteItem key={course.id}>
{course.courseTitle}
</AutocompleteItem>
))}
</Autocomplete>

<Textarea
disableAutosize
className="row-start-3 col-span-3 row-span-2"
label="Review"
placeholder="What did you think of this prof/class?"
></Textarea>
</CardBody>
</Card>
);
}
Loading

0 comments on commit edd3113

Please sign in to comment.