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-project: Redesign how your stats are displayed on the classify page #6472

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

goplayoutside3
Copy link
Contributor

@goplayoutside3 goplayoutside3 commented Nov 15, 2024

Draft while I finish up:

  • Writing unit tests
  • Passing a mutate function to the classifier so stats are incremented on each submit
  • Get design resources from Sean

Package

app-project

Linked Issue and/or Talk Post

Closes: #6400
Closes: #5964
Closes: #5134
Closes: #853

Describe your changes

  • This PR is a follow-up to ADR 61: Displaying Stats in UTC Date Ranges #6442 and part of a larger effort to display user stats consistently across the website. See that ADR for more info on why UTC.
  • I deleted all legacy YourStats code from the MobX store in favor of a new component that uses ERAS and SWR. The new component is called YourProjectStats to avoid a messy diff, but I can give it the name YourStats if preferred.
  • I deleted the FinishedForTheDay component at Sean's design request.
  • I created a RequireUser presentational component and deleted the legacy withRequireUser component. The legacy component was only used in the legacy YourStats component, and I prefer to have a simple "you should sign in" UI component to import into areas we want to hide when a user isn't signed in. In the future, I plan to use it in the Your Recent Classifications component, Recents page, etc.

How to Review

  • I recommend reviewing this code as if I'm building something brand new to app-project rather than comparing to the old YourStats code. The large diff is due to intentionally deleting lots of files.
  • Two of the issues linked above are bugs where your personal stats on the classify page won't refresh between FEM projects. That's fixed in this PR because the SWR hook pays attention to project ID (and uses it to cache requests), so any project's classify page you visit should show your stats specific to that project.
  • The stats per project should also match your personal /stats page. For instance, the project number of i-fancy-cats is 335, and the ERAS query for stats on the project's classify page and your personal bar chart at https://www.zooniverse.org/users/goplayoutside3/stats?env=staging&project_id=335 are the same.

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

General UX

Example Staging Project: i-fancy-cats

  • All pages of a FEM project load: Home Page, Classify Page, and About Pages
  • Can submit a classification
    • When you submit a classification, the user stats increment as expected
  • Can sign-in and sign-out
  • The component is accessible

Bug Fix

  • The PR creator has listed user actions to use when testing if bug is fixed
  • The bug is fixed
  • Unit tests are added or updated

Refactoring

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

Post-merge

  • This PR adds translations keys to English dictionary(s). See guidance for pulling new keys to Lokalise here.

@coveralls
Copy link

coveralls commented Nov 15, 2024

Coverage Status

coverage: 77.654% (-0.2%) from 77.873%
when pulling 6db35bd on your-project-stats-refactor
into 958e806 on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment