Skip to content

Lazy Images: Add react admin UI#8463

Merged
dereksmart merged 7 commits intomasterfrom
update/lazy-images-add-ui
Jan 17, 2018
Merged

Lazy Images: Add react admin UI#8463
dereksmart merged 7 commits intomasterfrom
update/lazy-images-add-ui

Conversation

@ebinnion
Copy link
Copy Markdown
Contributor

@ebinnion ebinnion commented Jan 4, 2018

Closes #8193

When we launched lazy images in 5.7, we did not ship any react admin UI. This was partly because we wanted to do a soft launch and also because we would be releasing a new feature just before the holidays.

Now that we're past the holidays and have had some time to test the feature, let's get it out there!

Following the advice of @rickybanister, @michelleweber, and others in #8193, this PR creates a new section within the "Writing" tab called "Speed up your site". This PR, then moves the photon setting into this section and adds the lazy images setting as well. Further, this PR updates the descriptions for the Photon module to match what was suggested in #8193.

To test:

  • Checkout branch
  • Do a fresh yarn build to rebuild module translations
  • Go to "Writing" tab of Jetpack settings
  • Toggle both Photon and Lazy Images settings
  • Ensure that modules are properly enabled/disabled when they are toggled via UI

Screenshot:

screen shot 2018-01-04 at 4 01 21 pm

@ebinnion ebinnion added this to the 5.8 milestone Jan 4, 2018
@ebinnion ebinnion requested a review from a team as a code owner January 4, 2018 21:08
@ebinnion ebinnion force-pushed the update/lazy-images-add-ui branch from e8e7af8 to dd2decb Compare January 4, 2018 22:00
@ebinnion ebinnion added [Status] Needs Design Review Design has been added. Needs a review! and removed [Status] In Progress labels Jan 4, 2018
@ebinnion
Copy link
Copy Markdown
Contributor Author

ebinnion commented Jan 4, 2018

Also, of note @rickybanister, I don't believe there is a "Tiled Galleries" setting anymore. Looking at the code, we simply turned on tiled galleries when photon was toggled on, and turned off tiled galleries when photon was turned off.

Check this line, where we're setting them both to the same thing.

In the issue referenced above, you mentioned this:

Note: I've removed the reference to This must be enable to use Jetpack's tiled gallery options. because we should mention that loading images via CDN is required from the tiled gallery setting instead.

So, we may need to add some wording so that users understand turning on Photon also turns on tiled galleries, or we need to add a separate tiled galleries toggle.

@rickybanister
Copy link
Copy Markdown

The work in this PR looks great, ship it.

Regarding tiled galleries, let's have @MichaelArestad chime in there. I really do want settings to not only control Jetpack, but help advertise it's features. Perhaps we can introduce something like this for tiled galleries (if the toggle is turned on for photon).

Something like this could work (borrowing from stats and other features that display a green checkbox when enabled):

image

"Your images are automatically optimized for different display resolutions to serve the best
possible image quality. We also cache and serve them from our fast, global network (CDN)."
'Jetpack will optimize your images and serve them from the server location nearest
to your visitors. Using our global \'content delivery network\' will boost the loading speed of your site.'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think we need the single quotes around content delivery network since we're not talking about that word, or being sarcastic about it, or making a reference of it inside a bigger context.
If the intention here is to highlight it, quotes are not highlight devices and italic or bold should be used instead.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree. Maybe instead we could just say "Using our global network..."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm impartial. I was copying how @rickybanister had laid out his copy in the referenced issue. Glad to change if we come to a consensus on what to change it to.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agreed with @eliorivero on removing the quotes.

@MichaelArestad
Copy link
Copy Markdown
Contributor

I think this looks good! Can we also add this to Calypso exactly the same way? I would change the last line of the explanation text to:

"Lazy loading" means the images visible on the page first will load before the rest.

This way folks don't make a presumption that only the visible images will load (and no others).

