Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .vscode/mcp.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"url": "http://localhost:9980/sse"
}
}
}
}
46 changes: 23 additions & 23 deletions apps/frontend/src/app/finals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,36 @@ import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { set } from "lodash-es";

export interface FinalsState {
search: string;
numResults: number;
ownCourses: string[];
showOwn: boolean;
search: string;
numResults: number;
ownCourses: string[];
showOwn: boolean;
}

const initialState: FinalsState = {
search: "",
numResults: 0,
ownCourses: [],
showOwn: true,
search: "",
numResults: 0,
ownCourses: [],
showOwn: true,
};

export const finalsSlice = createSlice({
name: "finals",
initialState,
reducers: {
updateSearch: (state, action: PayloadAction<string>) => {
state.search = action.payload;
},
setNumResults: (state, action: PayloadAction<number>) => {
state.numResults = action.payload;
},
setOwnCourses: (state, action: PayloadAction<string[]>) => {
state.ownCourses = action.payload;
},
setShowOwn: (state, action: PayloadAction<boolean>) => {
state.showOwn = action.payload;
},
name: "finals",
initialState,
reducers: {
updateSearch: (state, action: PayloadAction<string>) => {
state.search = action.payload;
},
setNumResults: (state, action: PayloadAction<number>) => {
state.numResults = action.payload;
},
setOwnCourses: (state, action: PayloadAction<string[]>) => {
state.ownCourses = action.payload;
},
setShowOwn: (state, action: PayloadAction<boolean>) => {
state.showOwn = action.payload;
},
},
});

export const reducer = finalsSlice.reducer;
10 changes: 5 additions & 5 deletions apps/frontend/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
export const metadata = {
title: 'Next.js',
description: 'Generated by Next.js',
}
title: "Next.js",
description: "Generated by Next.js",
};

export default function RootLayout({
children,
}: {
children: React.ReactNode
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
);
}
1 change: 0 additions & 1 deletion apps/frontend/src/app/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ const reducers = combineReducers({
},
finalsReducer
),

});

