Skip to main content

Current Plan Slice

The slice holding information about the current search, primarily for the search popup and relevant children. Holds information such as current searchterm, retrieved courses, and filters.

State

type searchStates = {
searching: boolean;
searchTerm: string;
searchTime: TimeBundle;
filters: FilterObj;
retrievedCourses: SISRetrievedCourse[];
retrievedVerions: number[];
inspectedVersion: Course | "None";
inspectedCourse: SISRetrievedCourse | "None";
placeholder: boolean;
searchStack: { sis: SISRetrievedCourse; ver: Course }[];
};
PropertyTypeDescription
searchingbooleanIndicates whether or not the application is actively searching
searchTermstringThe current user query for searching
searchTimeTimeBundleThe time the user is currently searching in
filtersFilterObjThe active filters being applied to the serach
retrievedCoursesSISRetrievedCourse[]The current list of unfiltered courses matching the query
retrievedVerionsnumber[]The list of correct versions fo the retrieved coruses list
inspectedVersionCourse | "None"The version of the course being currently inspected in the popup
inspectedCourseSISRetrievedCourse | "None"The course being currently inspected in the popup
placeholderbooleanWhether or not a placeholder is being added
searchStackArray of { sis: SISRetrievedCourse; ver: Course }The stack used to track prereq navigation

Relevant Types

type searchStates = {
searching: boolean;
searchTerm: string;
searchTime: TimeBundle;
filters: FilterObj;
retrievedCourses: SISRetrievedCourse[];
retrievedVerions: number[];
inspectedVersion: Course | "None";
inspectedCourse: SISRetrievedCourse | "None";
placeholder: boolean;
searchStack: { sis: SISRetrievedCourse; ver: Course }[];
};
type searchStackUpdate = {
new: SISRetrievedCourse;
oldSIS: SISRetrievedCourse;
oldV: Course;
};

Reducers

ReducerAction Payload TypeState Affected
updateSearchTimeTimeBundlesearchTime.searchYear, searchTime.searchSemester
updateSearchTermStringsearchTerm
updateSearchStatusbooleansearching
updateInspectedCourseSISRetrievedCourse | "None"inspectedVersion, inspectedCourse
updateInspectedVersionCourse | "None"inspectedVersion
clearSearchfilters, searchTerm, searchTime, searching, inspectedCourse, retrievedCourses, searchStack
updateRetrievedCoursesSISRetrievedCourse[]retrievedCourses
updatePlaceholderbooleanplaceholder
updateSearchFilters{ filter: FilterType; value: any }Properties of filter
updateSearchStacksearchStackUpdatesearchStack, inspectedCourse, inspectedVersion
popSearchStacksearchStack, inspectedCourse, inspectedVersion

updateSearchTime

ComponentDescription
SemesterUsed in addCourse to set initial semester and years
SisCourseUsed in handleYearChange to adjust target year and semester
GenerateNewPlanUsed in useEffect for generating a new plan

updateSearchTerm

ComponentDescription
FormUsed in handleSeachTerm to update the search term based on use input

updateSearchStatus

ComponentDescription
SemesterUsed in addCourse to update searching state
SearchUsed as an onclick callback to close the search popup

updateInspectedCourse

ComponentDescription
CourseDisplayPopupUsed in useEffect to display correct inspected course
CourseCardUsed in handleCourseClick to inspect a course on click
PlaceholderUsed in clearInspected to clear the inspected course

updateInspectedVersion

ComponentDescription
CourseDisplayPopupUsed in useEffect to display correct inspected course version
CourseDisplayPopupUsed in useEffect to display correct inspected course version for placeholders
CourseCardUsed in handleCourseClick to display correct course after user click
SearchListUsed in onPlaceholderClick to display placeholder course info
PlaceholderUsed in onPTChange to update placeholder course info
PlaceholderUsed in onPCChange to update placeholder course info
PlaceholderUsed in onPNChange to update placeholder course info
PlaceholderUsed in onPDChange to update placeholder course info
PlaceholderUsed in onPTagChange to update placeholder course info
SisCourseUsed in handleTermSwitch to switch the inspected course version

clearSearch

ComponentDescription
SemesterUsed in addPrereq to clear search after adding prereq
SemesterUsed in handlePostResponse to clear search after a successful post
CourseDisplayPopupUsed in handlePostAddCourse to clear search after a successful post after course add
CourseDisplayUsed in addCourse after a course is added

