Skip to content

Commit

Permalink
Merge pull request #35069 from Automattic/update/launch-earn
Browse files Browse the repository at this point in the history
Earn: remove config flag and go live
  • Loading branch information
eliorivero authored Aug 5, 2019
2 parents 23cd961 + 98cb015 commit 1726f2d
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 56 deletions.
27 changes: 9 additions & 18 deletions client/my-sites/earn/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import page from 'page';
import { navigation, siteSelection, sites } from 'my-sites/controller';
import earnController from './controller';
import { makeLayout, render as clientRender } from 'controller';
import config from 'config';

export default function() {
page( '/earn', siteSelection, sites, makeLayout, clientRender );
Expand All @@ -33,23 +32,15 @@ export default function() {
page( '/ads', '/earn' );
page( '/ads/*', '/earn' );

if ( config.isEnabled( 'earn-relayout' ) ) {
page(
'/earn/:site_id',
siteSelection,
navigation,
earnController.layout,
makeLayout,
clientRender
);
} else {
page(
'/earn/:site_id',
( { params } ) => page.redirect( '/earn/payments/' + params.site_id ),
makeLayout,
clientRender
);
}
page(
'/earn/:site_id',
siteSelection,
navigation,
earnController.layout,
makeLayout,
clientRender
);

page(
'/earn/:section/:site_id',
siteSelection,
Expand Down
57 changes: 22 additions & 35 deletions client/my-sites/earn/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import Home from './home';
import AdsWrapper from './ads/wrapper';
import MembershipsSection from './memberships';
import MembershipsProductsSection from './memberships/products';
import config from 'config';
import { canAccessAds } from 'lib/ads/utils';

class EarningsMain extends Component {
Expand All @@ -52,26 +51,14 @@ class EarningsMain extends Component {
const pathSuffix = siteSlug ? '/' + siteSlug : '';
const tabs = [];

if ( config.isEnabled( 'memberships' ) && ! config.isEnabled( 'earn-relayout' ) ) {
tabs.push( {
title: translate( 'Recurring Payments' ),
path: '/earn/payments' + pathSuffix,
id: 'payments',
} );
}

if ( canAccessAds( this.props.site ) ) {
tabs.push( {
title: config.isEnabled( 'earn-relayout' )
? translate( 'Earnings' )
: translate( 'Ads Earnings' ),
title: translate( 'Earnings' ),
path: '/earn/ads-earnings' + pathSuffix,
id: 'ads-earnings',
} );
tabs.push( {
title: config.isEnabled( 'earn-relayout' )
? translate( 'Settings' )
: translate( 'Ads Settings' ),
title: translate( 'Settings' ),
path: '/earn/ads-settings' + pathSuffix,
id: 'ads-settings',
} );
Expand Down Expand Up @@ -153,31 +140,31 @@ class EarningsMain extends Component {

getHeaderCake = () => {
const headerText = this.getHeaderText();
return config.isEnabled( 'earn-relayout' ) && headerText ? (
<HeaderCake backHref={ this.goBack() }>{ headerText }</HeaderCake>
) : null;
return headerText && <HeaderCake backHref={ this.goBack() }>{ headerText }</HeaderCake>;
};

getSectionNav = section => {
const currentPath = this.getCurrentPath();

return ! section.startsWith( 'payments' ) || ! config.isEnabled( 'earn-relayout' ) ? (
<SectionNav selectedText={ this.getSelectedText() }>
<NavTabs>
{ this.getFilters().map( filterItem => {
return (
<NavItem
key={ filterItem.id }
path={ filterItem.path }
selected={ filterItem.path === currentPath }
>
{ filterItem.title }
</NavItem>
);
} ) }
</NavTabs>
</SectionNav>
) : null;
return (
! section.startsWith( 'payments' ) && (
<SectionNav selectedText={ this.getSelectedText() }>
<NavTabs>
{ this.getFilters().map( filterItem => {
return (
<NavItem
key={ filterItem.id }
path={ filterItem.path }
selected={ filterItem.path === currentPath }
>
{ filterItem.title }
</NavItem>
);
} ) }
</NavTabs>
</SectionNav>
)
);
};

render() {
Expand Down
1 change: 0 additions & 1 deletion config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"domains/kracken-ui/exact-match-filter": true,
"domains/kracken-ui/max-characters-filter": true,
"domains/kracken-ui/pagination": true,
"earn-relayout": true,
"external-media": true,
"external-media/google-photos": true,
"external-media/free-photo-library": true,
Expand Down
1 change: 0 additions & 1 deletion config/stage.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"domains/gdpr-consent-page": true,
"domains/kracken-ui/exact-match-filter": true,
"domains/kracken-ui/pagination": true,
"earn-relayout": false,
"external-media": true,
"external-media/google-photos": true,
"external-media/free-photo-library": true,
Expand Down
1 change: 0 additions & 1 deletion config/wpcalypso.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"domains/gdpr-consent-page": true,
"domains/kracken-ui/exact-match-filter": true,
"domains/kracken-ui/pagination": true,
"earn-relayout": false,
"external-media": true,
"external-media/google-photos": true,
"external-media/free-photo-library": true,
Expand Down

0 comments on commit 1726f2d

Please sign in to comment.