-
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
GuidedTours: Frontend preview #4461
Conversation
Given that Looping @sirbrillig, who might be interested in this use case. |
9b0b572
to
fbc881c
Compare
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 |
fbc881c
to
40e5f87
Compare
/** | ||
* As apparent below, the idea is simple: connect Main to Redux so it knows | ||
* whether it should render a guided tour rather than `primary`. | ||
* |
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.
Why should Main
care about this? Aren't we just overlaying the preview?
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.
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:
- Insert the preview at the same document level of the content /
primary
, thus gaining more flexibility for good overlay positioning. - 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? :)
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.
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.
Yeah, I would not rely on |
@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 |
Good point. So the preview could be initialized with |
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 |
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? :) |
Flipping this over to design review, so we can nail the UX. |
The way I could see this working would be:
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 [Update] Edited the above to clarify, after a chat with Shaun. |
- 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.
1c58390
to
38b2706
Compare
Big painful rebase, following #4468, pushed. Now to implement UX changes. |
Greatly simplifies component logic w.r.t. calculating, guessing, and keeping track of elements' positions.
We could implement this elsewhere later on.
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.) |
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? |
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 @@ | |||
/** |
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.
Could this go in a separate PR? :P
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 } |
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.
Any reason this has to go in Layout
?
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.
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.
I dig the direction this is heading. The preview takes a few seconds to load, and you're seeing something like this: 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: |
Brilliant idea. 💯 |
- 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).
Closing this for now, in favour of #5117. |
edits by @mcsf
Based off #4391Intends to close #4380
TODO
DesignPreview
for this.primary
when showing preview.environment-badge
Current state
(Previously: #)
To test
?tour=main
to any page where a site has been selected