updateRetrievedCourses

ComponentDescription
FormUsed in useEffect for searching to clear courses if filters/queries are empty
FormUsed in useEffect for searching extras
FormUsed in handleFinishFinding after processing newly found courses
FormUsed in performSmartSearch after api search request

updatePlaceholder

ComponentDescription
CourseDisplayPopupUsed in useEffect for showing a non-placeholder course
CourseDisplayPopupUsed in useEffect for showing a placeholder course
CourseDisplayPopupUsed in handlePostAddCourse after updating a non-placeholder course
CourseCardUsed in handleCourseClick to show a non-placeholder course
SearchListUsed in onPlaceholderClick to activate placeholder on click
SearchListUsed in onPlaceholderClick to deactivate placeholder on click

updateSearchFilters

ComponentDescription
Filters (multiple)Used in multiple handle filter change helpers to handle individual filter property changes
Form (multiple)Used to set default filters for handling adding course to the current or future year

updateSearchStack

ComponentDescription
PrereqDisplayUsed in updateInspected to handle inspecting prereqs of a course in order of inspection

popSearchStack

ComponentDescription
SisCourseUsed in getPrevCourseButton to go back to the last previously inspected course while inspecting prereqs

Selectors

SelectorProperty
selectYearsearchTime.searchYear
selectSemestersearchTime.searchSemester
selectSearchtermsearchTerm
selectSearchStatussearching
selectSearchFiltersfilters
selectRetrievedCoursesretrievedCourses
selectInspectedCourseinspectedCourse
selectPlaceholderplaceholder
selectSearchStacksearchStack
selectVersioninspectedVersion

selectYear

ComponentDescription
SearchUsed in getYearName to display the correct searching year
PrereqDisplayUsed in getYearById to generate year objects
FormUsed in getYearVal to get the search year if possible
CourseDisplayUsed in getYear to get the search year if possible
SisCourseUsed as the value of the year select input

selectSemester

ComponentDescription
SearchUsed to display the semester current being searched in
PrereqDisplayUsed in getNonStringPrereq to check prereqs
FormUsed to set default filters and update filters based on semester
CourseDisplayUsed in updateDistributions in the body of the post request as the term property
SisCourseUsed in handleYearChange to update search semester and for semester selection dropdown

selectSearchterm

ComponentDescription
FormUsed in many places as the user query to search

selectSearchStatus

ComponentDescription
CourseListUsed as a useEffect dependency for rendering years and their courses
indexUsed as a condition for rendering Search component popup
PlaceholderUsed as a condition showing addCourse helper button

selectSearchFilters

ComponentDescription
FiltersUsed in many places to access and display properties of current search filters
FormUsed in many places to filter search logic based on properties
SearchListUsed to update pagination based on filtered results

selectRetrievedCourse

ComponentDescription
SearchListUsed in many places, processed with filters to display search results

selectInspectedCourse

ComponentDescription
PrereqDisplayUsed in updateInspected as a condition to updating the search stack for prereqs
CourseEvalSectionUsed in useEffect for updating course evals whenever a new course is inspected, and as a condition for fetching
SisCourseUsed in many places to determine if certain actions are valid (such as switching target semester for adding a course)

selectPlaceholder

ComponentDescription
CourseListUsed as a useEffect dependency for generating and updating year and course displays
SemesterUsed in updateDistributions to update distributions
SearchListUsed in onPlaceholderClick to display add placeholder menu
CourseDisplayPopupUsed in addCourse to update distribution bars after adding a course
CourseDisplayUsed in updateDistributions to update distribution bars after adding a course
PlaceHolderUsed as a condition for updating placeholder information

selectSearchStack

ComponentDescription
SisCourseUsed as a condition for display UI such as addPrereq and previousCourse buttons

selectVersion

ComponentDescription
SemesterUsed in many places to update the semesters and distributions
CourseDisplayPopupUsed in many places to display information about the correctly versioned course
PrereqDisplayUsed in many places to display information about the correctly versioned course
CourseCardUsed as a condition for showing a clickable course card
CourseDisplayUsed in many places to display information about the correctly versioned course
CourseVersionUsed in many places to display information about the correctly versioned course
PlaceholderUsed to regenerate placeholder information
SisCourseUsed as a condition for certain functionality, such as course adding