Skip to content

Commit

Permalink
search results include accurate year and season
Browse files Browse the repository at this point in the history
however, a lot of theses more accurate links lead to nothing in nusearch
  • Loading branch information
denniwang committed Oct 3, 2024
1 parent bdf77e5 commit 78fee84
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
Text,
VStack,
} from "@chakra-ui/react";
import { NUPathEnum, ScheduleCourse2 } from "@graduate/common";
import { NUPathEnum, ScheduleCourse2, SeasonEnum } from "@graduate/common";
import { useState } from "react";
import { useSearchCourses } from "../../hooks";
import {
Expand All @@ -33,6 +33,7 @@ import { SecondaryButton } from "../Button";
interface AddCourseModalProps {
isOpen: boolean;
catalogYear?: number;
season: SeasonEnum;
addTo: string;
/** Function to close the modal UX, returned from the useDisclosure chakra hook */
closeModalDisplay: () => void;
Expand All @@ -50,6 +51,7 @@ interface AddCourseModalProps {
export const AddCourseModal: React.FC<AddCourseModalProps> = ({
isOpen,
catalogYear,
season,
addTo,
closeModalDisplay,
isCourseAlreadyAdded,
Expand Down Expand Up @@ -227,6 +229,8 @@ export const AddCourseModal: React.FC<AddCourseModalProps> = ({
(course) => (
<SearchResult
key={getCourseDisplayString(course)}
year={catalogYear}
season={season}
course={course}
addSelectedCourse={addSelectedCourse}
isResultAlreadyAdded={isCourseAlreadyAdded(course)}
Expand Down
6 changes: 5 additions & 1 deletion packages/frontend/components/AddCourseModal/SearchResult.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { getSearchLink } from "../ScheduleCourse";

interface SearchResultProps {
course: ScheduleCourse2<null>;
year: number | undefined;
season: SeasonEnum;
addSelectedCourse: (course: ScheduleCourse2<null>) => Promise<void>;
isResultAlreadySelected: boolean;
isResultAlreadyAdded: boolean;
Expand All @@ -19,6 +21,8 @@ interface SearchResultProps {

export const SearchResult: React.FC<SearchResultProps> = ({
course,
year,
season,
addSelectedCourse,
isResultAlreadySelected,
isResultAlreadyAdded,
Expand Down Expand Up @@ -52,7 +56,7 @@ export const SearchResult: React.FC<SearchResultProps> = ({
</Box>
<Box ml="auto" mr="sm"></Box>
<a
href={getSearchLink(2022, SeasonEnum.FL, course)}
href={getSearchLink(year ?? 2022, season, course)}
target="_blank"
rel="noreferrer"
>
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/components/Plan/ScheduleTerm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export const ScheduleTerm: React.FC<ScheduleTermProps> = ({
))}
<AddCourseButton onOpen={onOpen} />
<AddCourseModal
season={scheduleTerm.season}
isOpen={isOpen}
catalogYear={catalogYear}
addTo={getSeasonDisplayWord(scheduleTerm.season)}
Expand Down

0 comments on commit 78fee84

Please sign in to comment.