Skip to content
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 #303

Merged
merged 26 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0df3953
Add empty subscriptions logic
Anzhuo-W Mar 30, 2024
948c3c9
Create EmptyCard component
Anzhuo-W Mar 30, 2024
67d82ee
Add styling and assets
Anzhuo-W Mar 31, 2024
1ac9258
Update styling of EmptyCard
Anzhuo-W Apr 13, 2024
0f1d91f
Modified styling, added on hover image change functionality
ananyaspatil Apr 14, 2024
1834cae
edited line-heights
ananyaspatil Apr 14, 2024
d869b35
resolve merge conflicts
ananyaspatil Apr 14, 2024
cd6e8c3
resolved sass-lint errors
ananyaspatil Apr 14, 2024
9f91b75
actually resolved sass-lint errors
ananyaspatil Apr 14, 2024
1fca833
really actually resolved sass-lint errors this time
ananyaspatil Apr 14, 2024
bec72d1
Update Empyt Card to include term data.
cherman23 Nov 21, 2024
bec9fbd
Merge remote-tracking branch 'origin/master' into AP/no-notifications…
cherman23 Nov 21, 2024
36c9931
Move styles from _Results to new _EmptyCard to declutter.
cherman23 Nov 21, 2024
f8a61b5
Remove empty card styles from _Results
cherman23 Nov 21, 2024
9d93283
Revert styles, fix empty card props. subscriptions page requires retr…
cherman23 Nov 21, 2024
86f8b55
Empty Card Semester Name updates automatically
cherman23 Nov 21, 2024
be2ac4a
- remove unused leading-trim module
cherman23 Nov 24, 2024
a10405a
remove default from ClassCard export
cherman23 Nov 24, 2024
a2e81f2
Add unsubscribe button functionality
mehallhm Nov 27, 2024
811f9a6
Notif course fetching refactor
mehallhm Nov 27, 2024
68e6802
Remove local config
mehallhm Nov 27, 2024
59c37ef
Remove yarn install state
mehallhm Nov 27, 2024
77461c7
Add pill to subscription class card
cherman23 Dec 4, 2024
7ebacba
Merge branch 'AP/no-notifications-husky-page' of https://github.com/s…
cherman23 Dec 4, 2024
c0de88f
fix lint colors issue
cherman23 Dec 4, 2024
8fabdc6
Add top margin to empy styles
cherman23 Dec 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion components/ResultsPage/DropdownFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ export default function DropdownFilter({
setIsOpen(true);
}
}}

/>
<DropdownArrow
aria-label="Dropdown arrow"
Expand Down
23 changes: 15 additions & 8 deletions components/SubscriptionsPage/ClassCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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>
{headerRight}

{body}
{afterBody}
</div>
Expand All @@ -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);

Expand All @@ -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>}
Expand Down Expand Up @@ -146,4 +153,4 @@ export const ClassCard = ({
}
/>
);
};
}
74 changes: 74 additions & 0 deletions components/SubscriptionsPage/EmptyCard.tsx
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);

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)}
onMouseLeave={() => setIsHovering(false)}
>
<button className="Empty_Main__EmptyCard_Button">
<Circular />
<b>Search for classes</b>
</button>
</div>
}
/>
</div>
</div>
</div>
</div>
</>
);
};
26 changes: 26 additions & 0 deletions components/SubscriptionsPage/SectionPill.tsx
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>
);
};
12 changes: 12 additions & 0 deletions components/icons/circular.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading