Skip to content

Commit

Permalink
Calendar: Format for mobile, Fix events to show course number, Add Fo…
Browse files Browse the repository at this point in the history
…oter info Auth: change to allow admin access again
  • Loading branch information
DCRepublic committed Nov 17, 2024
1 parent 277963f commit 6d215b1
Show file tree
Hide file tree
Showing 8 changed files with 123 additions and 41 deletions.
7 changes: 4 additions & 3 deletions app/admin/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,15 @@ export default function AdminPage() {
return cellValue;
}
}, []);

console.log(status);
console.log(session?.user);
if (status === "authenticated") {
if (session.user?.role === "admin") {
return (
<div className="w-[90vw]">
<div>
<Table
isHeaderSticky
className="overflow-scroll scrollbar-thin scrollbar-thumb-accent-500 scrollbar-track-transparent"
className="overflow-scroll scrollbar-thin scrollbar-thumb-accent-500 scrollbar-track-transparent h-[80vh] p-4"
fullWidth
aria-label="Rating table with dynamic content(ratings)"
>
Expand Down
14 changes: 10 additions & 4 deletions app/calendar/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ export default async function CalendarPage() {
id: parseInt(planCookie),
},
include: {
courses: true,
courses: {
include: {
instructor: true,
},
},
},
});

Expand All @@ -42,6 +46,8 @@ export default async function CalendarPage() {
title: courses[i]?.courseTitle,
daColor: color,
subject: courses[i]?.subject,
courseNumber: courses[i]?.courseNumber,
instructor: courses[i]?.instructor.displayName,
color: "rgba(0,0,0,0)",

borderWidth: "0px",
Expand Down Expand Up @@ -104,11 +110,11 @@ export default async function CalendarPage() {

//let times = await getUniqueStartEndTimes();
return (
<div className="grid grid-cols-3 p-4 w-screen absolute start-0 px-32 gap-20">
<div className=" col-start-1 h-[70vh] w-[57vw] col-span-2 font-sans font-normal">
<div className="grid grid-cols-3 sm:gap-20 grid-rows-2 sm:grid-rows-1 p-4 ">
<div className="sm:h-[75vh] sm:w-[57vw] col-span-3 md:col-span-2 font-sans font-normal ">
<Calendar events={events} />
</div>
<div className="col-start-3 h-[62vh] ">
<div className="sm:h-[62vh] col-span-3 sm:col-span-1 ">
<CreatePlan />
</div>
</div>
Expand Down
30 changes: 3 additions & 27 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -54,35 +55,10 @@ export default function RootLayout({
>
<div className="flex flex-col h-screen ">
<Navbar />
<main className="container mx-auto px-1 lg:px-7 lg:pt-10 justify-center items-center flex-grow">
<main className="container mx-auto px-1 lg:px-7 lg:pt-10 justify-center items-center flex-grow ">
{children}
</main>
<footer className="w-full flex items-center justify-center py-3">
<div className="columns-1 container max-w-4xl text-center">
<span className="text-xs">
The Course Planner is a student-run service, and displays
classes from the Tri-College course database. We recommend
confirming your schedule with the official course listings
just in case. If there are any issues, email us.
</span>
<br />

<div className="space-x-5">
<Link
isExternal
href="https://www.sccs.swarthmore.edu/docs/policy"
title="SCCS Usage & Data Policy"
>
<span className=" text-xs underline ">
Usage & Data Policy
</span>
</Link>
<span className="text-xs ">
© 2024 Swarthmore College Computer Society | v2.0.0
</span>
</div>
</div>
</footer>
<FooterInfo />
</div>
</Providers>
</body>
Expand Down
4 changes: 2 additions & 2 deletions app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export default async function Page(props: {
homePageProps["createPlan"] = (
<Suspense
fallback={
<Skeleton className="rounded-lg w-8/12 h-full align-top justify-start" />
<Skeleton className="rounded-lg w-8/12 h-fit align-top justify-start" />
}
>
<CreatePlan />
Expand All @@ -125,7 +125,7 @@ async function Home(props: any) {
</div>
</div>
</div>
<div className="col-span-10 lg:col-span-3 lg:ml-[5vw]">
<div className="col-span-10 lg:col-span-3 lg:ml-[5vw] ">
<CreatePlan />
</div>
</div>
Expand Down
9 changes: 8 additions & 1 deletion components/Calendar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,16 @@ export default function Calendar(props: any) {
*/}

<b className="font-sans text-[9px] ml-1 mt-1">{eventInfo.timeText}</b>
<div className="font-sans text-[10px] ml-1 ">
<div className="font-sans text-[10px] ml-1 font-bold">
{eventInfo.event.extendedProps.subject} {""}
{eventInfo.event.extendedProps.courseNumber}
</div>
<div className="font-sans text-[10px] ml-1 mt-5 ">
{eventInfo.event.title}
</div>
<div className="font-sans text-[10px] ml-1 mt-5 ">
{eventInfo.event.extendedProps.instructor.replace("&#39;", "'")}
</div>
</Card>
);
}
Expand Down
10 changes: 7 additions & 3 deletions components/CreatePlan.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,13 @@ export default function CreatePlan(props: any) {
/>

<CardHeader className="justify-between">
<div className="ml-2 lg:text-base truncate">
{course.courseTitle.replace(/&amp;/g, "&")}
<div className="ml-2 lg:text-base truncate text-bold">
{course.subject} {""} {course.courseNumber}
<div className="text-tiny ">
{course.courseTitle.replace(/&amp;/g, "&")}
</div>
</div>

<Button
isIconOnly
startContent={<HighlightOffIcon />}
Expand Down Expand Up @@ -258,7 +262,7 @@ export default function CreatePlan(props: any) {
</div>

<div
className="flex flex-col h-[55vh] overflow-y-scroll gap-3 scrollbar-thin scrollbar-thumb-accent-500 scrollbar-track-transparent"
className="flex flex-col h-[45vh] overflow-y-scroll gap-3 scrollbar-thin scrollbar-thumb-accent-500 scrollbar-track-transparent"
id="scrollMe"
>
<CoursesList />
Expand Down
88 changes: 88 additions & 0 deletions components/FooterInfo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
"use client";

import FullCalendar from "@fullcalendar/react";
import timeGridPlugin from "@fullcalendar/timegrid"; // a plugin!
import InfoIcon from "@mui/icons-material/Info";
import {
Button,
Card,
Link,
Modal,
ModalBody,
ModalContent,
ModalFooter,
ModalHeader,
useDisclosure,
} from "@nextui-org/react";
import moment from "moment";

export default function FooterInfo(props: any) {
const { isOpen, onOpen, onClose } = useDisclosure();

const handleOpen = () => {
onOpen();
};
return (
<>
<div
className="flex flex-wrap gap-3 fixed bottom-10 left-10 opacity-50 hover:opacity-80 invisible sm:visible"
onClick={() => handleOpen()}
>
<InfoIcon />
</div>
<Modal backdrop={"blur"} isOpen={isOpen} onClose={onClose}>
<ModalContent>
{(onClose) => (
<>
<ModalHeader className="flex flex-col gap-1">
Usage & Data Policy
</ModalHeader>
<ModalBody>
<div className="columns-1 container max-w-4xl text-center">
<span className="">
The Course Planner is a student-run service, and displays
classes from the Tri-College course database. We recommend
confirming your schedule with the official course listings
just in case. If there are any issues,
</span>
<span>
{" "}
<Link
isExternal
className="text-[#f46523]"
href="mailto:[email protected]"
title="Sccs Staff Email"
>
email us.
</Link>
</span>
<br />
<br />

<div className="space-x-5">
<Link
isExternal
href="https://www.sccs.swarthmore.edu/docs/policy"
title="SCCS Usage & Data Policy"
>
<span className=" underline ">Usage & Data Policy</span>
</Link>
</div>
<br />
<span className="text-xs mt-3 ">
© 2024 Swarthmore College Computer Society | v2.0.0
</span>
</div>
</ModalBody>
<ModalFooter>
<Button color="danger" variant="light" onPress={onClose}>
Close
</Button>
</ModalFooter>
</>
)}
</ModalContent>
</Modal>
</>
);
}
2 changes: 1 addition & 1 deletion lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export const config = {
return token;
},
async session({ session, token }) {
session.role = token.role;
session.user.role = token.role;
session.user.id = token.sub || "";
return session;
},
Expand Down

0 comments on commit 6d215b1

Please sign in to comment.