From 0298506839b993afc747c32e423fb0924eaaa2cd Mon Sep 17 00:00:00 2001 From: Marin Atanasov Date: Thu, 4 Jan 2018 16:38:47 +0200 Subject: [PATCH] Jetpack Onboarding: Save site type selection (#21154) * Jetpack Onboarding: Save site type selection * Jetpack Onboarding: Simplify handleSiteTypeSelection --- client/jetpack-onboarding/steps/site-type.jsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/client/jetpack-onboarding/steps/site-type.jsx b/client/jetpack-onboarding/steps/site-type.jsx index 4e540dbaafcf0..f3bfbec4b8823 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,20 @@ 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 => () => { + this.props.saveJetpackOnboardingSettings( this.props.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 +48,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 +66,6 @@ class JetpackOnboardingSiteTypeStep extends React.PureComponent { } } -export default localize( JetpackOnboardingSiteTypeStep ); +export default connect( null, { saveJetpackOnboardingSettings } )( + localize( JetpackOnboardingSiteTypeStep ) +);