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

added link to all draggable courses #754

Merged
merged 9 commits into from
Oct 18, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const NUPathLabel: React.FC<NuPathLabelProps> = ({
}

return (
<Flex justifyContent="end" gap="2xs" flex="1" ml="xs">
<Flex justifyContent="end" gap="2xs" ml="xs">
{nuPaths.map((nuPath) => (
<Flex
key={nuPaths.indexOf(nuPath)}
Expand Down
17 changes: 16 additions & 1 deletion packages/frontend/components/AddCourseModal/SearchResult.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { AddIcon } from "@chakra-ui/icons";
import { Box, Flex, IconButton, Text } from "@chakra-ui/react";
import { NUPathEnum, ScheduleCourse2 } from "@graduate/common";
import { NUPathEnum, ScheduleCourse2, SeasonEnum } from "@graduate/common";
import { getCourseDisplayString } from "../../utils/";
import { GraduateToolTip } from "../GraduateTooltip";
import { NUPathLabel } from "./NUPathLabel";
import Image from "next/image";
import { getSearchLink } from "../ScheduleCourse";

interface SearchResultProps {
course: ScheduleCourse2<null>;
Expand Down Expand Up @@ -48,6 +50,19 @@ export const SearchResult: React.FC<SearchResultProps> = ({
{course.name}
</Text>
</Box>
<Box ml="auto" mr="sm"></Box>
<a
href={getSearchLink(2022, SeasonEnum.FL, course)}
KobeZ123 marked this conversation as resolved.
Show resolved Hide resolved
target="_blank"
rel="noreferrer"
>
<Image
KobeZ123 marked this conversation as resolved.
Show resolved Hide resolved
src="/more-info.svg"
width={14}
height={14}
alt="See on SearchNU!"
/>
</a>
<NUPathLabel
nuPaths={course.nupaths ? course.nupaths : []}
filteredPaths={filteredPaths}
Expand Down
31 changes: 31 additions & 0 deletions packages/frontend/components/ScheduleCourse/ScheduleCourse.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
INEUReqError,
IRequiredCourse,
ScheduleCourse2,
SeasonEnum,
} from "@graduate/common";
import { forwardRef, PropsWithChildren, useEffect, useState } from "react";
import {
Expand Down Expand Up @@ -383,3 +384,33 @@ const ScheduleCourseDraggedContents: React.FC<
const ScheduleCourseSpacer: React.FC = () => {
return <div style={{ width: "32px", height: "32px", flexShrink: 0 }}></div>;
};

export function getSearchLink(
catalogYear: number,
szn: SeasonEnum,
course: ScheduleCourse2<unknown>
): string {
let sznInt = -1;
switch (szn) {
case SeasonEnum.FL:
sznInt = 1;
break;
case SeasonEnum.SP:
sznInt = 3;
break;
case SeasonEnum.S1:
sznInt = 4;
break;
case SeasonEnum.SM:
sznInt = 5;
break;
case SeasonEnum.S2:
sznInt = 6;
break;
default:
sznInt = 1;
}
return `https://searchneu.com/NEU/${catalogYear}${sznInt}${0}/search/${
course.subject
}${course.classId}`;
}
3 changes: 3 additions & 0 deletions packages/frontend/public/more-info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading