Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge: V6ctor dev #16

Merged
merged 3 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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