Skip to content

Commit

Permalink
implemented year params to transfer courses modal
Browse files Browse the repository at this point in the history
  • Loading branch information
denniwang committed Oct 3, 2024
1 parent 78fee84 commit 8fb5750
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/frontend/components/Plan/TransferCourses.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -19,11 +19,13 @@ import { IsGuestContext } from "../../pages/_app";
interface TransferCoursesToggleProps {
isExpanded: boolean;
toggleExpanded: () => void;
year: number;
}

export const TransferCourses: React.FC<TransferCoursesToggleProps> = ({
isExpanded,
toggleExpanded,
year,
}) => {
const { student, isLoading, mutateStudent } = useStudentWithPlans();
const router = useRouter();
Expand Down Expand Up @@ -86,11 +88,13 @@ export const TransferCourses: React.FC<TransferCoursesToggleProps> = ({
isExpanded={isExpanded}
toggleExpanded={toggleExpanded}
totalTransferCredits={totalTransferCredits}
year={year}
/>
{isExpanded && (
<TransferCoursesBody
transferCourses={transferCourses}
updateTransferCourses={updateTransferCourses}
year={year}
/>
)}
</Flex>
Expand All @@ -102,11 +106,13 @@ interface TransferCoursesBodyProps {
updateTransferCourses: (
updateTransferCourses: ScheduleCourse2<null>[]
) => void;
year: number;
}

const TransferCoursesBody: React.FC<TransferCoursesBodyProps> = ({
transferCourses,
updateTransferCourses,
year,
}) => {
const { isOpen, onOpen, onClose } = useDisclosure();

Expand Down Expand Up @@ -145,6 +151,9 @@ const TransferCoursesBody: React.FC<TransferCoursesBodyProps> = ({
))}
<AddCourseButton onOpen={onOpen} />
<AddCourseModal
//is season really necessary? i have placeholder here
season={SeasonEnum.FL}
catalogYear={year}
isOpen={isOpen}
addTo="Transfer Courses"
closeModalDisplay={onClose}
Expand Down
1 change: 1 addition & 0 deletions packages/frontend/pages/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ const HomePage: NextPage = () => {
/>
<Divider borderColor="neutral.200" borderWidth={1} />
<TransferCourses
year={selectedPlan.catalogYear}
isExpanded={isTransferCoursesExpanded}
toggleExpanded={() =>
setIsTransferCoursesExpanded(!isTransferCoursesExpanded)
Expand Down

0 comments on commit 8fb5750

Please sign in to comment.