-
Notifications
You must be signed in to change notification settings - Fork 839
Forms: explore using native dataviews media display #45692
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
base: trunk
Are you sure you want to change the base?
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! Jetpack plugin: The Jetpack plugin has different release cadences depending on the platform:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 2 files.
Full summary · PHP report · JS report Coverage check overridden by
Coverage tests to be added later
|
| } | ||
|
|
||
| // Override DataViews default max-width for media in primary column | ||
| // to better fit smaller avatars (24x24 instead of larger preview images) |
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.
With Fields API it sounds like we can have sizes option? https://github.com/WordPress/gutenberg/tree/trunk/packages/dataviews#render
| width={ 24 } | ||
| height={ 24 } |
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.
max-width is 32px so let's match the image size with that, and the actual image that loads should be 2x (64px) so that it looks good on all screens.
| label: __( 'Avatar', 'jetpack-forms' ), | ||
| render: ( { item } ) => { | ||
| return ( | ||
| <img |
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.
The Gravatar component also returns an img, why not use that here? I don't actually mind if it's backend or frontend driven as long as it's consistent. :-) That said, we now rely on backend for a frontend visual implementation (image size), which isn't a good practice.
The fallback looks different from before (mystery instead of initials) and it's missing when email isn't there — let's show some fallback image then:
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.
The initials were provided by the Gravatar component, unsure if that's a Gravatar feature (return an image with initials) or some sort of fallback provided by the component. Same goes for mystery avatar, I think it must be some fallback we're providing on backend. I'll look into recover that functionality before merging today.
5ff9fed to
be82db3
Compare
be82db3 to
e6e2af3
Compare
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.
Haven't tested after last changes but code looks good.
Proposed changes:
This PR is an exploration to set up DataViews and make use of the mediaField prop to show avatars.
It does carry some minimal style override, which we're trying not to, but it was the only way to have play nice with the list.
Other information:
Jetpack product discussion
p1761739561258309-slack-C052XEUUBL4
Does this pull request change what data or activity we track or use?
No
Testing instructions:
Visit the Forms dashboard. See the new avatars implementation. Use the view cog to hide/show the avatar.