diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index d939c47..53515c3 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -5,8 +5,6 @@ name: Mirror
on:
push:
branches: [ "main" ]
- pull_request:
- branches: [ "main" ]
jobs:
build:
diff --git a/app/admin/page.tsx b/app/admin/page.tsx
index 1d0af0b..d9355dc 100644
--- a/app/admin/page.tsx
+++ b/app/admin/page.tsx
@@ -98,10 +98,10 @@ export default function AdminPage() {
if (status === "authenticated") {
if (session.user?.role === "admin") {
return (
-
+
diff --git a/app/calendar/page.tsx b/app/calendar/page.tsx
index 8c04e77..5acf8c8 100644
--- a/app/calendar/page.tsx
+++ b/app/calendar/page.tsx
@@ -5,110 +5,122 @@ import Calendar from "../../components/Calendar";
import prisma from "../../lib/prisma";
import { getPlanCookie } from "../actions/actions";
import { generateColorFromName } from "../../components/primitives";
-export default async function CalendarPage() {
- async function getEvents() {
- const output: any = [];
- const planCookie: any = await getPlanCookie();
- let courses;
+interface Event {
+ classNames: string;
+ textColor: string;
+ title: string;
+ daColor: string;
+ subject: string;
+ courseNumber: string;
+ instructor: string;
+ room: string;
+ color: string;
+ borderWidth: string;
+ daysOfWeek: (false | "0" | "1" | "2" | "3" | "4" | "5" | "6" | undefined)[];
+ startTime: string;
+ endTime: string;
+}
- if (planCookie) {
- const plan = await prisma.coursePlan.findUnique({
- where: {
- id: parseInt(planCookie),
- },
- include: {
- courses: true,
+async function getEvents(): Promise {
+ "use server";
+ const output: Event[] = [];
+ const planCookie: any = await getPlanCookie();
+
+ let courses;
+
+ if (planCookie) {
+ const plan = await prisma.coursePlan.findUnique({
+ where: {
+ id: parseInt(planCookie),
+ },
+ include: {
+ courses: {
+ include: {
+ instructor: true,
+ facultyMeet: {
+ include: {
+ meetingTimes: true,
+ },
+ },
+ },
},
- });
+ },
+ });
- courses = plan?.courses;
- }
+ courses = plan?.courses;
+ }
- if (courses) {
- for (let i = 0; i < courses.length; i++) {
- const color = generateColorFromName(courses[i].subject);
+ if (courses) {
+ for (let i = 0; i < courses.length; i++) {
+ const color = generateColorFromName(courses[i].subject);
- const num: string = courses[i].courseReferenceNumber;
- const meetingTimes = await prisma.meetingTime.findFirst({
- where: {
- courseReferenceNumber: num,
- },
- });
+ const num: string = courses[i].courseReferenceNumber;
+ const meetingTimes = await prisma.meetingTime.findFirst({
+ where: {
+ courseReferenceNumber: num,
+ },
+ });
- output.push({
- classNames: "font-sans",
- textColor: "white",
- title: courses[i]?.courseTitle,
- daColor: color,
- subject: courses[i]?.subject,
- color: "rgba(0,0,0,0)",
+ output.push({
+ classNames: "font-sans",
+ textColor: "white",
+ title: courses[i]?.courseTitle,
+ daColor: color,
+ subject: courses[i]?.subject,
+ courseNumber: courses[i]?.courseNumber,
+ instructor: courses[i]?.instructor.displayName,
+ room:
+ courses[i]?.facultyMeet.meetingTimes.building +
+ " " +
+ courses[i]?.facultyMeet.meetingTimes.room,
+ color: "rgba(0,0,0,0)",
- borderWidth: "0px",
- daysOfWeek: [
- meetingTimes?.sunday && "0",
- meetingTimes?.monday && "1",
- meetingTimes?.tuesday && "2",
- meetingTimes?.wednesday && "3",
- meetingTimes?.thursday && "4",
- meetingTimes?.friday && "5",
- meetingTimes?.saturday && "6",
- ],
+ borderWidth: "0px",
+ daysOfWeek: [
+ meetingTimes?.sunday && "0",
+ meetingTimes?.monday && "1",
+ meetingTimes?.tuesday && "2",
+ meetingTimes?.wednesday && "3",
+ meetingTimes?.thursday && "4",
+ meetingTimes?.friday && "5",
+ meetingTimes?.saturday && "6",
+ ],
- startTime:
- meetingTimes?.beginTime.slice(0, 2) +
- ":" +
- meetingTimes?.beginTime.slice(2),
- endTime:
- meetingTimes?.endTime.slice(0, 2) +
- ":" +
- meetingTimes?.endTime.slice(2),
- });
- }
+ startTime:
+ meetingTimes?.beginTime.slice(0, 2) +
+ ":" +
+ meetingTimes?.beginTime.slice(2),
+ endTime:
+ meetingTimes?.endTime.slice(0, 2) +
+ ":" +
+ meetingTimes?.endTime.slice(2),
+ });
}
-
- return output;
}
- async function getUniqueStartEndTimes() {
- const maxstart = await prisma.meetingTime.findFirst({
- where: {
- beginTime: { not: "" },
- },
- orderBy: {
- beginTime: "desc",
- },
- });
- const maxend = await prisma.meetingTime.findFirst({
- where: {
- endTime: { not: "" },
- },
- orderBy: {
- beginTime: "desc",
- },
- });
+ return output;
+}
- /*
- let times = {
- minTime:
- maxstart?.beginTime.slice(0, 2) + ":" + maxstart?.beginTime.slice(2),
- maxTime:
- maxstart?.endTime.slice(0, 2) + ":" + maxstart?.beginTime.slice(2),
- };*/
- console.log(maxstart);
+export default async function CalendarPage() {
+ const events: Event[] = await getEvents();
+ let endTime = "17:00";
+ let startTime = "09:00";
- return maxstart;
+ for (const event of events) {
+ if (event.startTime < startTime && event.startTime != ":")
+ startTime = event.startTime;
+ if (event.endTime > endTime && event.endTime != ":")
+ endTime = event.endTime;
}
- const events = await getEvents();
-
//let times = await getUniqueStartEndTimes();
return (
-
-
-
+
+
+
-
diff --git a/app/layout.tsx b/app/layout.tsx
index fd0fe63..72cafba 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -8,6 +8,7 @@ import { NextAuthProvider } from "../components/providers/NextAuthProvider";
import { siteConfig } from "../config/site";
import { fontSans } from "../config/fonts";
import { Navbar } from "../components/navbar";
+import FooterInfo from "../components/FooterInfo";
import { Providers } from "./providers";
@@ -54,35 +55,10 @@ export default function RootLayout({
>