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

Gutenboarding: use static, tall screenshots #40632

Merged
merged 11 commits into from
Apr 2, 2020

Conversation

simison
Copy link
Member

@simison simison commented Mar 31, 2020

Resolves #40564

Changes proposed in this Pull Request

  • Add static screenshots for designs
  • Add a script that generated those previews
  • Use those screenshots in img tags — leaves mShots mechanism in place so we can easily work on it
  • Make screenshots little taller (needs more work)

Testing instructions

Design

image

CLI
  • To ensure you'll have browser downloaded, remove PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true from package.json
  • At Calypso root, install deps: npm i capture-website sharp.
  • Remove old screenshots at static/page-templates/design-screenshots
  • Run node bin/generate-gutenboarding-design-thumbnails.js to generate new ones
  • Observe new files at static/page-templates/design-screenshots

@simison simison added [Status] In Progress [Goal] New Onboarding previously called Gutenboarding labels Mar 31, 2020
@matticbot
Copy link
Contributor

@matticbot
Copy link
Contributor

matticbot commented Mar 31, 2020

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~54 bytes added 📈 [gzipped])

name                 parsed_size           gzip_size
entry-gutenboarding       +165 B  (+0.0%)      +54 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

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.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

height: 2200,
deviceScaleFactor: 1,
} );
await page.goto( url, { waitUntil: 'networkidle0' } );
Copy link
Member Author

Choose a reason for hiding this comment

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

Possible options for waitUntil would be

  • load - consider navigation to be finished when the load event is fired.
  • domcontentloaded - consider navigation to be finished when the DOMContentLoaded event is fired.
  • networkidle0 - consider navigation to be finished when there are no more than 0 network connections for at least 500 ms.
  • networkidle2 - consider navigation to be finished when there are no more than 2 network connections for at least 500 ms.

via https://github.com/puppeteer/puppeteer/blob/3dff24ad35cd46754dbe0c77a9c7f7ade2454b88/docs/api.md#pagewaitfornavigationoptions

@simison simison changed the title Update/gutenboarding static screenshots Gutenboarding use static, tall screenshots Apr 1, 2020
@simison simison changed the title Gutenboarding use static, tall screenshots Gutenboarding: use static, tall screenshots Apr 1, 2020
@dubielzyk
Copy link
Contributor

Mobile layout looks funky. Let's make sure we look at the design file and replicate the mobile designs:
image

Other than that it looks good 👍

@simison
Copy link
Member Author

simison commented Apr 1, 2020

We're kinda ignoring the mobile versions for this week and starting their implementation on next week. Ok of course to fix in the PR but ok to punt for now for later PRs.

@simison simison force-pushed the update/gutenboarding-static-screenshots branch from eb23ddc to 546bdd3 Compare April 2, 2020 09:25
@simison simison added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] In Progress labels Apr 2, 2020
@simison simison requested review from a team April 2, 2020 09:27
@simison simison marked this pull request as ready for review April 2, 2020 09:27
@simison simison requested a review from a team as a code owner April 2, 2020 09:27
@simison
Copy link
Member Author

simison commented Apr 2, 2020

@dubielzyk Screenshots are sometimes shorter than the thumbnail area:

image

Luckily they're all the ones with a white background so it's not that bad looking, but do you have thoughts on how to address that? Should columns float as "masonry" (i.e. upper edges won't be aligned and it's ok to have different height thumbnails)?

It should be addressed in separate PR anyway, I think.

@dubielzyk
Copy link
Contributor

Screenshots are sometimes shorter than the thumbnail area

I'll have a look, but I think it's a tradeoff worth taking since users wanted to see more of their page

@simison
Copy link
Member Author

simison commented Apr 2, 2020

@dubielzyk Feels like that 4 columns takes affect little too early (somewhere at ~1400px), making thumbnails too small:

image

We can get these right in separate PR.

@razvanpapadopol razvanpapadopol added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Apr 2, 2020
// https://github.com/Automattic/mShots/issues/16
// https://github.com/Automattic/wp-calypso/issues/40564
if ( ! isEnabled( 'gutenboarding/mshot-preview' ) ) {
return `/calypso/page-templates/design-screenshots/${ design.slug }_${ design.template }_${ design.theme }.jpg`;
Copy link
Member

Choose a reason for hiding this comment

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

I don't like that we're referencing static images directly rather than using webpack file-loader to import the images and get a generated path. That help with things like cache busting when image contents change.

Are these intended for use outside of Calypso?

This is fine to handle as a follow-up.

Copy link
Member

Choose a reason for hiding this comment

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

Created #40708 to track.

Copy link

@razvanpapadopol razvanpapadopol left a comment

Choose a reason for hiding this comment

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

Looking great on all resolutions! Added #40711 and #40712 as follow-ups so we can 🚀 this.

@razvanpapadopol razvanpapadopol merged commit 39474e3 into master Apr 2, 2020
@razvanpapadopol razvanpapadopol deleted the update/gutenboarding-static-screenshots branch April 2, 2020 15:54
ramonjd pushed a commit that referenced this pull request Apr 7, 2020
Wrapping the mshot preload in a feature flag

As noted in #40632, we must temporarily show pre-generated screenshots until we can generate tall versions dynamically using mshots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Goal] New Onboarding previously called Gutenboarding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gutenboarding: make design picker thumbnails taller
6 participants