Skip to content

Commit

Permalink
fix: misc.
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinWu098 committed Dec 22, 2024
1 parent 12527fe commit 10ddbfc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ class DeptSearchBar extends PureComponent<DeptSearchBarProps, DeptSearchBarState
}

resetField = () => {
const formData = RightPaneStore.getFormData();

this.setState({
value: {
deptValue: RightPaneStore.getFormData().deptValue,
deptLabel: RightPaneStore.getFormData().deptLabel,
deptValue: formData.deptValue,
deptLabel: formData.deptLabel,
isFavorite: false,
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,24 @@ export function CourseInfoSearchButton({ courseDetails, term }: { courseDetails:
setActiveTab(1);
}, []);

const queryParams = {
term: term,
deptValue: deptCode,
courseNumber: courseNumber,
};

const href = `/?${Object.entries(queryParams)
.map(([key, value]) => `${key}=${encodeURIComponent(value)}`)
.join('&')}`;

return (
<div>
<Button
variant="contained"
size="small"
color="primary"
style={{ minWidth: 'fit-content' }}
to={`/?term=${term}&deptValue=${deptCode}&courseNumber=${courseNumber}`}
to={href}
component={Link}
onClick={handleClick}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function SectionTable(props: SectionTableProps) {
analyticsCategory={analyticsCategory}
/>

{activeTab === 2 ? <CourseInfoSearchButton courseDetails={courseDetails} term={term} /> : null}
{activeTab !== 2 ? null : <CourseInfoSearchButton courseDetails={courseDetails} term={term} />}

<CourseInfoButton
analyticsCategory={analyticsCategory}
Expand Down

0 comments on commit 10ddbfc

Please sign in to comment.