Skip to content

Commit

Permalink
created draggable generics
Browse files Browse the repository at this point in the history
  • Loading branch information
23langloisj committed Oct 27, 2024
1 parent 923c57e commit ed18ff7
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 19 deletions.
8 changes: 5 additions & 3 deletions packages/api/src/major/parsed.initial.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@
"title": "General Placeholders",
"requirements": [
{
"type": "COURSE",
"subject": "PLACEHOLDER",
"classId": 1000,
"subject": "PLACEHOLDER"
"description": "Elective",
"type": "COURSE"
},
{
"type": "COURSE",
"classId": 1000,
"subject": "PLACEHOLDER"
"subject": "PLACEHOLDER",
"description": "NU Path"
}
]
}
Expand Down
49 changes: 33 additions & 16 deletions packages/frontend/components/Sidebar/GenericSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,35 @@ import { useState } from "react";
import SectionRequirement from "./SectionRequirement";

Check failure on line 8 in packages/frontend/components/Sidebar/GenericSection.tsx

View workflow job for this annotation

GitHub Actions / Run linting for all packages

'SectionRequirement' is defined but never used. Allowed unused vars must match /^_/u
import { IAndCourse2, ScheduleCourse2 } from "@graduate/common";

Check failure on line 9 in packages/frontend/components/Sidebar/GenericSection.tsx

View workflow job for this annotation

GitHub Actions / Run linting for all packages

'IAndCourse2' is defined but never used. Allowed unused vars must match /^_/u
import { DraggableScheduleCourse } from "../ScheduleCourse";
import {
GENERIC_ELECTIVE_ID_PREFIX,
GENERIC_NUPATH_ID_PREFIX,
} from "../../utils";

// Define the props interface for GenericSection
interface GenericSectionProps {
courseData: { [id: string]: ScheduleCourse2<null> };
dndIdPrefix: string;
}

// The sample IAndCourse2 requirement object
const andCourseRequirement: IAndCourse2 = {
type: "AND",
courses: [],
export const GENERIC_ELECTIVE: ScheduleCourse2<string> = {
name: "Elective",
classId: "Generic Class",
subject: "",
numCreditsMax: 8,
numCreditsMin: 0,
id: `${GENERIC_ELECTIVE_ID_PREFIX}-generic-elective"`,
nupaths: [],
};

export const GENERIC_NUPATH: ScheduleCourse2<string> = {
name: "NUPath",
classId: "Generic Class",
subject: "",
numCreditsMax: 8,
numCreditsMin: 0,
id: `${GENERIC_NUPATH_ID_PREFIX}-generic-nupath"`,
nupaths: [],
};

const ClassOption: React.FC<{ type: "NUpath" | "Elective Placeholder" }> = ({

Check failure on line 42 in packages/frontend/components/Sidebar/GenericSection.tsx

View workflow job for this annotation

GitHub Actions / Run linting for all packages

'ClassOption' is assigned a value but never used. Allowed unused vars must match /^_/u
Expand All @@ -31,6 +49,8 @@ const ClassOption: React.FC<{ type: "NUpath" | "Elective Placeholder" }> = ({
);
};

const courses = [GENERIC_ELECTIVE, GENERIC_NUPATH];

const GenericSection: React.FC<GenericSectionProps> = ({
courseData,
dndIdPrefix,

Check failure on line 56 in packages/frontend/components/Sidebar/GenericSection.tsx

View workflow job for this annotation

GitHub Actions / Run linting for all packages

'dndIdPrefix' is defined but never used. Allowed unused args must match /^_/u
Expand Down Expand Up @@ -112,20 +132,17 @@ const GenericSection: React.FC<GenericSectionProps> = ({
<Stack spacing={3}>
<Box pl="xs" pt="xs">
{Object.keys(courseData).length > 0 && (
<DraggableScheduleCourse
key={Object.keys(courseData)[0]}
scheduleCourse={{
...courseData[Object.keys(courseData)[0]],
id: dndIdPrefix + "-" + Object.keys(courseData)[0],
}}
isInSidebar
// TODO: isChecked is for when the requirement is added to the plan and validated. When true, this will render a checkmark.
isChecked={false}
isDisabled={false}
/>
<div>
{courses.map((course, index) => (
<DraggableScheduleCourse
key={index}
scheduleCourse={course}
isDisabled={false}
/>
))}
</div>
)}
</Box>
<ClassOption type="Elective Placeholder" />
</Stack>
)}
</Box>
Expand Down
2 changes: 2 additions & 0 deletions packages/frontend/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { GetStudentResponse } from "@graduate/common";

export const DELETE_COURSE_AREA_DND_ID = "delete-course-area";
export const SIDEBAR_DND_ID_PREFIX = "sidebar";
export const GENERIC_ELECTIVE_ID_PREFIX = "generic-elective";
export const GENERIC_NUPATH_ID_PREFIX = "generic-nupath";
export const WEAK_PASSWORD_MSG =
"A password should be at least 8 characters with digits and letters";
export const SEARCH_NEU_FETCH_COURSE_ERROR_MSG =
Expand Down

0 comments on commit ed18ff7

Please sign in to comment.