From 15833a8b58b90a8b9ed26c761332c84871fe7753 Mon Sep 17 00:00:00 2001 From: Marin Atanasov Date: Fri, 29 Dec 2017 13:04:31 +0200 Subject: [PATCH 1/2] Jetpack Onboarding: Save site type selection --- client/jetpack-onboarding/steps/site-type.jsx | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/client/jetpack-onboarding/steps/site-type.jsx b/client/jetpack-onboarding/steps/site-type.jsx index 4e540dbaafcf0..c2089b623fa7a 100644 --- a/client/jetpack-onboarding/steps/site-type.jsx +++ b/client/jetpack-onboarding/steps/site-type.jsx @@ -4,6 +4,7 @@ * External dependencies */ import React from 'react'; +import { connect } from 'react-redux'; import { localize } from 'i18n-calypso'; /** @@ -15,12 +16,24 @@ import PageViewTracker from 'lib/analytics/page-view-tracker'; import Tile from 'components/tile-grid/tile'; import TileGrid from 'components/tile-grid'; import { JETPACK_ONBOARDING_STEPS as STEPS } from '../constants'; +import { saveJetpackOnboardingSettings } from 'state/jetpack-onboarding/actions'; class JetpackOnboardingSiteTypeStep extends React.PureComponent { + handleSiteTypeSelection = siteType => { + const { siteId } = this.props; + + return () => { + this.props.saveJetpackOnboardingSettings( siteId, { + siteType, + } ); + }; + }; + render() { - const { translate } = this.props; + const { getForwardUrl, translate } = this.props; const headerText = translate( "Let's shape your new site." ); const subHeaderText = translate( 'What kind of site do you need? Choose an option below:' ); + const forwardUrl = getForwardUrl(); return (
@@ -39,6 +52,8 @@ class JetpackOnboardingSiteTypeStep extends React.PureComponent { 'To share your ideas, stories, photographs, or creative projects with your followers.' ) } image={ '/calypso/images/illustrations/type-personal.svg' } + href={ forwardUrl } + onClick={ this.handleSiteTypeSelection( 'personal' ) } />
@@ -53,4 +70,6 @@ class JetpackOnboardingSiteTypeStep extends React.PureComponent { } } -export default localize( JetpackOnboardingSiteTypeStep ); +export default connect( null, { saveJetpackOnboardingSettings } )( + localize( JetpackOnboardingSiteTypeStep ) +); From ec21a1d2e67db4dfb92933a9b59a3d29fb9f70ef Mon Sep 17 00:00:00 2001 From: Marin Atanasov Date: Wed, 3 Jan 2018 15:24:59 +0200 Subject: [PATCH 2/2] Jetpack Onboarding: Simplify handleSiteTypeSelection --- client/jetpack-onboarding/steps/site-type.jsx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/client/jetpack-onboarding/steps/site-type.jsx b/client/jetpack-onboarding/steps/site-type.jsx index c2089b623fa7a..f3bfbec4b8823 100644 --- a/client/jetpack-onboarding/steps/site-type.jsx +++ b/client/jetpack-onboarding/steps/site-type.jsx @@ -19,14 +19,10 @@ import { JETPACK_ONBOARDING_STEPS as STEPS } from '../constants'; import { saveJetpackOnboardingSettings } from 'state/jetpack-onboarding/actions'; class JetpackOnboardingSiteTypeStep extends React.PureComponent { - handleSiteTypeSelection = siteType => { - const { siteId } = this.props; - - return () => { - this.props.saveJetpackOnboardingSettings( siteId, { - siteType, - } ); - }; + handleSiteTypeSelection = siteType => () => { + this.props.saveJetpackOnboardingSettings( this.props.siteId, { + siteType, + } ); }; render() {