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 #265

Merged
merged 25 commits into from
Dec 4, 2024
Merged

Conversation

ananyaspatil
Copy link
Collaborator

@ananyaspatil ananyaspatil commented Apr 14, 2024

Purpose

Creates an EmptyCard to display for the Empty Notifications page.
When "Search for classes" button is hovered over, crying-husky image changes to happy-husky image.
Includes a placeholder text for "Spring 2023 Notifications", this will need to be changed to actually reflect the semester of notifications being displayed.

Tickets

https://trello.com/c/SoJpDQFG

Contributors

@ananyaspatil @Anzhuo-W

Feature List

Created display for the Empty Notifications page.

  • Created EmptyCard Component: contains display text and a button that redirects to the default search page
  • added crying-husky.svg and happy-husky.svg images
    When "Search for classes" button is hovered over, crying-husky image changes to happy-husky image.
  • Added isHovering const to EmptyCard
  • Added logic to update husky image to happy when OnMouseEnter is true for "search for classes" button
  • Heading text updates to reflect the semester of notifications being displayed (should always be the most recent semester).

Pictures

No Hover:
image

Hover:
image

Reviewers

Primary reviewer:
@pranavphadke1 @sebwittr

Secondary reviewers:
@soulwa

Copy link

vercel bot commented Apr 14, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
searchneu ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 4, 2024 3:40am

onClick={() => {
router.push('NEU');
}}
onMouseEnter={() => setIsHovering(true)}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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.


export const EmptyCard = (): ReactElement => {
const router = useRouter();
const [isHovering, setIsHovering] = useState(false);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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

@@ -131,6 +135,10 @@ export default function SubscriptionsPage(): ReactElement {
await fetchSectionNotifs();
setClasses(classMapping);
setIsFetching(false);
// are there classes the user is subscribed to?
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding condition for when to display the No Notifications page

@ananyaspatil ananyaspatil marked this pull request as ready for review April 14, 2024 06:04
Copy link
Collaborator

@sebwittr sebwittr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, main thing is the changes to ClassCardWrapper. I think we shouldn't need to touch that file at all, since it's only supposed to wrap actual class cards. The EmptyCard should serve as its own component, and not really need to rely on that.

<div className="SearchResult__header--left">{headerLeft}</div>
{headerRight}
</div>
<div>{headerLeft}</div>
Copy link
Collaborator

Choose a reason for hiding this comment

The 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?


return (
<>
<div className="Results_Container">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably don't need all these extra styles, and it would be better to make a separate style sheet for EmptyCards.

padding-bottom: 0px;
}

.SearchResult {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move these out into a separate _EmptyCard.scss so we don't put too much into this file.

@Anzhuo-W
Copy link
Contributor

Trello ticket

Screen Shot 2024-11-17 at 4 51 17 PM

Properly migrate styles to new _EmptyCard file
@cherman23
Copy link
Contributor

Styles have been moved to new EmptyStyles, Empty Card automatically updates to show current semester.

Copy link
Contributor

@mehallhm mehallhm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks pretty good, just some comments on code consistency and readability for the rest of the codebase

@@ -13,18 +13,17 @@ type ClassCardWrapperType = {
afterBody?: ReactElement;
};

const ClassCardWrapper = ({
export const ClassCardWrapper = ({
Copy link
Contributor

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 majority

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in recent commit

package.json Outdated
@@ -43,6 +43,7 @@
"js-yaml-loader": "^1.2.2",
"jsonwebtoken": "^8.5.1",
"jwt-decode": "^3.1.2",
"leading-trim": "^1.0.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to see evidence that adding a package is the correct call here. It's fine if we actually need it, but I would like that proof

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addressed in recent commit

@@ -133,6 +137,10 @@ export default function SubscriptionsPage(): ReactElement {
await fetchSectionNotifs();
setClasses(classMapping);
setIsFetching(false);
// are there classes the user is subscribed to?
if (classMapping.size > 0) {
setIsSubscribed(true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is a state variable being reassigned to another state variable? I would just use classMapping.size > 0 instead of managing a derived piece of state

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will address this in a future ticket

@@ -158,25 +166,33 @@ export default function SubscriptionsPage(): ReactElement {
{isFetching ? (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't love the ternary, especially nested ones. Would an early return be better? This is really not that important but just thinking from a readability standpoint.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will address this in a future ticket

- fix styles in classcard, use function notation

- Redirect Empty card to empty results page.
@ananyaspatil ananyaspatil merged commit 0dad192 into master Dec 4, 2024
5 checks passed
@ananyaspatil ananyaspatil deleted the AP/no-notifications-husky-page branch December 4, 2024 22:48
ananyaspatil added a commit that referenced this pull request Dec 4, 2024
ananyaspatil added a commit that referenced this pull request Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants