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

Users by badge #5261

Merged
merged 20 commits into from
Feb 1, 2025
Merged

Conversation

aapeliv
Copy link
Member

@aapeliv aapeliv commented Nov 27, 2024

This builds on top of #5259, which itself builds on #5253 and #5254!

Taking over from #5250. Continues the frontend part of #4389.

TODO:

  • making the badges pretty on the user page

Web frontend checklist

  • Formatted my code with yarn format
  • There are no warnings from yarn lint --fix
  • There are no console warnings when running the app
  • Added any new components to storybook
  • Added tests where relevant
  • All tests pass
  • Clicked around my changes running locally and it works
  • Checked Desktop, Mobile and Tablet screen sizes

Mobile Design
The badges will be aligned and wrapped around. Also made the text white for easier reading against harsh BG colors. Filtering badges only work one at a time as of now. Pls refer to the desktop version for the mini bio of each badge!
Badges _ Mobile View 2

Copy link

vercel bot commented Nov 27, 2024

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

Name Status Preview Updated (UTC)
couchers ✅ Ready (Inspect) Visit Preview Feb 1, 2025 2:40pm

@aapeliv aapeliv mentioned this pull request Nov 27, 2024
8 tasks
@aapeliv aapeliv added the release notes: pending Add to stuff that should be included in release notes label Nov 27, 2024
@aapeliv aapeliv force-pushed the frontend/feature/users-by-badge-on-user-lists branch from 7af1c40 to b3f2f6e Compare November 27, 2024 15:23
@aapeliv aapeliv force-pushed the frontend/refactor/user-lists branch 2 times, most recently from a2a7260 to 18405b7 Compare November 27, 2024 17:04
@aapeliv aapeliv force-pushed the frontend/feature/users-by-badge-on-user-lists branch from b3f2f6e to c6e18b3 Compare November 27, 2024 17:04
@nabramow
Copy link
Member

nabramow commented Dec 8, 2024

@aapeliv Is this ready for review? I can't tell! Feel free to move the status to "PR" if so!

@aapeliv aapeliv changed the title Users by badge [Blocked] Users by badge Dec 9, 2024
@aapeliv
Copy link
Member Author

aapeliv commented Dec 9, 2024

@nabramow: it's blocked by #5259 which this builds on! I've marked this as blocked for now.

@aapeliv aapeliv force-pushed the frontend/refactor/user-lists branch from 18405b7 to 8affa65 Compare December 10, 2024 21:02
Base automatically changed from frontend/refactor/user-lists to develop December 15, 2024 13:10
@aapeliv aapeliv changed the title [Blocked] Users by badge Users by badge Dec 15, 2024
@aapeliv aapeliv force-pushed the frontend/feature/users-by-badge-on-user-lists branch from c6e18b3 to f8cdbbc Compare December 16, 2024 00:02
@aapeliv aapeliv requested a review from nabramow December 16, 2024 03:59
@aapeliv
Copy link
Member Author

aapeliv commented Dec 16, 2024

This is ready for review now!

@nabramow
Copy link
Member

Okay finally tested the branch and on Desktop it looks great! But on mobile it looks like this:

Screenshot 2024-12-19 at 9 12 56 PM

I'd suggest making a mobile view that has all the badges up top in a flexbox with wrap, then the userslists rendering below that. Or if you're feeling fancy, put the badges in a select on mobile (tbh wouldn't be bad on desktop either) as there will be quite a few badges.

@nabramow
Copy link
Member

FYI @aapeliv Shirley just added the mobile designs to the description!

consolidated hooks for the badges feature
I thought having a clickable chip with a tooltip is a common scenario we
might want to make use of later, so I extracted this functionality
originally built out in the features/profile/view/Badges file into a
ToolChipLink component.

The Badge component is then just a wrapper around that where you pass in
a Badge resource. This uses a URL scheme for badges at /badges/{id}
@aapeliv aapeliv force-pushed the frontend/feature/users-by-badge-on-user-lists branch from 1ac2ff2 to 4e89377 Compare January 20, 2025 23:29
@aapeliv aapeliv requested a review from nabramow January 26, 2025 13:59
@aapeliv
Copy link
Member Author

aapeliv commented Jan 26, 2025

@nabramow: This is now ready for re-review! I addressed your comment and implemented a mobile view

badgeId?: string;
}

export default function BadgesPage({ badgeId = undefined }: BadgesPageProps) {
Copy link
Member

Choose a reason for hiding this comment

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

Might make sense to make BadgesPage a separate file? Easier to scroll through I think.

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean, sorry?

Copy link
Member

Choose a reason for hiding this comment

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

Ah instead of having two components in one file, break it into a separate file.

Comment on lines 119 to 141
{isBadgesLoading ? (
<CenteredSpinner />
) : badges && badgeId in badges ? (
<>
<FlexDiv>
<Badge badge={badges[badgeId]} />
<Typography variant="body1">
{badges[badgeId].description}
</Typography>
</FlexDiv>
<BadgeUserList badgeId={badgeId} />
</>
) : (
<>Badge not found</>
)}
</ContentDiv>
) : (
<CenteredDiv>
<Typography variant="subtitle1">
{t("profile:badges.click_on_left")}
</Typography>
</CenteredDiv>
)}
Copy link
Member

Choose a reason for hiding this comment

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

There are a lot of ternary operators in here. Is there a way to break up this logic to make it more readable?

Copy link
Member Author

Choose a reason for hiding this comment

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

I tried to think about it a bit; to my eye this hits a good balance with not being too conditional but also being readable and concise. I'm not sure how to break it apart in a way that doesn't just separate the logic too much.

Open to suggestions though!

Copy link
Member

Choose a reason for hiding this comment

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

Okay I see what you mean, I think it's okay for now as probably this logic won't get more complicated or expanded on much.

@nabramow
Copy link
Member

nabramow commented Jan 26, 2025

Okay functionality-wise looks good and works well on both mobile and desktop! Just some small comments, and noticed one mobile design thing:

Screenshot 2025-01-26 at 11 09 33 AM

Maybe we need to add some more margin for long usernames? Or overflow:hidden on the top parent component with a defined width?

@aapeliv
Copy link
Member Author

aapeliv commented Feb 1, 2025

@nabramow this is now ready for review again! I think it should be done, fingers crossed :)

Copy link
Member

@nabramow nabramow left a comment

Choose a reason for hiding this comment

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

Looks good and works well for me now on desktop and mobile!

@aapeliv aapeliv merged commit 50c9338 into develop Feb 1, 2025
2 checks passed
@aapeliv aapeliv deleted the frontend/feature/users-by-badge-on-user-lists branch February 1, 2025 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.topic frontend release notes: pending Add to stuff that should be included in release notes
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants