Skip to content

Commit

Permalink
broken but otw
Browse files Browse the repository at this point in the history
  • Loading branch information
23langloisj committed Oct 24, 2024
1 parent d712854 commit 7fa862b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
29 changes: 24 additions & 5 deletions packages/frontend/components/Sidebar/GenericSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,35 @@ import {
} from "@chakra-ui/icons";
import { Box, Flex, Stack, Text } from "@chakra-ui/react";
import { useState } from "react";
import SectionRequirement from "./SectionRequirement";
import { IAndCourse2, ScheduleCourse2 } from "@graduate/common";

interface ClassOptionProps {
type: "NUpath" | "Elective Placeholder";
// Define the props interface for GenericSection
interface GenericSectionProps {
courseData: { [id: string]: ScheduleCourse2<null> };
dndIdPrefix: string;
}

const ClassOption: React.FC<ClassOptionProps> = ({ type }) => {
// The sample IAndCourse2 requirement object
const andCourseRequirement: IAndCourse2 = {
type: "AND",
courses: [],
};

const ClassOption: React.FC<{ type: "NUpath" | "Elective Placeholder" }> = ({
type,
}) => {
return (
<Text fontSize="sm" color="primary.blue.dark.main" mt="0">
{type === "NUpath" ? "NUpath" : "Elective Placeholder"}
</Text>
);
};

const GenericSection: React.FC = () => {
const GenericSection: React.FC<GenericSectionProps> = ({
courseData,
dndIdPrefix,
}) => {
const [opened, setOpened] = useState(false);

return (
Expand Down Expand Up @@ -92,7 +107,11 @@ const GenericSection: React.FC = () => {
>
{opened && (
<Stack spacing={3}>
<ClassOption type="NUpath" />
<SectionRequirement
requirement={andCourseRequirement}
courseData={courseData} // Passing courseData prop here
dndIdPrefix={dndIdPrefix} // dndIdPrefix prop passed here
/>
<ClassOption type="Elective Placeholder" />
</Stack>
)}
Expand Down
2 changes: 1 addition & 1 deletion packages/frontend/components/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const Sidebar: React.FC<SidebarProps> = memo(
>
{courseData && (
<>
<GenericSection />
<GenericSection courseData={courseData} dndIdPrefix="temp" />
<NUPathSection
coursesTaken={coursesTaken}
dndIdPrefix={`${SIDEBAR_DND_ID_PREFIX}-nupath`}
Expand Down

0 comments on commit 7fa862b

Please sign in to comment.