Skip to content

Commit

Permalink
Update links for transfer completed status
Browse files Browse the repository at this point in the history
  • Loading branch information
gius80 committed Dec 13, 2024
1 parent d916a34 commit a7e9ab9
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions packages/domains-table/src/utils/resolve-domain-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
domainManagementTransfer,
domainMappingSetup,
domainUseMyDomain,
domainMagementDNS,
} from './paths';
import { ResponseDomain } from './types';
import type { I18N, TranslateResult } from 'i18n-calypso';
Expand Down Expand Up @@ -105,6 +106,22 @@ export function resolveDomainStatus(
e.stopPropagation(),
};

const editNameserversCallToAction = {
href: domainManagementEdit( siteSlug as string, domain.domain, currentRoute, {
nameservers: true,
} ),
label: translate( 'Point to WordPress.com' ),
onClick: ( e: React.MouseEvent< HTMLAnchorElement | HTMLButtonElement, MouseEvent > ) =>
e.stopPropagation(),
};

const editDNSRecordsCallToAction = {
href: domainMagementDNS( siteSlug as string, domain.domain ),
label: translate( 'Point to WordPress.com' ),
onClick: ( e: React.MouseEvent< HTMLAnchorElement | HTMLButtonElement, MouseEvent > ) =>
e.stopPropagation(),
};

switch ( domain.type ) {
case domainTypes.MAPPED:
if ( isExpiringSoon( domain, 30 ) ) {
Expand Down Expand Up @@ -486,9 +503,11 @@ export function resolveDomainStatus(
}

if ( domain.transferStatus === transferStatus.COMPLETED && ! domain.pointsToWpcom ) {
const ctaLink = domainManagementEdit( siteSlug as string, domain.domain, currentRoute, {
nameservers: true,
} );
const ctaLink = domain.hasWpcomNameservers
? domainMagementDNS( siteSlug as string, domain.domain )
: domainManagementEdit( siteSlug as string, domain.domain, currentRoute, {
nameservers: true,
} );

return {
statusText: translate( 'Action required' ),
Expand All @@ -500,14 +519,13 @@ export function resolveDomainStatus(
{
components: {
strong: <strong />,
a: <a href={ ctaLink } />,
a: <a href={ ctaLink } onClick={ ( e ) => e.stopPropagation() } />,
},
}
),
callToAction: {
href: ctaLink,
label: translate( 'Point to WordPress.com' ),
},
callToAction: domain.hasWpcomNameservers
? editDNSRecordsCallToAction
: editNameserversCallToAction,
listStatusWeight: 600,
};
}
Expand Down

0 comments on commit a7e9ab9

Please sign in to comment.