Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
justinshreve committed Aug 7, 2019
1 parent 4af2c25 commit 1e11edf
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 25 deletions.
1 change: 0 additions & 1 deletion client/blocks/login/login-form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,6 @@ export class LoginForm extends Component {

if (
config.isEnabled( 'woocommerce/onboarding-oauth' ) &&
oauth2Client &&
isWooOAuth2Client( oauth2Client ) &&
wccomFrom
) {
Expand Down
1 change: 0 additions & 1 deletion client/blocks/signup-form/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,6 @@ class SignupForm extends Component {
( config.isEnabled( 'jetpack/connect/woocommerce' ) &&
this.props.isJetpackWooCommerceFlow ) ||
( config.isEnabled( 'woocommerce/onboarding-oauth' ) &&
this.props.oauth2Client &&
isWooOAuth2Client( this.props.oauth2Client ) &&
this.props.wccomFrom )
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
* External dependencies
*/
import React from 'react';
import { localize } from 'i18n-calypso';

import './style.scss';

const WooCommercConnectCartHeader = () => {
const WooCommercConnectCartHeader = ( { translate } ) => {
return (
<div className="woocommerce-connect-cart-header is-stepper">
<div className="woocommerce-connect-cart-header__stepper">
Expand Down Expand Up @@ -45,7 +46,9 @@ const WooCommercConnectCartHeader = () => {
</svg>
</div>
<div className="woocommerce-connect-cart-header__stepper-step-text">
<span className="woocommerce-connect-cart-header__stepper-step-label">Cart</span>
<span className="woocommerce-connect-cart-header__stepper-step-label">
{ translate( 'Cart' ) }
</span>
</div>
</div>
<div className="woocommerce-connect-cart-header__stepper-step-divider" />
Expand All @@ -54,7 +57,9 @@ const WooCommercConnectCartHeader = () => {
<span className="woocommerce-connect-cart-header__stepper-step-number">2</span>
</div>
<div className="woocommerce-connect-cart-header__stepper-step-text">
<span className="woocommerce-connect-cart-header__stepper-step-label">Payment</span>
<span className="woocommerce-connect-cart-header__stepper-step-label">
{ translate( 'Payment' ) }
</span>
</div>
</div>
<div className="woocommerce-connect-cart-header__stepper-step-divider" />
Expand All @@ -64,7 +69,7 @@ const WooCommercConnectCartHeader = () => {
</div>
<div className="woocommerce-connect-cart-header__stepper-step-text">
<span className="woocommerce-connect-cart-header__stepper-step-label">
Installation
{ translate( 'Installation' ) }
</span>
</div>
</div>
Expand All @@ -74,4 +79,4 @@ const WooCommercConnectCartHeader = () => {
);
};

export default WooCommercConnectCartHeader;
export default localize( WooCommercConnectCartHeader );
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* @todo color variables */
.woocommerce-connect-cart-header {
height: 56px;
border-bottom: 1px solid #e1e2e2;
border-bottom: 1px solid var( --color-gray-50 );
display: flex;
align-items: center;
justify-content: center;
background: #fff;
background: var( --color-white );
position: absolute;
left: 0;
top: 0;
Expand Down Expand Up @@ -67,15 +66,15 @@
height: 24px;
min-width: 24px;
margin-right: 12px;
background: #e1e2e2;
color: #50575d;
background: var( --color-gray-50 );
color: var( --color-gray-600 );
border-radius: 50%;
}

.woocommerce-connect-cart-header__stepper-step.is-active .woocommerce-connect-cart-header__stepper-step-icon,
.woocommerce-connect-cart-header__stepper-step.is-complete .woocommerce-connect-cart-header__stepper-step-icon {
background: #673d99;
color: #fff;
background: var( --color-hot-purple-600 );
color: var( --color-white );
}

.woocommerce-connect-cart-header__stepper-step.is-complete .woocommerce-connect-cart-header__stepper-step-number {
Expand All @@ -91,7 +90,7 @@
}

.woocommerce-connect-cart-header__stepper-step .woocommerce-connect-cart-header__stepper-step-label {
color: #1a1a1a;
color: var( --color-gray-900 );
line-height: 24px;
font-size: 16px;

Expand All @@ -102,15 +101,15 @@
}

.woocommerce-connect-cart-header__stepper-step .woocommerce-connect-cart-header__stepper-step-label {
color: #2b2d2f;
color: var( --color-gray-800 );
}
.woocommerce-connect-cart-header__stepper-step.is-complete .woocommerce-connect-cart-header__stepper-step-label {
color: #1a1a1a;
color: var( --color-gray-900 );
}

.woocommerce-connect-cart-header__stepper-step-divider {
align-self: flex-start;
flex-grow: 1;
border-bottom: 1px solid #e1e2e2;
border-bottom: 1px solid var( --color-gray-50 );
margin-top: 20px;
}
}
1 change: 0 additions & 1 deletion client/layout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,6 @@ class Layout extends Component {
{
'is-wccom-oauth-flow':
config.isEnabled( 'woocommerce/onboarding-oauth' ) &&
this.props.oauth2Client &&
isWooOAuth2Client( this.props.oauth2Client ) &&
this.props.wccomFrom,
}
Expand Down
1 change: 0 additions & 1 deletion client/layout/logged-out.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const LayoutLoggedOut = ( {
config.isEnabled( 'jetpack/connect/woocommerce' ) && isJetpackWooCommerceFlow,
'is-wccom-oauth-flow':
config.isEnabled( 'woocommerce/onboarding-oauth' ) &&
useOAuth2Layout &&
isWooOAuth2Client( oauth2Client ) &&
wccomFrom,
};
Expand Down
2 changes: 1 addition & 1 deletion client/lib/oauth2-clients.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export const isCrowdsignalOAuth2Client = oauth2Client => {
};

export const isWooOAuth2Client = oauth2Client => {
return includes( [ 50019, 50915, 50916 ], oauth2Client.id );
return oauth2Client && includes( [ 50019, 50915, 50916 ], oauth2Client.id );
};
6 changes: 6 additions & 0 deletions client/lib/paths/login/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,11 @@ describe( 'index', () => {

expect( url ).to.equal( '/log-in/jetpack?from=woocommerce-setup-wizard' );
} );

test( 'should return the login url with WooCommerce.com handler', () => {
const url = login( { isNative: true, oauth2ClientId: 12345, wccomFrom: 'testing' } );

expect( url ).to.equal( '/log-in?client_id=12345&wccom-from=testing' );
} );
} );
} );
1 change: 0 additions & 1 deletion client/login/wp-login/login-links.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ export class LoginLinks extends React.Component {
// @todo Implement a muriel version of the email login links for the WooCommerce onboarding flows
if (
config.isEnabled( 'woocommerce/onboarding-oauth' ) &&
this.props.oauth2Client &&
isWooOAuth2Client( this.props.oauth2Client ) &&
this.props.wccomFrom
) {
Expand Down
2 changes: 1 addition & 1 deletion client/signup/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ body.is-section-signup .layout.gravatar .formatted-header {
display: block;
height: 56px;
border-bottom: 1px solid var( --color-woocommerce-header-border );
background: #fff;
background: var( --color-white );

svg {
margin-top: 15px;
Expand Down
1 change: 0 additions & 1 deletion server/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ function getDefaultContext( request ) {
config.isEnabled( 'woocommerce/onboarding-oauth' ) &&
( 'login' === request.context.sectionName || 'signup' === request.context.sectionName ) &&
request.query[ 'wccom-from' ] &&
oauthClientId &&
isWooOAuth2Client( { id: parseInt( oauthClientId ) } );

const context = Object.assign( {}, request.context, {
Expand Down

0 comments on commit 1e11edf

Please sign in to comment.