Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Points to WPCOM cta beahviour #97659

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions client/components/inline-support-link/context-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ const contextLinks = {
link: 'https://wordpress.com/support/menus/',
post_id: 59580,
},
nameservers: {
link: 'https://wordpress.com/support/domains/change-name-servers/#changing-name-servers-to-point-to-word-press-com',
post_id: 41383,
},
pages: {
link: 'https://wordpress.com/support/pages/',
post_id: 86,
Expand Down
62 changes: 60 additions & 2 deletions client/my-sites/domains/domain-management/dns/dns-records.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,63 @@ class DnsRecords extends Component {
} );
};

renderNotice = () => {
renderDefaultARecordsNotice = () => {
const { translate } = this.props;

if ( ! this.hasWpcomNameservers() ) {
return null;
}

if ( this.hasDefaultARecords() ) {
return null;
}

return (
<div className="dns-records-notice">
<Icon
icon={ info }
size={ 18 }
className="dns-records-notice__icon gridicon"
viewBox="2 2 20 20"
/>
<div className="dns-records-notice__message">
{ translate(
'Your domain is not using default A records. This means it may not be pointing to your WordPress.com site correctly. To restore default A records, click on the three dots menu and select "Restore default A records".'
) }
</div>
</div>
);
};

renderDefaultCNameRecordNotice = () => {
const { translate } = this.props;

if ( ! this.hasWpcomNameservers() ) {
return null;
}

if ( this.hasDefaultCnameRecord() ) {
return null;
}

return (
<div className="dns-records-notice">
<Icon
icon={ info }
size={ 18 }
className="dns-records-notice__icon gridicon"
viewBox="2 2 20 20"
/>
<div className="dns-records-notice__message">
{ translate(
'Your domain is not using the default WWW CNAME record. This means your WordPress.com may not be reached correctly using the www prefix. To restore the default WWW CNAME record, click on the three dots menu and select "Restore default CNAME record".'
) }
</div>
</div>
);
};

renderExternalNameserversNotice = () => {
const { translate, selectedSite, currentRoute, selectedDomainName, nameservers, domains } =
this.props;

Expand Down Expand Up @@ -267,7 +323,9 @@ class DnsRecords extends Component {
{ selectedDomain?.canManageDnsRecords ? (
<>
<DnsDetails />
{ this.renderNotice() }
{ this.renderExternalNameserversNotice() }
{ this.renderDefaultARecordsNotice() }
{ this.renderDefaultCNameRecordNotice() }
<DnsRecordsList
dns={ dns }
selectedSite={ selectedSite }
Expand Down
3 changes: 0 additions & 3 deletions client/my-sites/domains/domain-management/dns/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ body.dns__body-white {
color: var(--studio-gray-50);
font-size: $font-body-small;
margin: 4px 16px;
@include break-mobile {
max-width: 677px;
}
@include break-small {
margin: 0;
}
Expand Down
14 changes: 0 additions & 14 deletions packages/domains-table/src/domains-table/domains-table-row.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import config from '@automattic/calypso-config';
import { FEATURE_SET_PRIMARY_CUSTOM_DOMAIN } from '@automattic/calypso-products';
import page from '@automattic/calypso-router';
import { PartialDomainData } from '@automattic/data-stores';
import { CheckboxControl } from '@wordpress/components';
import { sprintf } from '@wordpress/i18n';
Expand Down Expand Up @@ -92,24 +90,12 @@ export function DomainsTableRow( { domain }: DomainsTableRowProps ) {
return currentDomainData.owner.replace( / \((?!.*\().+\)$/, '' );
};

const handleSelect = () => {
const isAllDomainManagementEnabled = config.isEnabled( 'calypso/all-domain-management' );

if ( isAllDomainManagementEnabled && isAllSitesView ) {
page.show( domainManagementLink );
return;
}

window.location.href = domainManagementLink;
};

return (
<tr
key={ domain.domain }
className={ clsx( 'domains-table__row', {
'is-selected': currentlySelectedDomainName === domain.domain,
} ) }
onClick={ domainManagementLink ? handleSelect : undefined }
>
{ canSelectAnyDomains && (
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions
Expand Down
1 change: 0 additions & 1 deletion packages/domains-table/src/domains-table/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@

.domains-table__row {
&:has(a.domains-table__domain-name) {
cursor: pointer;

&:hover td {
background-color: #f7faff;
Expand Down
36 changes: 26 additions & 10 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,18 @@ export function resolveDomainStatus(
e.stopPropagation(),
};

const editNameserversCallToAction = {
href: domainManagementEdit( siteSlug as string, domain.domain, currentRoute, {
nameservers: true,
} ),
label: translate( 'Point to WordPress.com' ),
};

const editDNSRecordsCallToAction = {
href: domainMagementDNS( siteSlug as string, domain.domain ),
label: translate( 'Point to WordPress.com' ),
};

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

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

return {
statusText: translate( 'Action required' ),
statusClass: 'status-success',
status: translate( 'Active' ),
icon: 'info',
noticeText: translate(
'{{strong}}Transfer successful!{{/strong}} To make this domain work with your WordPress.com site you need to {{a}}point it to WordPress.com name servers.{{/a}}',
'{{strong}}Transfer successful!{{/strong}} To make this domain work with your WordPress.com site you need to {{cta}}point it to WordPress.com servers.{{/cta}}',
{
components: {
strong: <strong />,
a: <a href={ ctaLink } />,
cta: domain.hasWpcomNameservers ? (
<a href={ domainMagementDNS( siteSlug as string, domain.domain ) } />
) : (
<a
href={ domainManagementEdit( siteSlug as string, domain.domain, currentRoute, {
nameservers: true,
} ) }
/>
),
},
}
),
callToAction: {
href: ctaLink,
label: translate( 'Point to WordPress.com' ),
},
callToAction: domain.hasWpcomNameservers
? editDNSRecordsCallToAction
: editNameserversCallToAction,
listStatusWeight: 600,
};
}
Expand Down
1 change: 1 addition & 0 deletions packages/urls/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const DOMAIN_EXPIRATION_REDEMPTION = `${ root }/domains/domain-expiration
export const DOMAIN_RECENTLY_REGISTERED = `${ root }/domains/register-domain/#waiting-for-domain-changes`;
export const DOMAIN_PRICING_AND_AVAILABLE_TLDS = `${ root }/domains/domain-pricing-and-available-tlds/`;
export const DOMAIN_PROMOTIONAL_PRICING_POLICY = `${ root }/domains/domain-pricing-and-available-tlds/#domain-name-promotional-pricing-policy`;
export const DOMAIN_CHANGE_NAME_SERVERS = `${ root }/domains/change-name-servers/#changing-name-servers-to-point-to-word-press-com`;
export const DNS_RECORDS_ADD = `${ root }/domains/custom-dns/add-a-new-dns-record/`;
export const DNS_RECORDS_EDITING_OR_DELETING = `${ root }/domains/custom-dns/edit-or-delete-dns-records/`;
export const DNS_RECORDS_DEFAULT = `${ root }/domains/custom-dns/view-or-restore-default-dns-records/`;
Expand Down
Loading