-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ap/no notifications husky page #265
Changes from all commits
0df3953
948c3c9
67d82ee
1ac9258
0f1d91f
1834cae
d869b35
cd6e8c3
9f91b75
1fca833
bec72d1
bec9fbd
36c9931
f8a61b5
9d93283
86f8b55
be2ac4a
a10405a
a2e81f2
811f9a6
68e6802
59c37ef
77461c7
7ebacba
c0de88f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ import { DesktopSectionPanel } from '../ResultsPage/Results/SectionPanel'; | |
import { getFormattedSections } from '../ResultsPage/ResultsLoader'; | ||
import DropdownArrow from '../icons/DropdownArrow.svg'; | ||
import CourseCheckBox from '../panels/CourseCheckBox'; | ||
import { SectionPill } from './SectionPill'; | ||
|
||
type ClassCardWrapperType = { | ||
headerLeft: ReactElement; | ||
|
@@ -13,18 +14,17 @@ type ClassCardWrapperType = { | |
afterBody?: ReactElement; | ||
}; | ||
|
||
const ClassCardWrapper = ({ | ||
export const ClassCardWrapper = ({ | ||
headerLeft, | ||
headerRight, | ||
body, | ||
afterBody, | ||
}: ClassCardWrapperType): ReactElement => { | ||
return ( | ||
<div className="SearchResult"> | ||
<div className="SearchResult__header"> | ||
<div className="SearchResult__header--left">{headerLeft}</div> | ||
{headerRight} | ||
</div> | ||
<div>{headerLeft}</div> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we needed the styles from SearchResult__header and SearchResult__header--left for the class cards. Did your changes actually need to change this file? |
||
{headerRight} | ||
|
||
{body} | ||
{afterBody} | ||
</div> | ||
|
@@ -39,13 +39,13 @@ type ClassCardType = { | |
onSignIn: (token: string) => void; | ||
}; | ||
|
||
export const ClassCard = ({ | ||
export function ClassCard({ | ||
course, | ||
sections, | ||
userInfo, | ||
fetchUserInfo, | ||
onSignIn, | ||
}: ClassCardType): ReactElement => { | ||
}: ClassCardType): ReactElement { | ||
const sectionsFormatted: Section[] = getFormattedSections(sections); | ||
const [areSectionsHidden, setAreSectionsHidden] = useState(true); | ||
|
||
|
@@ -66,6 +66,13 @@ export const ClassCard = ({ | |
lastUpdateTime={course.lastUpdateTime} | ||
className="SearchResult__header--sub" | ||
/> | ||
{course.sections.map((section) => ( | ||
<SectionPill | ||
key={section.crn} | ||
userInfo={userInfo} | ||
crn={section.crn} | ||
></SectionPill> | ||
))} | ||
</> | ||
} | ||
headerRight={<button>Unsubscribe</button>} | ||
|
@@ -146,4 +153,4 @@ export const ClassCard = ({ | |
} | ||
/> | ||
); | ||
}; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { ReactElement } from 'react'; | ||
import React, { useState } from 'react'; | ||
import { ClassCardWrapper } from './ClassCard'; | ||
import { useRouter } from 'next/router'; | ||
import Circular from '../icons/circular.svg'; | ||
import CryingHusky from '../icons/crying-husky.svg'; | ||
import HappyHusky from '../icons/happy-husky.svg'; | ||
import getTermInfosWithError from '../../utils/TermInfoProvider'; | ||
import { getTermName } from '../terms'; | ||
|
||
export const EmptyCard = (): ReactElement => { | ||
const router = useRouter(); | ||
const [isHovering, setIsHovering] = useState(false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added const isHovering so that Husky image can be changed when mouse hovers over the "search for classes" button |
||
|
||
const termInfos = getTermInfosWithError().termInfos; | ||
const termId = router.query.termId as string; | ||
const termName = getTermName(termInfos, termId).replace('Semester', ''); | ||
|
||
return ( | ||
<> | ||
<div className="Empty_Container"> | ||
<div className="Empty_MainWrapper"> | ||
<div className="Empty_Main"> | ||
<div className="Empty_Main__EmptyCard"> | ||
<div className="Empty_Main_EmptyCard_Header"> | ||
<div className="Empty_Main__EmptyCard_Header_Spacer"> | ||
<div className="Empty_Main__EmptyCard_Header_Title"> | ||
<b>{termName} Notifications</b> | ||
</div> | ||
</div> | ||
{isHovering ? ( | ||
<div className="Happy_Husky_SVG"> | ||
<HappyHusky /> | ||
</div> | ||
) : ( | ||
<div className="Crying_Husky_SVG"> | ||
<CryingHusky /> | ||
</div> | ||
)} | ||
</div> | ||
<ClassCardWrapper | ||
headerLeft={ | ||
<div className="Empty_Main__EmptyCard_Text"> | ||
<div className="Empty_Main__EmptyCard_Text_Title"> | ||
<b>You currently have no notifications. Hoosky sad :(</b> | ||
</div> | ||
<div className="Empty_Main__EmptyCard_Text_Body"> | ||
Be the first to know when new classes and sections drop! | ||
</div> | ||
</div> | ||
} | ||
headerRight={ | ||
<div | ||
className="Empty_Main__EmptyCard_Divider" | ||
onClick={() => { | ||
router.push(`/NEU/${termId}/search`); | ||
}} | ||
onMouseEnter={() => setIsHovering(true)} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To change image upon hovering, am setting isHovering constant to true when mouse enters the Button and to false when mouse leaves the button. |
||
onMouseLeave={() => setIsHovering(false)} | ||
> | ||
<button className="Empty_Main__EmptyCard_Button"> | ||
<Circular /> | ||
<b>Search for classes</b> | ||
</button> | ||
</div> | ||
} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ReactElement } from 'react'; | ||
import Keys from '../Keys'; | ||
import { UserInfo } from '../types'; | ||
|
||
type SectionPillProps = { | ||
crn: string; | ||
userInfo: UserInfo; | ||
}; | ||
|
||
export const SectionPill = ({ | ||
crn, | ||
userInfo, | ||
}: SectionPillProps): ReactElement => { | ||
return ( | ||
<div className="SectionPill"> | ||
<div | ||
className={`SectionPill__subscribed ${ | ||
userInfo && userInfo.courseIds.includes(Keys.getClassHash(crn)) | ||
? 'SectionPill__subscribed--active' | ||
: '' | ||
}`} | ||
></div> | ||
<div className="SectionPill__text">{crn}</div> | ||
</div> | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's match the rest of the codebase here and use
function
definitions rather than arrow notations. It seems to be like a 70 / 30 split on what we do, but we should pick one to stick with, and I'll just go with the majorityThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in recent commit