diff --git a/app/calendar/page.tsx b/app/calendar/page.tsx
index 2821938..5f24686 100644
--- a/app/calendar/page.tsx
+++ b/app/calendar/page.tsx
@@ -8,23 +8,12 @@ import prisma from "../../lib/prisma";
import { auth } from "../../lib/auth";
import { getPlanCookie } from "../actions";
import { BorderColor } from "@mui/icons-material";
-import { courseColors } from "../../components/primitives";
-
+import { generateColorFromName } from "../../components/primitives";
export default async function CalendarPage() {
async function getEvents() {
let output: any = [];
let planCookie: any = await getPlanCookie();
- function generateColorFromName(name: string) {
- let hash = 0;
-
- for (let i = 0; i < name.length; i++) {
- hash += name.charCodeAt(i);
- }
-
- return courseColors[hash % courseColors.length];
- }
-
let courses;
if (planCookie) {
let plan = await prisma.coursePlan.findUnique({
diff --git a/app/page.tsx b/app/page.tsx
index 3d8903c..8292cca 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -51,7 +51,7 @@ async function Home(props: any) {
-
diff --git a/components/Calendar.tsx b/components/Calendar.tsx
index d136981..1d4da6f 100644
--- a/components/Calendar.tsx
+++ b/components/Calendar.tsx
@@ -15,7 +15,7 @@ export default function Calendar(props: any) {
console.log(eventInfo);
return (
{/*
diff --git a/components/CourseCard.tsx b/components/CourseCard.tsx
index 2b83a75..fc4aad9 100644
--- a/components/CourseCard.tsx
+++ b/components/CourseCard.tsx
@@ -11,7 +11,7 @@ import {
Button,
} from "@nextui-org/react";
import { tv } from "tailwind-variants";
-import { courseColors } from "../components/primitives";
+import { generateColorFromName } from "../components/primitives";
import { InstructorCard } from "./InstructorCard";
import AddIcon from "@mui/icons-material/Add";
@@ -29,16 +29,6 @@ const {
role,
} = card();
-function generateColorFromName(name: string) {
- let hash = 0;
-
- for (let i = 0; i < name.length; i++) {
- hash += name.charCodeAt(i);
- }
-
- return courseColors[hash % courseColors.length];
-}
-
async function updatePlan(course: any) {
console.log("updating");
await axios
diff --git a/components/CreatePlan.tsx b/components/CreatePlan.tsx
index 8202630..71d7e18 100644
--- a/components/CreatePlan.tsx
+++ b/components/CreatePlan.tsx
@@ -37,7 +37,7 @@ import { useEffect, useState } from "react";
import useSWR from "swr";
import { setPlanCookie } from "../app/actions";
import { useCookies } from "next-client-cookies";
-import { courseColors } from "../components/primitives";
+import { generateColorFromName } from "../components/primitives";
export default function CreatePlan(props: any) {
const cookies = useCookies();
const router = useRouter();
@@ -117,16 +117,6 @@ export default function CreatePlan(props: any) {
setPlanCookie(e.target.value);
};
- function generateColorFromName(name: string) {
- let hash = 0;
-
- for (let i = 0; i < name.length; i++) {
- hash += name.charCodeAt(i);
- }
-
- return courseColors[hash % courseColors.length];
- }
-
useEffect(() => {
// Update the document title using the browser API
setSelectedCoursePlan([cookies.get("plan")]);
diff --git a/components/navbar.tsx b/components/navbar.tsx
index 5a89084..67eda04 100644
--- a/components/navbar.tsx
+++ b/components/navbar.tsx
@@ -33,7 +33,6 @@ import InputIcon from "@mui/icons-material/Input";
import { siteConfig } from "../config/site";
import { ThemeSwitch } from "../components/theme-switch";
-import { SearchIcon } from "../components/icons";
import { title } from "../components/primitives";
import HomeIcon from "@mui/icons-material/Home";
diff --git a/components/primitives.ts b/components/primitives.ts
index 5b16a76..46064a7 100644
--- a/components/primitives.ts
+++ b/components/primitives.ts
@@ -59,9 +59,11 @@ export const courseColors = [
"#093145",
"#107896",
"#829356",
-
+ "#5A5A66",
+ "#4A6D7C",
"#C2571A",
"#9A2617",
+ "#201335",
"#636363",
"#087E8B",
"#590925",
@@ -69,13 +71,14 @@ export const courseColors = [
"#19381F",
"#631D76",
"#4B4E6D",
+ "#590004",
];
export function generateColorFromName(name: string) {
let hash = 0;
for (let i = 0; i < name.length; i++) {
- hash += name.charCodeAt(i);
+ hash += name.charCodeAt(i) * i;
}
return courseColors[hash % courseColors.length];
diff --git a/components/theme-switch.tsx b/components/theme-switch.tsx
index 79cbde3..b09d04d 100644
--- a/components/theme-switch.tsx
+++ b/components/theme-switch.tsx
@@ -7,8 +7,8 @@ import { useTheme } from "next-themes";
import { useIsSSR } from "@react-aria/ssr";
import clsx from "clsx";
-import { SunFilledIcon, MoonFilledIcon } from "../components/icons";
-
+import Brightness4Icon from "@mui/icons-material/Brightness4";
+import BedtimeIcon from "@mui/icons-material/Bedtime";
export interface ThemeSwitchProps {
className?: string;
classNames?: SwitchProps["classNames"];
@@ -70,11 +70,7 @@ export const ThemeSwitch: FC = ({
),
})}
>
- {!isSelected || isSSR ? (
-
- ) : (
-
- )}
+ {!isSelected || isSSR ? : }
);
diff --git a/swatscraper b/swatscraper
index 32a5d97..ef2320d 160000
--- a/swatscraper
+++ b/swatscraper
@@ -1 +1 @@
-Subproject commit 32a5d975a8cbe906764c553846d220de1f0ed4ab
+Subproject commit ef2320da38fbcc30e131be8c023d70ed26cd5556