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

GuidedTours: Frontend preview #4461

Closed
wants to merge 10 commits into from
Closed

Conversation

ehg
Copy link
Member

@ehg ehg commented Apr 1, 2016

edits by @mcsf

Based off #4391
Intends to close #4380

TODO

  • Might be worth looking into DesignPreview for this.
  • Properly hide/disable primary when showing preview
  • Properly position preview relative to sidebar (currently breaks with resizes)
  • z-index: Position preview below .environment-badge
  • Be more defensive, codewise, when no site selected
  • Hide the sidebar at first

Current state

calypso-guidestours-160408
(Previously: #)

To test

  • Add ?tour=main to any page where a site has been selected
  • Reload the page, hopefully see a preview and a tour
  • Play around a bit

@ehg ehg self-assigned this Apr 1, 2016
@ehg ehg added this to the GuidesTours MVP milestone Apr 1, 2016
@ehg ehg assigned mcsf and unassigned ehg Apr 4, 2016
@mcsf
Copy link
Member

mcsf commented Apr 4, 2016

Might be worth looking into DesignPreview for this.

Given that DesignPreview hasn't landed yet and that judging from #4140 it seems like it does a whole lot more than just what we need, we should just merge this the way it's done with WebPreview and ?iframe=true&preview=true.

Looping @sirbrillig, who might be interested in this use case.

@mcsf mcsf force-pushed the add/guidestours-frontend-preview branch from 9b0b572 to fbc881c Compare April 4, 2016 16:29
@ehg
Copy link
Member Author

ehg commented Apr 4, 2016

we should just merge this the way it's done with WebPreview and ?iframe=true&preview=true.

Yeah, I had a closer look, and we should be OK with our own approach for the MVP. We could then maybe use the cool layoutFocus approach later.

@mcsf mcsf force-pushed the add/guidestours-frontend-preview branch from fbc881c to 40e5f87 Compare April 5, 2016 17:01
/**
* As apparent below, the idea is simple: connect Main to Redux so it knows
* whether it should render a guided tour rather than `primary`.
*
Copy link
Member Author

Choose a reason for hiding this comment

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

Why should Main care about this? Aren't we just overlaying the preview?

Copy link
Member

Choose a reason for hiding this comment

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

Right, I should've made the motivation clear:

The preview is currently overlaid, but if you try resizing you'll see a lot of funkiness going on, as the sidebar shrinks, then hides. Specifically, you'll see a glimpse of primary in between the sidebar and the overlay.

My reasoning, which I should've shared yesterday, is that it's probably a bad idea to rely on a position: fixed element to make sure we fully hide Calypso consistently across different viewports and wild scenarios. Thus, I'd like Main — since it hierarchically sits pretty close to primary (though sadly not above it; suggestions for other components that would work across sections are welcome) — to do the following, roughly speaking:

const classes = classnames( this.props.className, 'main', {
  // I'm terrible at CSS-oriented naming
  'main__is-guidestour-preview-active': shouldShowGuides
} );
return (
  <main className={ classes } role="main">
    { shouldShowGuides && <WebPreview { ...previewProps } /> }
    { this.props.children }
  </main>
);

That would:

  1. Insert the preview at the same document level of the content / primary, thus gaining more flexibility for good overlay positioning.
  2. Mark <main> with a stateful class so as to make it easier to use plain CSS to hide a Calypso section while the preview is showing.

Is this sound? :)

Copy link
Member

Choose a reason for hiding this comment

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

A chat with @ehg lead to the quick conclusion that, while the general idea likely makes sense, client/layout is a much more suitable component than Main, so I'll get to that.

@sirbrillig
Copy link
Member

Yeah, I would not rely on DesignPreview yet, although it could definitely be a useful tool for this situation. Things are still too much in flux there. Very cool, though. Thanks for the ping!

@mcsf
Copy link
Member

mcsf commented Apr 6, 2016

@ehg @lsinger — 9a0d87de5cbea035e9132ec26613f73d382143ea is a pretty big and hideous beast, but it switches from touching Main to touching Layout, and implements a bunch of other stuff (handling viewport resizes and also guessing the sidebar width while the UI is still being built for the first time; piping more things through Redux, e.g. killing state.currentStep, etc.).

@ehg
Copy link
Member Author

ehg commented Apr 6, 2016

Cool.

According to the mockups, we don't actually need to show the sidebar…

screen shot 2016-04-06 at 20 29 10

@mcsf
Copy link
Member

mcsf commented Apr 6, 2016

Good point. So the preview could be initialized with left: 0 and only once My Sites is clicked would the preview make room for the sidebar.

@ehg
Copy link
Member Author

ehg commented Apr 6, 2016

and only once My Sites is clicked would the preview make room for the sidebar.

Yeah, although I'm kind of wary about leaving the preview there, since there's no current way to get back to this particular form of preview. I think it'll be more harmonious when we have Preview Everywhere, but we could hide the preview once My Sites is clicked now. /cc @shaunandrews

@mcsf
Copy link
Member

mcsf commented Apr 6, 2016

Yeah, although I'm kind of wary about leaving the preview there, since there's no current way to get back to this particular form of preview.

Sorry, I didn't mean closing the preview, I meant, literally, to make room for the sidebar by resizing the preview component so that we can see both.

@ehg
Copy link
Member Author

ehg commented Apr 7, 2016

Sorry, I didn't mean closing the preview, I meant, literally, to make room for the sidebar by resizing the preview component so that we can see both.

How about we don't ever show both? :)

@ehg
Copy link
Member Author

ehg commented Apr 7, 2016

Flipping this over to design review, so we can nail the UX.

@ehg ehg added the [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR label Apr 7, 2016
@folletto
Copy link
Contributor

folletto commented Apr 7, 2016

The way I could see this working would be:

  1. When ?tour=main is triggered, should instantly start with the preview visible (no fade-in animation) and the masterbar at the top.
  2. All the steps in the sequence will keep the site preview on.
  3. I'd however complete, iterate and gather feedback on the script first. Guided tours text/flow/branching is the most important bit to nail here.

That said, I'm still a bit not comfortable in showing a UI that is never going to be replicated in the current user experience, so my advice would be to wait for layoutPreview to land, and then review this, so moving this part of the UI to a different milestone (M2?).

[Update] Edited the above to clarify, after a chat with Shaun.

mcsf added 8 commits April 8, 2016 17:15
- We don't want the preview container to get in the way of the
  masterbar, so we take the 47px `top` bump from `.web-preview__content`
  and instead apply it to `.web-preview`.

- Hide the current Calypso section if the preview is showing (this is
  CSS only, the logic to attach stateful classes to the DOM is coming
  next).
So that we can get rid of state within the GuidesTours component.
@mcsf mcsf force-pushed the add/guidestours-frontend-preview branch from 1c58390 to 38b2706 Compare April 8, 2016 16:44
@mcsf
Copy link
Member

mcsf commented Apr 8, 2016

Big painful rebase, following #4468, pushed. Now to implement UX changes.

mcsf added 2 commits April 8, 2016 19:15
Greatly simplifies component logic w.r.t. calculating, guessing, and
keeping track of elements' positions.
We could implement this elsewhere later on.
@mcsf
Copy link
Member

mcsf commented Apr 8, 2016

Experimenting with a full-width preview shown at the start of the tour. Screencast:

calypso-guidestours-160408

@mcsf
Copy link
Member

mcsf commented Apr 8, 2016

Aside from needing a design review, this is good for a code review. (I'll remove the commented-out stuff and squash the commits post-review.)

@mcsf mcsf 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 8, 2016
@lsinger
Copy link
Contributor

lsinger commented Apr 8, 2016

Awesome!

I usually test by going to e.g. /me?tour-main, and in this case the tour never shows up. Do we need to address that? We're making sure people only land on the proper URLs though, right?

@mcsf
Copy link
Member

mcsf commented Apr 8, 2016 via email

@lsinger
Copy link
Contributor

lsinger commented Apr 11, 2016

That was intentional, as we need some site to be selected. If we'd like to have the tour operating from /me, we need the site info to e.g. be injected into the GuidesTours state.

It would be nice to have it as resilient as possible. Could it make sense (and would it be relatively low effort) to just use the most recently created site (from the set of the user's sites) if none is given?

@@ -3,17 +3,17 @@
/**
Copy link
Member Author

Choose a reason for hiding this comment

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

Could this go in a separate PR? :P

@ehg
Copy link
Member Author

ehg commented Apr 11, 2016

Experimenting with a full-width preview shown at the start of the tour.

I think the design consensus is to show the sidebar over the preview, when it's first opened via a section. Maybe we could get away with manipulating the z-index here? Ref: #4461 (comment) & https://marvelapp.com/c1che6#11469689

@@ -170,6 +173,8 @@ Layout = React.createClass( {
{ this.renderWelcome() }
{ this.renderEmailVerificationNotice() }
<GlobalNotices id="notices" notices={ notices.list } forcePinned={ 'post' === this.props.section.name } />
<GuidesPreview showPreview={ this.props.shouldShowGuidesPreview }
Copy link
Member Author

Choose a reason for hiding this comment

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

Any reason this has to go in Layout?

Copy link
Member

Choose a reason for hiding this comment

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

IIRC it was motivated by the possibility of moving away from fixed positioning because of how it interacted with the sidebar and primary. It doesn't matter as much now.

@shaunandrews
Copy link
Contributor

I dig the direction this is heading. The preview takes a few seconds to load, and you're seeing something like this:

screen shot 2016-04-11 at 11 29 05 am

It'd be cool if we had something better to show there. Maybe a blurred out, low-res image of their website. Since this is focused on new users (and we may not have an mShot to use) maybe we could use the theme preview image, at least for Headstart'd sites.? Something like this:

artboard

@folletto
Copy link
Contributor

maybe we could use the theme preview image, at least for Headstart'd sites

Brilliant idea. 💯

mcsf added a commit that referenced this pull request Apr 12, 2016
- Note use of createSelector in order to benefit from strict equality
  checks in GuidesTours#shouldComponentUpdate.

- This architecture should make a number of things easier in the future,
  including adding a preview of the frontend during the tour (#4461).
@shaunandrews
Copy link
Contributor

Fun bug where the preview kept reloading new instances within itself:

screen shot 2016-04-12 at 10 17 26 am

screen shot 2016-04-12 at 10 18 16 am

Maybe related to the private browser window?

@ehg ehg modified the milestones: GuidesTours Future, GuidesTours MVP Apr 12, 2016
@ehg ehg added [Status] In Progress and removed [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Apr 25, 2016
@mcsf mcsf changed the title GuidesTours: Frontend preview GuidedTours: Frontend preview May 11, 2016
@ehg
Copy link
Member Author

ehg commented May 16, 2016

Closing this for now, in favour of #5117.

@ehg ehg closed this May 16, 2016
@lancewillett lancewillett deleted the add/guidestours-frontend-preview branch May 26, 2016 17:48
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.

GuidesTours: Preview frontend
7 participants