-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #125 from ssss-sfu/121-poc-implement-course-explorer
Implement course explorer
- Loading branch information
Showing
16 changed files
with
9,750 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "scripts/course-explorer-script"] | ||
path = scripts/course-explorer-script | ||
url = [email protected]:ssss-sfu/course-explorer-script.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
import { Dispatch, MouseEventHandler, SetStateAction } from "react"; | ||
import { Course, SectionsPerTerm } from "types/course"; | ||
|
||
interface SidebarCourseProps { | ||
course: Course; | ||
closeCourseShown: MouseEventHandler<HTMLSpanElement>; | ||
} | ||
|
||
interface SectionsPerTermProps { | ||
title: string; | ||
sectionsPerTerm: SectionsPerTerm; | ||
} | ||
|
||
const SectionsPerTermDisplay: React.FC<SectionsPerTermProps> = ({ | ||
title, | ||
sectionsPerTerm, | ||
}) => { | ||
return ( | ||
<div className="course-info course-last-sections"> | ||
<h2> | ||
{title} - {sectionsPerTerm.term} | ||
</h2> | ||
<div className="sections-container"> | ||
{sectionsPerTerm.sections | ||
.filter((s) => s.info.type !== "n") | ||
.map((section) => { | ||
const instructorNames = | ||
section.info.instructorNames.length > 0 | ||
? section.info.instructorNames | ||
: ["Unknown"]; | ||
return ( | ||
<div className="section-unit" key={section.info.classNumber}> | ||
<p> | ||
{section.info.section} - {instructorNames.join(", ")} | ||
</p> | ||
{section.info.campus !== "None" && <p>{section.info.campus}</p>} | ||
<ul className="schedule-list"> | ||
{section.courseSchedule | ||
.filter((schedule) => schedule.days !== "") | ||
.map((schedule) => { | ||
return ( | ||
<li | ||
key={schedule.sectionCode} | ||
className="schedule-unit" | ||
> | ||
{schedule.days}; {schedule.startTime}-{" "} | ||
{schedule.endTime} | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export const SidebarCourse: React.FC<SidebarCourseProps> = ({ | ||
course, | ||
closeCourseShown, | ||
}) => { | ||
return ( | ||
<div className="sidebar-course"> | ||
<div className="course-info"> | ||
<p className="space-between"> | ||
<b> | ||
{course.info.dept} {course.info.number} ({course.info.units}) | ||
</b> | ||
<span className="close-sidebar" onClick={closeCourseShown}> | ||
Close | ||
</span> | ||
</p> | ||
<h2>{course.info.title}</h2> | ||
<p>{course.info.description}</p> | ||
{course.info.notes && <p>{course.info.notes}</p>} | ||
<p> | ||
Prerequisites:{" "} | ||
{course.info.prerequisites !== "" | ||
? course.info.prerequisites | ||
: "None"} | ||
</p> | ||
</div> | ||
<SectionsPerTermDisplay | ||
title="Last offering" | ||
sectionsPerTerm={course.last_sections} | ||
/> | ||
{course.future_sections.sections.length > 0 ? ( | ||
<SectionsPerTermDisplay | ||
title="Next offering" | ||
sectionsPerTerm={course.future_sections} | ||
/> | ||
) : ( | ||
<h2>Currently not offered for {course.future_sections.term}</h2> | ||
)} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.