export const store = configureStore({
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/app/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const displayUnits = (units: string): string => {
if (units.match(/[0-9]+\.[0-9]*/)) {
return `${parseFloat(units).toString()}`;
} else {
return units == "VAR" ? "Variable" : units;
return units == "VAR" ? "Variable" : units;
}
};

Expand Down
48 changes: 26 additions & 22 deletions apps/frontend/src/components/CourseSchedulesDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ const LectureViewer = ({
{lectureInfo.name}
</div>
<div className="col-span-1 text-sm">
{isSignedIn ? getInstructors(lectureInfo.instructors) : "Sign in to view instructors"}
{isSignedIn
? getInstructors(lectureInfo.instructors)
: "Sign in to view instructors"}
</div>
<div className="contents flex-col text-sm">
{lectureInfo.times.map((time, i) => (
Expand All @@ -60,16 +62,16 @@ const LectureViewer = ({
<div className="col-span-1 col-start-3">
{timeArrToString([time])}
</div>
{
isSignedIn ? (
<Link
href={`https://maps.scottylabs.org/${time.building}-${time.room}`}
openInNewTab={true}
>
{time.building} {time.room}
</Link>
) : "Sign in to view location"
}
{isSignedIn ? (
<Link
href={`https://maps.scottylabs.org/${time.building}-${time.room}`}
openInNewTab={true}
>
{time.building} {time.room}
</Link>
) : (
"Sign in to view location"
)}
</div>
))}
</div>
Expand All @@ -82,7 +84,9 @@ const LectureViewer = ({
>
<div className="text-md col-span-1 pt-1">{section.name}</div>
<div className="col-span-1 text-sm">
{isSignedIn ? section.instructors.join("; ") : "Sign in to view instructors"}
{isSignedIn
? section.instructors.join("; ")
: "Sign in to view instructors"}
</div>
<div className="contents text-sm">
{section.times.map((time, i) => (
Expand All @@ -93,16 +97,16 @@ const LectureViewer = ({
<div className="col-span-1 col-start-3">
{timeArrToString([time])}
</div>
{
isSignedIn ? (
<Link
href={`https://maps.scottylabs.org/${time.building}-${time.room}`}
openInNewTab={true}
>
{time.building} {time.room}
</Link>
) : "Sign in to view location"
}
{isSignedIn ? (
<Link
href={`https://maps.scottylabs.org/${time.building}-${time.room}`}
openInNewTab={true}
>
{time.building} {time.room}
</Link>
) : (
"Sign in to view location"
)}
</div>
))}
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/components/GenedsDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const columns: ColumnDef<Gened>[] = [
const stopsCounting = info.getValue() as string;
if (stopsCounting && stopsCounting !== "Fall 2099") {
return <p>{stopsCounting}</p>;
} else{
} else {
return <p>-</p>;
}
},
Expand Down
9 changes: 8 additions & 1 deletion apps/frontend/src/components/GetTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ export const GetTooltip = ({
place="top"
positionStrategy="fixed"
clickable={true}
><div style={{ maxWidth: '300px', whiteSpace: 'normal', wordWrap: 'break-word' }}>
>
<div
style={{
maxWidth: "300px",
whiteSpace: "normal",
wordWrap: "break-word",
}}
>
{children}
</div>
</Tooltip>
Expand Down
10 changes: 7 additions & 3 deletions apps/frontend/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ArrowRightOnRectangleIcon,
} from "@heroicons/react/24/solid";
import DarkModeButton from "./DarkModeButton";
import MechanizeBanner from "./MechanizeBanner";
import nightwind from "nightwind/helper";
import {
SignedIn,
Expand Down Expand Up @@ -40,9 +41,12 @@ export default function Header(): ReactElement {

return (
<div className="">
<div className="lg:p-1.5 md:p-2 p-3 lg:text-lg md:text-base text-xs text-white text-center bg-[#007fff]">
Spring/Summer 2026 instructors and room information temporarily unavailable due to changes in the Schedule of Classes.
</div>
<MechanizeBanner />

{/* <div className="lg:p-1.5 md:p-2 p-3 lg:text-lg md:text-base text-xs text-white text-center bg-[#007fff]"> */}
{/* Spring/Summer 2026 instructors and room information temporarily */}
{/* unavailable due to changes in the Schedule of Classes. */}
{/* </div> */}

<div className="flex flex-row items-center justify-between p-6 bg-gray-50 h-16">
<div className="flex flex-initial cursor-pointer flex-row justify-start font-semibold text-gray-800">
Expand Down
10 changes: 4 additions & 6 deletions apps/frontend/src/components/InstructorSearch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,10 @@ const InstructorSearch = () => {
</div>
<div className="flex justify-between">
<div className="mt-3 text-sm text-gray-400">
{
!isSignedIn
? "Sign in to view instructors" :
numResults + " results"
}
</div>
{!isSignedIn
? "Sign in to view instructors"
: numResults + " results"}
</div>
</div>
</>
);
Expand Down
7 changes: 4 additions & 3 deletions apps/frontend/src/components/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ const Link = ({
const courseID = isCourseLink ? href.replace("/course/", "") : undefined;
const tooltipId = isCourseLink && courseID ? `link-${courseID}` : undefined;

const { data: course } = isCourseLink && courseID
? useFetchCourseInfo(courseID)
: ({ data: undefined } as any);
const { data: course } =
isCourseLink && courseID
? useFetchCourseInfo(courseID)
: ({ data: undefined } as any);

const tooltipContent = course
? `${course.name} - ${course.units} units`
Expand Down
68 changes: 68 additions & 0 deletions apps/frontend/src/components/MechanizeBanner.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
"use client";

import { useEffect, useState, type ReactElement } from "react";
import { XMarkIcon } from "@heroicons/react/24/solid";
import Link from "./Link";

const DISMISS_KEY = "cmucourses-mechanize-banner-dismissed";

const PROMPTS = [
"Mechanize is hiring junior SWEs. $300K base + equity.",
"Better at coding than AI? Prove it.",
"We hire engineers to outsmart AI. It’s harder than you think. 300k + equity.",
"Most engineers can’t beat Claude on our take-home. Think you can? 300k + equity for Jr SWEs at Mechanize.",
];
const MECHANIZE_APPLY_URL = "";

function pickPrompt(): string {
return PROMPTS[Math.floor(Math.random() * PROMPTS.length)]!;
}

export default function MechanizeBanner(): ReactElement | null {
const [prompt, setPrompt] = useState<string | null>(null);

useEffect(() => {
try {
if (sessionStorage.getItem(DISMISS_KEY) === "1") {
return;
}
} catch {
/* sessionStorage unavailable (e.g. private mode restrictions) */
}
setPrompt(pickPrompt());
}, []);

const handleDismiss = () => {
try {
sessionStorage.setItem(DISMISS_KEY, "1");
} catch {
/* ignore */
}
setPrompt(null);
};

if (prompt == null) {
return null;
}

return (
<div className="nightwind-prevent-block relative border border-gray-200 lg:p-1.5 md:p-2 p-3 lg:pr-12 md:pr-11 pr-10 lg:text-lg md:text-base text-xs text-black text-center bg-gray-50">
<button
type="button"
onClick={handleDismiss}
aria-label="Dismiss Mechanize banner"
className="absolute right-1 top-1/2 flex h-9 w-9 -translate-y-1/2 items-center justify-center rounded-md text-black hover:[#007fff] focus:outline-none focus-visible:ring-2 focus-visible:ring-white/80"
>
<XMarkIcon className="h-5 w-5" aria-hidden />
</button>
<span>{prompt} </span>
<Link
href={MECHANIZE_APPLY_URL}
openInNewTab
className="font-semibold text-black underline decoration-black hover:no-underline"
>
Apply now
</Link>
</div>
);
}
6 changes: 2 additions & 4 deletions apps/frontend/src/components/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Props = {
title?: string;
};

export const Page = ({ sidebar, content, activePage,title }: Props) => {
export const Page = ({ sidebar, content, activePage, title }: Props) => {
const { isSignedIn, userId } = useAuth();
const posthog = usePostHog();

Expand Down Expand Up @@ -45,9 +45,7 @@ export const Page = ({ sidebar, content, activePage,title }: Props) => {
<SideNav activePage={activePage} />
{sidebar && <Sidebar>{sidebar}</Sidebar>}
<div
className={`flex-1 overflow-y-auto md:h-full ${
!sidebar ? "" : ""
}`}
className={`flex-1 overflow-y-auto md:h-full ${!sidebar ? "" : ""}`}
>
{content}
</div>
Expand Down
8 changes: 6 additions & 2 deletions apps/frontend/src/components/SearchBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,14 @@ const SearchBar = () => {

useEffect(() => {
const query = filtersSearch.trim();
if (query.length === 0) { return; }
if (query.length === 0) {
return;
}
if (POSTHOG_COURSE_SEARCH_REQUIRE_FULL_COURSE_ID) {
const ids = getCourseIDs(filtersSearch);
if (ids.length === 0) { return; }
if (ids.length === 0) {
return;
}
}
const t = window.setTimeout(() => {
posthog?.capture("coursesearch", {
Expand Down
6 changes: 2 additions & 4 deletions apps/frontend/src/components/SideNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
StarIcon,
UserCircleIcon,
BookOpenIcon,
CalendarDaysIcon
CalendarDaysIcon,
} from "@heroicons/react/24/outline";
import React from "react";
import Link from "next/link";
Expand All @@ -30,9 +30,7 @@ const SideNavItem = ({
<div className="flex">
<Icon
className={`h-7 w-7 group-hover:stroke-blue-500 lg:h-6 lg:w-6 ${
active
? "stroke-blue-600 "
: "stroke-gray-500 "
active ? "stroke-blue-600 " : "stroke-gray-500 "
}`}
/>
</div>
Expand Down
Loading
Loading