Skip to content

Commit

Permalink
Merge pull request #13263 from Automattic/update/remove-sites-list-go…
Browse files Browse the repository at this point in the history
…ogle-apps

GoogleApps: remove sites-list usage.
  • Loading branch information
gziolo authored Apr 21, 2017
2 parents c8e59d1 + 28e9c48 commit 78d8f29
Showing 1 changed file with 38 additions and 35 deletions.
73 changes: 38 additions & 35 deletions client/components/upgrades/google-apps/index.jsx
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
/**
* External dependencies
*/
var React = require( 'react' );
import React, { Component, PropTypes } from 'react';
import { connect } from 'react-redux';
import { localize } from 'i18n-calypso';

/**
* Internal dependencies
*/
var cartItems = require( 'lib/cart-values' ).cartItems,
GoogleAppsDialog = require( './dialog' ),
HeaderCake = require( 'components/header-cake' ),
observe = require( 'lib/mixins/data-observe' );
import { cartItems } from 'lib/cart-values';
import GoogleAppsDialog from './dialog';
import HeaderCake from 'components/header-cake';
import { getSelectedSite } from 'state/ui/selectors';

var GoogleApps = React.createClass( {
mixins: [ observe( 'sites' ) ],
class GoogleApps extends Component {

propTypes: {
sites: React.PropTypes.object,
cart: React.PropTypes.object,
domain: React.PropTypes.string.isRequired,
onGoBack: React.PropTypes.func.isRequired,
productsList: React.PropTypes.object.isRequired,
onAddGoogleApps: React.PropTypes.func.isRequired,
onClickSkip: React.PropTypes.func.isRequired,
onSave: React.PropTypes.func,
initialState: React.PropTypes.object,
analyticsSection: React.PropTypes.string,
initialGoogleAppsCartItem: React.PropTypes.object
},
static propTypes = {
cart: PropTypes.object,
domain: PropTypes.string.isRequired,
onGoBack: PropTypes.func.isRequired,
productsList: PropTypes.object.isRequired,
onAddGoogleApps: PropTypes.func.isRequired,
onClickSkip: PropTypes.func.isRequired,
onSave: PropTypes.func,
initialState: PropTypes.object,
analyticsSection: PropTypes.string,
initialGoogleAppsCartItem: PropTypes.object
};

getDefaultProps: function() {
return { analyticsSection: 'domains' };
},
static defaultProps = {
analyticsSection: 'domains',
};

componentDidMount: function() {
componentDidMount() {
this.checkDomainInCart();
},
}

componentDidUpdate: function() {
componentDidUpdate() {
this.checkDomainInCart();
},
}

checkDomainInCart: function() {
checkDomainInCart() {
if ( ! this.props.cart || ! this.props.cart.hasLoadedFromServer ) {
return;
}
Expand All @@ -49,14 +49,13 @@ var GoogleApps = React.createClass( {
// Should we handle this more gracefully?
this.props.onGoBack();
}
},
}

render: function() {
var selectedSite = this.props.sites ? this.props.sites.getSelectedSite() : null;
render() {
return (
<div>
<HeaderCake onClick={ this.props.onGoBack }>
{ this.translate( 'Register %(domain)s', { args: { domain: this.props.domain } } ) }
{ this.props.translate( 'Register %(domain)s', { args: { domain: this.props.domain } } ) }
</HeaderCake>

<GoogleAppsDialog
Expand All @@ -65,14 +64,18 @@ var GoogleApps = React.createClass( {
onClickSkip={ this.props.onClickSkip }
onGoBack={ this.props.onGoBack }
onAddGoogleApps={ this.props.onAddGoogleApps }
selectedSite={ selectedSite }
selectedSite={ this.props.selectedSite }
analyticsSection={ this.props.analyticsSection }
onSave={ this.props.onSave }
initialState={ this.props.initialState }
initialGoogleAppsCartItem={ this.props.initialGoogleAppsCartItem } />
</div>
);
}
} );
}

module.exports = GoogleApps;
export default connect( ( state ) => {
return {
selectedSite: getSelectedSite( state )
};
} )( localize( GoogleApps ) );

0 comments on commit 78d8f29

Please sign in to comment.