@rickybanister I think we could do something similar for Tiled galleries. Maybe the circle checkmark instead of the big one, but same idea. If Photon is disabled, it could have a simple button to enable photon or at least scroll the user down to the Photon setting (but of course don't say "Photon").

esc_html_e(
'Normally, opening a web page causes it to load every image it contains, even those
that a reader hasn\'t yet scrolled down to see. "Lazy loading" means that only the images
actually visible on the screen will load.'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe we don't need to explain lazy loading and instead what this toggle do?
I'd change
"Lazy loading" means that only the images actually visible on the screen will load.
to
Enable this to load the images visible to users as they scroll down

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would preserve the way @MichaelArestad has written it ("Lazy loading" means...) since it's a term not many Jetpack users will be familiar with.

Or we could opt for best of both worlds:

Enable this for "lazy loading" behavior, where only the images actually visible on the screen will load.

import { ModuleToggle } from 'components/module-toggle';

const SpeedUpSite = moduleSettingsForm(
React.createClass( {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We used React.createClass in the initial UI, but we should use ES6 classes for new components. For example

export const SSO = moduleSettingsForm(
	class extends Component {

in jetpack/_inc/client/security/sso.jsx

}

const photon = this.props.module( 'photon' ),
lazyImages = this.props.module( 'lazy-images' );
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We should follow Calypso's guidelines of placing each const definition in a new line:

const photon = this.props.module( 'photon' );
const lazyImages = this.props.module( 'lazy-images' );

@ebinnion
Copy link
Copy Markdown
Contributor Author

ebinnion commented Jan 4, 2018

Can we also add this to Calypso exactly the same way? I would change the last line of the explanation text to:

To clarify on how we add this to Calypso:

  • For WordPress.com sites, we would add the "Speed up your site" section with only the lazy images toggle
  • For Jetpack sites, we would copy the layout and copy over exactly

cc @MichaelArestad

@ebinnion
Copy link
Copy Markdown
Contributor Author

ebinnion commented Jan 4, 2018

I just pushed up a commit to address @eliorivero's feedback about using an es6 class and putting constants on their own line.

@MichaelArestad
Copy link
Copy Markdown
Contributor

For WordPress.com sites, we would add the "Speed up your site" section with only the lazy images
For Jetpack sites, we would copy the layout and copy over exactly

@ebinnion exactly. I think we could try making them almost identical later on with the checkmark idea @rickybanister mocked up for the settings that are just always on.

/**
* Module Name: Lazy Images
* Module Description: Improve performance by loading images just before they scroll into view
* Module Description: "Lazy load" images
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IMHO the previous description was much more descriptive for non tech savvy users.

@oskosk
Copy link
Copy Markdown
Contributor

oskosk commented Jan 5, 2018

I've just added a commit (a23b94b) factoring out decodeEntities into lib/decode-entities thinking of the children and the future...

@rickybanister
Copy link
Copy Markdown

rickybanister commented Jan 5, 2018

Final_final_v4_last_copy

"Lazy-load" images
Improve your site's speed by only loading images visible on the screen. New images will load just before they scroll into view. This prevents viewers from having to download all the images on a page all at once, even ones they can't see.

@rickybanister
Copy link
Copy Markdown

Updated to add 'all at once' to the copy above

@ebinnion ebinnion self-assigned this Jan 9, 2018
@ebinnion
Copy link
Copy Markdown
Contributor Author

ebinnion commented Jan 9, 2018

I've just pushed up another commit which should address everyone's suggestions about the copy. Here's the latest screenshot.

screen shot 2018-01-08 at 8 13 30 pm

@ebinnion ebinnion added the [Status] Needs Review This PR is ready for review. label Jan 9, 2018
@rickybanister
Copy link
Copy Markdown

Beautiful @ebinnion. Thanks for accommodating all our copywriting!

Copy link
Copy Markdown
Contributor

@oskosk oskosk left a comment

Choose a reason for hiding this comment

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

LGTM!

@oskosk oskosk added [Status] Ready to Merge Go ahead, you can push that green button! [Status] Design Review Complete and removed [Status] Needs Review This PR is ready for review. [Status] Needs Design Review Design has been added. Needs a review! labels Jan 9, 2018
oskosk
oskosk previously requested changes Jan 10, 2018
Copy link
Copy Markdown
Contributor

@oskosk oskosk left a comment

Choose a reason for hiding this comment

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

@ebinnion , Derek noticed that you can't get a search result in the settings tab when typing "lazy". You do get results when writing "speed...". Do you think it should be on the results for that keyword ?

Copy link
Copy Markdown
Contributor

@dereksmart dereksmart left a comment

Choose a reason for hiding this comment

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

Looks great, one request: Let's add it to found modules so it is discoverable in search?

https://github.com/Automattic/jetpack/pull/8463/files#diff-2733a8e3221abee64d737c90e800d1a5R42

@oskosk oskosk dismissed their stale review January 10, 2018 16:19

because yes

@ebinnion ebinnion force-pushed the update/lazy-images-add-ui branch from a38f4c2 to 717d6e4 Compare January 15, 2018 20:36
@ebinnion
Copy link
Copy Markdown
Contributor Author

I've rebased against master and pushed up a change so that lazy images shows up in module search.

Copy link
Copy Markdown
Contributor

@dereksmart dereksmart left a comment

Choose a reason for hiding this comment

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

LGTM!

@dereksmart dereksmart merged commit 4862b3c into master Jan 17, 2018
@dereksmart dereksmart removed the [Status] Ready to Merge Go ahead, you can push that green button! label Jan 17, 2018
@dereksmart dereksmart deleted the update/lazy-images-add-ui branch January 17, 2018 15:21
jeherve added a commit that referenced this pull request Jan 25, 2018
zinigor pushed a commit that referenced this pull request Jan 30, 2018
* Changelog 5.8: create base for changelog.

* Update 5.8 release post link

* fix 5.8 release date

* Updates to plugin description

* Changelog: add #8499

* Changelog: add #8506

* Changelog: add #8509

* Changelog: add #8516

* Changelog: add #8517

* Changelog: add #8523

* Changelog: add #8547

* Changelog: add #8496

* Changelog: add #8584

* Changelog: add #8595

* Changelog: add #8445

* Changelog: add #8431

* Changelog: add #8284

* Changelog: add #8270

* Changelog: add #8124

* Changelog: add #8581

* Changelog: add #8463

* Changelog: add #8568 (#8646)

* Updates to testing list and changelog

* Changelog: add #8443

* Changelog: add #8459

* Changelog: add #8469

* Changelog: add #8464

* Changelog: add #8478 and #8479

* Changelog: add #8483

* Changelog: add #8488

* Changelog: add #8513

* Changelog: add #8555

* Changelog: add #8565

* Changelog: add #8601

* Changelog: add #8612

* Changelog: add first pass at Search items.

* Changelog: add more info to help test Search.

* Changelog: add #8144

* Changelog: add #8313

* Changelog: add #8419

* Changelog: add #8465

* Changelog: add #8515

* Changelog: add #8587

* Changelog: add #8591

* Changelog: add #8659

* Changelog: add #8661

* Changelog: add #8671

* Changelog: add 5.7.1 to archived changelog too.

* Reverted changes to readme, removed entry about backups.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants