Skip to content

Commit

Permalink
Hide make primary domain button when n/a
Browse files Browse the repository at this point in the history
  • Loading branch information
eltongo committed Jul 14, 2020
1 parent d99e481 commit f1bf539
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions client/my-sites/domains/domain-management/list/domain-item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ class DomainItem extends PureComponent {
);
}

canSetAsPrimary() {
const { domainDetails, isManagingAllSites, shouldUpgradeToMakePrimary } = this.props;
return (
! isManagingAllSites &&
domainDetails &&
domainDetails.canSetAsPrimary &&
! domainDetails.isPrimary &&
! shouldUpgradeToMakePrimary
);
}

upgradeToMakePrimary() {
const { translate } = this.props;

Expand Down Expand Up @@ -174,7 +185,7 @@ class DomainItem extends PureComponent {
}

renderOptionsButton() {
const { disabled, domainDetails, isBusy, isManagingAllSites, translate } = this.props;
const { disabled, isBusy, translate } = this.props;

return (
<div className="list__domain-options">
Expand All @@ -183,7 +194,7 @@ class DomainItem extends PureComponent {
onClick={ this.stopPropagation }
toggleTitle={ translate( 'Options' ) }
>
{ ! isManagingAllSites && ! domainDetails.isPrimary && (
{ this.canSetAsPrimary() && (
<PopoverMenuItem icon="domains" onClick={ this.makePrimary }>
{ translate( 'Make primary domain' ) }
</PopoverMenuItem>
Expand Down

0 comments on commit f1bf539

Please sign in to comment.