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

lib-classifier: Refactor CenteredLayout and survey task spacing #6615

Open
wants to merge 7 commits into
base: lib-classifier_survey-task-design-changes
Choose a base branch
from

Conversation

mcbouslog
Copy link
Contributor

@mcbouslog mcbouslog commented Jan 10, 2025

Package

  • lib-classifier

Linked Issue and/or Talk Post

Describe your changes

  • fix MaxWidth with survey task and NoMaxWidth with survey task stories
  • refactor MockTask component to reflect lib-react-components Tabs styling
  • refactor Choices grid columns to reflect grid gap (if applicable)
  • refactor Chooser spacing
  • refactor CenteredLayout similar to MaxWidth and NoMaxWidth to handle small, medium, and large screen sizes, with different break points for survey task and other tasks

How to Review

Helpful explanations that will make your reviewer happy:

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
  • 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

@mcbouslog mcbouslog marked this pull request as ready for review January 13, 2025 17:02
@mcbouslog mcbouslog changed the title [DRAFT] lib-classifier: Refactor CenteredLayout and general survey task spacing lib-classifier: Refactor CenteredLayout and general survey task spacing Jan 13, 2025
@mcbouslog mcbouslog changed the title lib-classifier: Refactor CenteredLayout and general survey task spacing lib-classifier: Refactor CenteredLayout and survey task spacing Jan 13, 2025
@goplayoutside3 goplayoutside3 self-assigned this Jan 14, 2025
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.

The layouts are looking much better on this branch. One thing I noticed is that when CenteredLayout is used, the subject viewer does not behave in a sticky manner (regardless of the task). This is actually true on production too, so I'm wondering if you'd like to include a fix in this PR.

Here's some examples to work with:
Production example, CenteredLayout, no survey task: Daily Minor Planet
Production example, MaxWidthLayout, survey task: Offal Wildlife Watch
Local example, CenteredLayout, survey task: Woodpecker Cavity Cam
Local example, MaxWidthLayout, survey task: Your test project

Screen recorded example on this branch:

scroll.mov

Comment on lines +21 to +22
if (props.$columnsCount === 3) return (props.$hideThumbnails ? '165.33px' : '166px');
if (props.$columnsCount === 2) return (props.$hideThumbnails ? '248.5px' : '249px');
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm surprised to see fractions of a pixel here 🤔 Is it because you're using the column width to create a border around each Choice button?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The grid gap(s) when there are no thumbnails causes the component to be wider than desired, the slightly smaller column widths here (when hiding thumbnails) keep the columns and component width as desired.

@mcbouslog
Copy link
Contributor Author

Yes nice catch regarding sticky subjects, I think I've fixed it in 947c6bf.

@mcbouslog
Copy link
Contributor Author

Just pushed a commit to extract shared styled containers (Viewer, TaskArea, etc.) to a single file. It's a bit out of scope, but I think helpful, though also understand if want to exclude from these (survey task refactor) changes. Let me know if I should remove/revert it, no prob at all.

position: relative;
grid-gap: 1.875rem;
grid-template-areas: 'viewer task';
grid-template-columns: auto ${props => (props.hasSurveyTask ? '33.75rem' : '25rem')};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the grid-template-columns value and any following line (CenteredLayout -> justify-content: center, MaxWidth -> margin: auto, and NoMaxWidth nothing) are they key differences between layouts? Could add a related/similar comment to each layout accordingly if that would be helpful.

@goplayoutside3
Copy link
Contributor

I started reviewing and agree it's a good idea to separate out the shared styled components for layouts. The Storybook for Layout is looking great.

However, I moved on to running the classifier locally to test some production projects. 🚨 There are two unexpected behaviors to double check:

  1. Woodpecker Cavity Cam's active workflow is using CenteredLayout on production. When I run the classifier locally, CenteredLayout is not applied and I can tell by the difference in the image toolbar UI. Here's the links for testing, and please double check that production projects have the same layout applied on this branch. Daily Minor Planet is another non-survey task example where it should have a CenteredLayout, but does not.
    https://www.zooniverse.org/projects/elwest/woodpecker-cavity-cam/classify/workflow/16998
    https://local.zooniverse.org:8080/?project=12767&env=production&workflow=16998
    https://local.zooniverse.org:3000/projects/elwest/woodpecker-cavity-cam/classify/workflow/16998?env=production
  2. Spyfish Aotearoa has video subjects with survey tasks in its workflows. When I run the project in the classifier locally, the task area does not load with an error mobx-state-tree] Error while converting {"type":"survey","images": [etc]} to one of the available task types. I'm not sure if this error is unique to this branch, but definitely unique to the survey task redesign. Please double check with the links:
    https://www.zooniverse.org/projects/victorav/spyfish-aotearoa/classify/workflow/23920
    https://local.zooniverse.org:8080/?project=14054&workflow=23920&env=production
    https://local.zooniverse.org:3000/projects/victorav/spyfish-aotearoa/classify/workflow/23920?env=production

@mcbouslog
Copy link
Contributor Author

  1. When I locally load https://local.zooniverse.org:3000/projects/elwest/woodpecker-cavity-cam/classify/workflow/16998?env=production or https://local.zooniverse.org:3000/projects/fulsdavid/the-daily-minor-planet/classify/workflow/22354?env=production with a console log in each layout type I note the expected layout ("CenteredLayout") is logged and the classifier layout is as expected?

Woodpecker Cavity Cam:
Woodpecker Cavity Cam

The Daily Minor Planet:
The Daily Minor Planet

  1. I'm seeing the same error on master?

@goplayoutside3
Copy link
Contributor

Could you double check all your latest changes are pushed to this branch? When I check it out and run locally I do not see the same layouts as in your screenshots. If needed, let's deploy this branch to fe-project-branch and Slack huddle to compare.

For Spyfish Aotearoa does your question mark mean you ran master locally and do or do not see a task area loading successfully?

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.

2 participants