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

Themes: 'Thanks' modal on activation from Theme Sheet #5259

Merged
merged 8 commits into from
May 12, 2016

Conversation

seear
Copy link
Contributor

@seear seear commented May 6, 2016

Acknowledge activation of a theme from the theme sheet with the existing 'Thanks' modal dialog.

screen shot 2016-05-06 at 13 55 06

Currently only works when a site is selected. A site selector for the sheet is coming soon.

To Test

  • Go to http://calypso.localhost:3000/design and choose a site
  • Click on the ... button for a theme and select Details
  • Click the Pick this design button
    Expected: The modal should display
    Expected: The first link in the modal should be to the customizer
  • Check that the links in the modal work as expected

@seear seear self-assigned this May 6, 2016
@seear seear added [Feature Group] Appearance & Themes Features related to the appearance of sites. [Status] In Progress labels May 6, 2016
@seear seear added this to the Themes: Showcase M4-ThemeSheets milestone May 6, 2016
@seear seear force-pushed the add/theme-sheet-thanks branch 3 times, most recently from b60d83e to 07cb64f Compare May 9, 2016 14:13
@seear seear 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 May 9, 2016
@seear seear force-pushed the add/theme-sheet-thanks branch from 07cb64f to c6647b3 Compare May 9, 2016 17:41
@ockham
Copy link
Contributor

ockham commented May 10, 2016

There already is an EmptyComponent in test/test/helpers/react/empty-component -- can we re-use that? (You could add your README to that directory tho.)

@seear
Copy link
Contributor Author

seear commented May 10, 2016

There already is an EmptyComponent in test/test/helpers/react/empty-component -- can we re-use that?

Yeah, good point, and I thought about this a bit at the time. In the end I wasn't totally happy with the tests and production code sharing the same empty component, since it seems they serve different purposes. Hopefully the test version will be longer lived than this production one.

@@ -1,3 +1,5 @@
/* eslint-disable react/jsx-no-bind */
Copy link
Contributor

Choose a reason for hiding this comment

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

Please don't unless there's a way more compelling reason than elsewhere :-)

What about changing the trackClick method as follows instead:

boundTrackClick: function( eventName ) {
  return Helpers.trackClick.bind( null, 'current theme', eventName );
}

That should allow usage like

onClick={ this.boundTrackClick( 'features' )}

@ockham
Copy link
Contributor

ockham commented May 10, 2016

In the end I wasn't totally happy with the tests and production code sharing the same empty component, since it seems they serve different purposes.

Yeah. :-/ Alternatively, tests could also use the production variant. But I guess I'm fine with the dupe for now since it's such a small component.

<ThanksModal
site={ this.props.selectedSite }
source={ 'details' }
clearActivated={ bindActionCreators( clearActivated, this.props.dispatch ) }/>
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using the second argument to the connect call, mapDispatchToProps, instead:

export default connect(
    ( state ) => {
        /* ... */
    },
    { clearActivated }
)( ThemeSheet );

(and just use clearActivated={ this.props.clearActivated } then -- could do the same with the other actions you dispatch, BTW.)

@ockham
Copy link
Contributor

ockham commented May 10, 2016

Noting here that with premium themes, the flow works fine, but I end up at /design/<mysite> after purchase (instead of back at the theme sheet). Reason:

page.redirect( '/design/' + this.props.selectedSite.slug );
Not within the scope of this PR, but we should probably file an issue after this one is merged to keep track.

@ockham
Copy link
Contributor

ockham commented May 10, 2016

Left a couple of nitpicks. Looks good overall, and tests well!

@seear
Copy link
Contributor Author

seear commented May 11, 2016

Regarding the jsx-no-bind:

Please don't unless there's a way more compelling reason than elsewhere :-)

I disagree here, because this component will never be on a hot path, so it's not worth obfuscating code to prevent the eslint warning.

I have moved to your suggestion because the event param was preventing the click verb being appended in helpers.js, but note that there is still a bind for each prop—it's just that eslint is not aware of it!

@ockham
Copy link
Contributor

ockham commented May 12, 2016

:shipit:

@seear seear merged commit c65ca89 into master May 12, 2016
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 12, 2016
@ockham ockham deleted the add/theme-sheet-thanks branch May 12, 2016 16:29
roundhill pushed a commit that referenced this pull request May 17, 2016
* Themes: Thanks modal in sheet when activating theme
* Add README.md for empty component
* Themes: `source` prop for thanks modal
* Themes: Show customize link in modal on sheet activation
* Themes: Click-tracking for thanks-modal
* Themes: use mapDispatchToProps for sheet actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature Group] Appearance & Themes Features related to the appearance of sites.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants