-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5653bf8
commit 12527fe
Showing
9 changed files
with
65 additions
and
27 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
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
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
43 changes: 43 additions & 0 deletions
43
apps/antalmanac/src/components/RightPane/SectionTable/CourseInfo/CourseInfoSearchButton.tsx
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,43 @@ | ||
import RightPaneStore from '$components/RightPane/RightPaneStore'; | ||
import { useCoursePaneStore } from '$stores/CoursePaneStore'; | ||
import { useTabStore } from '$stores/TabStore'; | ||
import { Search } from '@material-ui/icons'; | ||
import { Button } from '@mui/material'; | ||
import { AACourse } from '@packages/antalmanac-types'; | ||
import { useCallback } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
/** | ||
* Routes the user to the corresponding search result | ||
*/ | ||
export function CourseInfoSearchButton({ courseDetails, term }: { courseDetails: AACourse; term: string }) { | ||
const { setActiveTab } = useTabStore(); | ||
const { displaySections } = useCoursePaneStore(); | ||
|
||
const { deptCode, courseNumber } = courseDetails; | ||
|
||
const handleClick = useCallback(() => { | ||
RightPaneStore.updateFormValue('deptValue', deptCode); | ||
RightPaneStore.updateFormValue('courseNumber', courseNumber); | ||
RightPaneStore.updateFormValue('term', term); | ||
|
||
displaySections(); | ||
setActiveTab(1); | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<Button | ||
variant="contained" | ||
size="small" | ||
color="primary" | ||
style={{ minWidth: 'fit-content' }} | ||
to={`/?term=${term}&deptValue=${deptCode}&courseNumber=${courseNumber}`} | ||
component={Link} | ||
onClick={handleClick} | ||
> | ||
<Search /> | ||
</Button> | ||
</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
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 |
---|---|---|
|
@@ -18,5 +18,3 @@ export const useTabStore = create<TabStore>((set) => { | |
}, | ||
}; | ||
}); | ||
|
||
export default useTabStore; |