-
Notifications
You must be signed in to change notification settings - Fork 29
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
Classifier: Move MetaTools into same grid area as subject viewer #4021
Conversation
This is going to break Maybe small screens need to define a new grid layout, not use |
New layouts can be added to the classifier here: Lines 3 to 5 in d592efd
See also Shaun’s ADR about layouts. |
|
Weird that the layout doesn’t change. The subject area is designed to match the height of the toolbar, so I assumed the SVG subject height would shrink to allow for the height of the toolbar in the subject area. My concern was that this changes the height of the subject for live projects. If that’s not happening, then there’s no problem. |
By the way, if you want to try out design ideas for new layouts, but don’t want to change PH-TESS etc., then adding a new layout to the layouts map would give you a layout that you can experiment with while also controlling which projects and workflows use it. That might be useful for testing big changes, rather than editing the default layout directly. |
<Metadata | ||
isThereMetadata={isThereMetadata} | ||
metadata={subject && subject.metadata} | ||
/> | ||
<FavouritesButton | ||
checked={subject?.favorite} | ||
disabled={!subject || !upp} | ||
onClick={subject?.toggleFavorite} | ||
/> | ||
<CollectionsButton | ||
disabled={!subject || !upp} | ||
onClick={addToCollection} | ||
/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I run locally, signed in, and load https://local.zooniverse.org:3000/projects/brooke/i-fancy-cats/classify/workflow/693 or https://local.zooniverse.org:3000/projects/pmlogan/poets-and-lovers/classify/workflow/21362/subject-set/104809?env=production the Metadata, FavouritesButton, and CollectionsButton are unexpectedly disabled. Console logging the subject from MetaTools returns null
and the component doesn't appear to rerender once the subject (and related isThereMetadata) is defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I think the mobx observer should wrap the MetaTools export.
export default withResponsiveContext(observer(MetaTools))
with related mobx observer import.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right! I think adding observer
restored some of the expected functionality, but I also noticed that you can visit i-fancy-cats on frontend.preview, sign-in to enable FavouritesButton and CollectionsButton, but then upon sign-out the upp
from the store still contains user data, and the buttons are all still enabled. I think this is a bug of the UserProjectPreferences store so I'll do a quick search for an already existing Github Issue or open a new one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Big improvement for small screens. Looked strange to me at first on desktop, but only because I'm used to current grid.
Refactors look good 👍 . Only blocking comment is regarding MetaTools missing observer (I think), otherwise a few other comments for consideration, but not blocking.
...er/components/MetaTools/components/Metadata/components/MetadataButton/MetadataButton.spec.js
Outdated
Show resolved
Hide resolved
packages/lib-classifier/src/components/Classifier/components/MetaTools/MetaTools.stories.js
Outdated
Show resolved
Hide resolved
Unrelated to these changes, but while reviewing I noticed the Hide Previous Marks svg icon is 24px while the other MetaTools icons are 15px. The difference isn't noticeable (to me anyway) on desktop, but when stacked for a small screen the alignment is a little more noticeable. Not sure if want to include a fix for in these changes, we can convert this comment to an issue, or other option. |
I agree the difference is annoying when all meta buttons are stacked on top of each other when its column is of smaller width. I plan to follow-up with Sean to get his approval on this PR as well, and my review with him will include minor adjustments of icon size, margins, etc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM 👍
Met with @seanmiller26 to review MetaTools design. A few notes on what will follow in a separate PR:
|
Package
lib-classifier
Linked Issue and/or Talk Post
Includes #4019
Includes #4005Describe your changes
This PR moves the MetaTools component into the same grid area as the SubjectViewer, which allows its buttons to always display directly below the subject image regardless of viewport aspect ratio. Screenshots below.
This PR also includes refactoring from class to functional components and RTL unit tests for Metadata, MetadataModal, and MetadataButton.
Previously, the MetaTools buttons displayed below the toolbar height:
The changes in this PR display them like this:
How to Review
Run
yarn bootstrap
with this branch and view any project with a subject image. Examples:- i-fancy-cats
- TESS
- Poets & Lovers
I also added a story for the MetaTools container with a specific case for smaller subject viewer styling.
See corresponding ImageToolbar refactoring in #4008.
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
yarn panic && yarn bootstrap
ordocker-compose up --build
and FEM works as expectedGeneral UX
Example Staging Project: i-fancy-cats
Refactoring