From c34d49c1e383aba5de78966c68151119c5315b73 Mon Sep 17 00:00:00 2001 From: Dennis Wang <66754085+hellolol2016@users.noreply.github.com> Date: Wed, 25 Sep 2024 23:25:17 -0400 Subject: [PATCH 1/9] added link to all draggable courses --- .../ScheduleCourse/ScheduleCourse.tsx | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/packages/frontend/components/ScheduleCourse/ScheduleCourse.tsx b/packages/frontend/components/ScheduleCourse/ScheduleCourse.tsx index fd5c4656b..67a060adf 100644 --- a/packages/frontend/components/ScheduleCourse/ScheduleCourse.tsx +++ b/packages/frontend/components/ScheduleCourse/ScheduleCourse.tsx @@ -7,6 +7,7 @@ import { INEUReqError, IRequiredCourse, ScheduleCourse2, + SeasonEnum, } from "@graduate/common"; import { forwardRef, PropsWithChildren, useEffect, useState } from "react"; import { @@ -370,6 +371,17 @@ const ScheduleCourseDraggedContents: React.FC< {`${courseToString(scheduleCourse)} `} {scheduleCourse.name} +

+ {scheduleCourse != null && ( + + Find on NUSearch! + + )}

@@ -383,3 +395,33 @@ const ScheduleCourseDraggedContents: React.FC< const ScheduleCourseSpacer: React.FC = () => { return
; }; + +function getSearchLink( + catalogYear: number, + szn: SeasonEnum, + course: ScheduleCourse2 +): 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}`; +} From 9e09e251472bafa5c91918ad776e2e3a1a520c35 Mon Sep 17 00:00:00 2001 From: Dennis Wang <66754085+hellolol2016@users.noreply.github.com> Date: Sun, 29 Sep 2024 16:02:49 -0400 Subject: [PATCH 2/9] searchnu results in searchresult component still using hardcoded components :( --- .../components/AddCourseModal/NUPathLabel.tsx | 2 +- .../components/AddCourseModal/SearchResult.tsx | 18 +++++++++++++++++- .../ScheduleCourse/ScheduleCourse.tsx | 2 +- packages/frontend/public/more-info.svg | 3 +++ 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 packages/frontend/public/more-info.svg diff --git a/packages/frontend/components/AddCourseModal/NUPathLabel.tsx b/packages/frontend/components/AddCourseModal/NUPathLabel.tsx index 2e2ad21d4..2c4dc62f2 100644 --- a/packages/frontend/components/AddCourseModal/NUPathLabel.tsx +++ b/packages/frontend/components/AddCourseModal/NUPathLabel.tsx @@ -48,7 +48,7 @@ export const NUPathLabel: React.FC = ({ } return ( - + {nuPaths.map((nuPath) => ( ; @@ -48,6 +51,19 @@ export const SearchResult: React.FC = ({ {course.name} + + + See on SearchNU! + { return
; }; -function getSearchLink( +export function getSearchLink( catalogYear: number, szn: SeasonEnum, course: ScheduleCourse2 diff --git a/packages/frontend/public/more-info.svg b/packages/frontend/public/more-info.svg new file mode 100644 index 000000000..6b7eaccd8 --- /dev/null +++ b/packages/frontend/public/more-info.svg @@ -0,0 +1,3 @@ + + + From d40fe9816e5327feb8fe60e56af6fe2576edb5d8 Mon Sep 17 00:00:00 2001 From: Dennis Wang <66754085+hellolol2016@users.noreply.github.com> Date: Sun, 29 Sep 2024 16:05:22 -0400 Subject: [PATCH 3/9] removed old link on draggable component --- .../components/ScheduleCourse/ScheduleCourse.tsx | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/packages/frontend/components/ScheduleCourse/ScheduleCourse.tsx b/packages/frontend/components/ScheduleCourse/ScheduleCourse.tsx index 80ab8deab..44a3a0382 100644 --- a/packages/frontend/components/ScheduleCourse/ScheduleCourse.tsx +++ b/packages/frontend/components/ScheduleCourse/ScheduleCourse.tsx @@ -371,17 +371,6 @@ const ScheduleCourseDraggedContents: React.FC< {`${courseToString(scheduleCourse)} `} {scheduleCourse.name} -

- {scheduleCourse != null && ( - - Find on NUSearch! - - )}

From bdf77e5cbbde21001a74a8b1d8606b8899d7af31 Mon Sep 17 00:00:00 2001 From: Dennis Wang <66754085+hellolol2016@users.noreply.github.com> Date: Sun, 29 Sep 2024 16:08:34 -0400 Subject: [PATCH 4/9] removed unused import --- packages/frontend/components/AddCourseModal/SearchResult.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/frontend/components/AddCourseModal/SearchResult.tsx b/packages/frontend/components/AddCourseModal/SearchResult.tsx index ef2c6c259..cc0371169 100644 --- a/packages/frontend/components/AddCourseModal/SearchResult.tsx +++ b/packages/frontend/components/AddCourseModal/SearchResult.tsx @@ -5,7 +5,6 @@ import { getCourseDisplayString } from "../../utils/"; import { GraduateToolTip } from "../GraduateTooltip"; import { NUPathLabel } from "./NUPathLabel"; import Image from "next/image"; -import SearchIcon from "/more-info.svg"; import { getSearchLink } from "../ScheduleCourse"; interface SearchResultProps { From 78fee843a5a71f49c2bea47131c8cc9df9c3d22d Mon Sep 17 00:00:00 2001 From: Dennis Wang <66754085+hellolol2016@users.noreply.github.com> Date: Thu, 3 Oct 2024 13:54:06 -0400 Subject: [PATCH 5/9] search results include accurate year and season however, a lot of theses more accurate links lead to nothing in nusearch --- .../frontend/components/AddCourseModal/AddCourseModal.tsx | 6 +++++- .../frontend/components/AddCourseModal/SearchResult.tsx | 6 +++++- packages/frontend/components/Plan/ScheduleTerm.tsx | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/frontend/components/AddCourseModal/AddCourseModal.tsx b/packages/frontend/components/AddCourseModal/AddCourseModal.tsx index bf748519a..df7859e93 100644 --- a/packages/frontend/components/AddCourseModal/AddCourseModal.tsx +++ b/packages/frontend/components/AddCourseModal/AddCourseModal.tsx @@ -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 { @@ -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; @@ -50,6 +51,7 @@ interface AddCourseModalProps { export const AddCourseModal: React.FC = ({ isOpen, catalogYear, + season, addTo, closeModalDisplay, isCourseAlreadyAdded, @@ -227,6 +229,8 @@ export const AddCourseModal: React.FC = ({ (course) => ( ; + year: number | undefined; + season: SeasonEnum; addSelectedCourse: (course: ScheduleCourse2) => Promise; isResultAlreadySelected: boolean; isResultAlreadyAdded: boolean; @@ -19,6 +21,8 @@ interface SearchResultProps { export const SearchResult: React.FC = ({ course, + year, + season, addSelectedCourse, isResultAlreadySelected, isResultAlreadyAdded, @@ -52,7 +56,7 @@ export const SearchResult: React.FC = ({ diff --git a/packages/frontend/components/Plan/ScheduleTerm.tsx b/packages/frontend/components/Plan/ScheduleTerm.tsx index 55caafd2f..394ae9135 100644 --- a/packages/frontend/components/Plan/ScheduleTerm.tsx +++ b/packages/frontend/components/Plan/ScheduleTerm.tsx @@ -87,6 +87,7 @@ export const ScheduleTerm: React.FC = ({ ))} Date: Thu, 3 Oct 2024 14:17:07 -0400 Subject: [PATCH 6/9] implemented year params to transfer courses modal --- packages/frontend/components/Plan/TransferCourses.tsx | 11 ++++++++++- packages/frontend/pages/home.tsx | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/frontend/components/Plan/TransferCourses.tsx b/packages/frontend/components/Plan/TransferCourses.tsx index f3658937a..7337b73fd 100644 --- a/packages/frontend/components/Plan/TransferCourses.tsx +++ b/packages/frontend/components/Plan/TransferCourses.tsx @@ -1,7 +1,7 @@ import { ChevronDownIcon, ChevronUpIcon } from "@chakra-ui/icons"; import { Flex, Grid, Stack, Text, useDisclosure } from "@chakra-ui/react"; import { API } from "@graduate/api-client"; -import { ScheduleCourse2, StudentModel } from "@graduate/common"; +import { ScheduleCourse2, SeasonEnum, StudentModel } from "@graduate/common"; import { useRouter } from "next/router"; import { fetchStudentAndPrepareForDnd, useStudentWithPlans } from "../../hooks"; import { @@ -19,11 +19,13 @@ import { IsGuestContext } from "../../pages/_app"; interface TransferCoursesToggleProps { isExpanded: boolean; toggleExpanded: () => void; + year: number; } export const TransferCourses: React.FC = ({ isExpanded, toggleExpanded, + year, }) => { const { student, isLoading, mutateStudent } = useStudentWithPlans(); const router = useRouter(); @@ -86,11 +88,13 @@ export const TransferCourses: React.FC = ({ isExpanded={isExpanded} toggleExpanded={toggleExpanded} totalTransferCredits={totalTransferCredits} + year={year} /> {isExpanded && ( )}
@@ -102,11 +106,13 @@ interface TransferCoursesBodyProps { updateTransferCourses: ( updateTransferCourses: ScheduleCourse2[] ) => void; + year: number; } const TransferCoursesBody: React.FC = ({ transferCourses, updateTransferCourses, + year, }) => { const { isOpen, onOpen, onClose } = useDisclosure(); @@ -145,6 +151,9 @@ const TransferCoursesBody: React.FC = ({ ))} { /> setIsTransferCoursesExpanded(!isTransferCoursesExpanded) From d1470414b5940049d9521d2b64f6fb23d9e6cb0f Mon Sep 17 00:00:00 2001 From: Dennis Wang <66754085+hellolol2016@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:58:32 -0400 Subject: [PATCH 7/9] updated search link to include course name rather than subject and classid --- .../frontend/components/ScheduleCourse/ScheduleCourse.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/frontend/components/ScheduleCourse/ScheduleCourse.tsx b/packages/frontend/components/ScheduleCourse/ScheduleCourse.tsx index 44a3a0382..6263ddec4 100644 --- a/packages/frontend/components/ScheduleCourse/ScheduleCourse.tsx +++ b/packages/frontend/components/ScheduleCourse/ScheduleCourse.tsx @@ -411,6 +411,6 @@ export function getSearchLink( sznInt = 1; } return `https://searchneu.com/NEU/${catalogYear}${sznInt}${0}/search/${ - course.subject - }${course.classId}`; + course.name + }`; } From 08177a897f59b96c36d1fde7df86d1dab187d6b3 Mon Sep 17 00:00:00 2001 From: Dennis Wang <66754085+hellolol2016@users.noreply.github.com> Date: Sun, 6 Oct 2024 16:58:50 -0400 Subject: [PATCH 8/9] swapped out image for chakra ui icon --- .../components/AddCourseModal/SearchResult.tsx | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/frontend/components/AddCourseModal/SearchResult.tsx b/packages/frontend/components/AddCourseModal/SearchResult.tsx index 3009493b2..e242b4b49 100644 --- a/packages/frontend/components/AddCourseModal/SearchResult.tsx +++ b/packages/frontend/components/AddCourseModal/SearchResult.tsx @@ -1,10 +1,9 @@ -import { AddIcon } from "@chakra-ui/icons"; +import { AddIcon, QuestionOutlineIcon } from "@chakra-ui/icons"; import { Box, Flex, IconButton, Text } from "@chakra-ui/react"; 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 { @@ -60,12 +59,7 @@ export const SearchResult: React.FC = ({ target="_blank" rel="noreferrer" > - See on SearchNU! + Date: Sun, 6 Oct 2024 17:04:11 -0400 Subject: [PATCH 9/9] updated info icon and removed unneeded file --- .../components/AddCourseModal/SearchResult.tsx | 14 +++++++++++++- packages/frontend/public/more-info.svg | 3 --- 2 files changed, 13 insertions(+), 4 deletions(-) delete mode 100644 packages/frontend/public/more-info.svg diff --git a/packages/frontend/components/AddCourseModal/SearchResult.tsx b/packages/frontend/components/AddCourseModal/SearchResult.tsx index e242b4b49..2b7b1751a 100644 --- a/packages/frontend/components/AddCourseModal/SearchResult.tsx +++ b/packages/frontend/components/AddCourseModal/SearchResult.tsx @@ -59,7 +59,19 @@ export const SearchResult: React.FC = ({ target="_blank" rel="noreferrer" > - + } + color="primary.blue.light.main" + border={0} + colorScheme="primary.blue.light.main" + isRound + size="sm" + pr={1} + isLoading={isSelectingAnotherCourse} + isDisabled={isResultAlreadyAdded || isResultAlreadySelected} + alignSelf="center" + /> - -