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

app-root, lib-user: Add ProfileHeader to UserStats, refactor related API requests #5898

Merged
merged 14 commits into from
Feb 21, 2024

Conversation

mcbouslog
Copy link
Contributor

@mcbouslog mcbouslog commented Feb 8, 2024

Package

  • app-root
  • lib-user

Describe your changes

  • refactor app-root users/[login]/stats to pass login and authClient to UserStats
  • refactor UserStats component with ProfileHeader component
  • refactor usePanoptesUser hook to get user from panoptes-client/lib/auth as that user includes avatar_src which is needed for ProfileHeader component (in contrast to panoptes-js JWT related user which doesn't include avatar_src at the moment, but might per Add avatar_src to the Panoptes JWT panoptes#4217)
  • refactor useUserStats

How to Review

Helpful explanations that will make your reviewer happy:

  • What Zooniverse project should my reviewer use to review UX?
  • What user actions should my reviewer step through to review this PR?
    • see ProfileHeader working with your staging user locally in:
      • app-root: https://local.zooniverse.org:3000/users/[insert your staging user login here]/stats
      • lib-user: https://local.zooniverse.org:8080/?users=[insert your staging user login here]/stats
  • Which storybook stories should be reviewed? n/a
  • Are there plans for follow up PR’s to further fix this bug or develop this feature? yes, see linked GitHub Project

Checklist

PR Creator - Please cater the checklist to fit the review needed for your code changes.
PR Reviewer - Use the checklist during your review. Each point should be checkmarked or discussed before PR approval.

General

  • Tests are passing locally and on Github
  • Documentation is up to date and changelog has been updated if appropriate
  • You can yarn panic && yarn bootstrap or docker-compose up --build and FEM works as expected
  • FEM works in all major desktop browsers: Firefox, Chrome, Edge, Safari (Use Browserstack account as needed)
  • FEM works in a mobile browser

New Feature

  • The PR creator has listed user actions to use when testing the new feature
  • Unit tests are included for the new feature

Refactoring

  • The PR creator has described the reason for refactoring
  • The refactored component(s) continue to work as expected

@coveralls
Copy link

coveralls commented Feb 13, 2024

Coverage Status

coverage: 80.92% (-0.3%) from 81.183%
when pulling 99a8468 on app-root-user-stats-profile
into 2acf138 on master.

@mcbouslog mcbouslog changed the title [DRAFT] app-root, lib-user: Add ProfileHeader to UserStats, refactor related API requests app-root, lib-user: Add ProfileHeader to UserStats, refactor related API requests Feb 13, 2024
@mcbouslog mcbouslog marked this pull request as ready for review February 13, 2024 21:34
@mcbouslog mcbouslog requested a review from a team February 13, 2024 21:34
@mcbouslog mcbouslog mentioned this pull request Feb 20, 2024
12 tasks
@goplayoutside3 goplayoutside3 self-assigned this Feb 20, 2024
Copy link
Contributor

@goplayoutside3 goplayoutside3 left a comment

Choose a reason for hiding this comment

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

This is looking good! I'm able to run app-root locally and view my staging stats at: https://local.zooniverse.org:3000/users/goplayoutside3/stats while signed-in 👍 When I sign-out, the stats aren't shown.

Comment on lines +20 to +22
if (isNaN(value)) {
displayValue = 0
}
Copy link
Contributor

Choose a reason for hiding this comment

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

In what scenario could this be NaN? I ask because the value prop passed to TitledStat is a required number, so without an inline code comment here I'm confused why these additional lines are needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, great question, the reason these lines I think are necessary surprised me. typeof NaN is actually 'number' (which made me lol, I had forgotten that JavaScript quirk). NaN can result from invalid arithmetic operations (as well as other reasons), and I think while loading stats or if there are no hours then the result of the equation that converts the seconds can result in NaN.

packages/app-root/src/app/users/[login]/stats/page.js Outdated Show resolved Hide resolved
@mcbouslog mcbouslog merged commit eb3aef8 into master Feb 21, 2024
7 checks passed
@mcbouslog mcbouslog deleted the app-root-user-stats-profile branch February 21, 2024 22:45
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.

3 participants