-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Design picker: Display a screenshot instead of mshots when externally managed #80573
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~427 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~97 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
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.
667d818
to
fccc200
Compare
@gcsecsey can you give a new round of review with the updated test instructions? |
This PR is not blocked anymore because it was decoupled from #80446 and can be shipped separately as soon as its reviewed. |
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.
@@ -36,6 +37,20 @@ const DesignPreviewImage: React.FC< DesignPreviewImageProps > = ( { | |||
} ) => { | |||
const isMobile = useViewportMatch( 'small', '<' ); | |||
|
|||
if ( design.is_externally_managed && design.screenshot ) { | |||
const fit = '479,360'; |
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.
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.
Good point, I brought it from here where we also display the screenshot: https://github.com/Automattic/wp-calypso/blob/trunk/client/components/theme/index.jsx#L176
I didn't invest much in figuring out a way to share this value because it comes from client/components
, and this is a separate package so it must have all the info by itself or be passed by param. In this case, I decided just to replicate the code.
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.
Thanks for the context. It's good to know that the thumbnails are also a fixed aspect ratio. I wondered what was the original motivation behind moving the design picker to a separate package as it seems to cause some friction when we make updates. I've only found this point about the i18n wrapper: #51226 (comment)
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.
I wondered what was the original motivation behind moving the design picker to a separate package
I already asked me the same thing, but I didn't find an answer yet.
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.
Remove the following code from the line 320: tier: '-marketplace',
I think it's safe to include that as part of this PR. That part of the logic does not control the themes that are visible in the grid, but the information that it's needed to correctly render the badges and tooltips.
That way, I think we can merge PRs/diffs in this order:
- Design picker: Display a screenshot instead of mshots when externally managed #80573 (this PR, plus the removal of
tier: '-marketplace'
).
1.1. Nothing will happen: Partner themes won't be visible since thestarter-designs
endpoint doesn't return then yet
1.2. Because of the above, we can abandon Design Picker: Query all themes (including Marketplace themes) #80446 - Design Picker: Allow Marketplace plugins to be displayed as selected Theme #80837
- More additional PRs
- D118900-code
4.1. This is where Partner themes will become visible.
@mmtr Thanks for the suggestion, and it's a possibility I considered but decided against it, in the end, it would be nice to have other input. Pro
Con
I'm good with both options, but I would like to put here my line of thought. |
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.
This will query unnecessary data (Marketplace themes) for now, even if we are not displaying it.
That's fair! Note that we can also add a new feature flag. That way we don't fetch partner themes data in production by default, but can be enabled in development, so we don't need to remove that line.
Aha! Good point, I'll add it. |
fccc200
to
780914d
Compare
The feature flag logic for querying themes is added to this PR after the merge of #80446 and the rebase of this PR. |
Resolves https://github.com/Automattic/dotcom-forge/issues/3447
Related to D118900-code
Proposed Changes
Testing Instructions
/setup/update-design/designSetup?siteSlug=:site
Pre-merge Checklist