From 017c08834913528dfa94c02e51e79d679010c58f Mon Sep 17 00:00:00 2001 From: Igor Giussani Date: Thu, 19 Dec 2024 18:14:32 +0100 Subject: [PATCH] Improve `Points to WPCOM` logics --- .../inline-support-link/context-links.js | 4 ++ .../domain-management/dns/dns-records.jsx | 62 ++++++++++++++++++- .../src/domains-table/domains-table-row.tsx | 14 ----- .../src/domains-table/style.scss | 1 - .../src/utils/resolve-domain-status.tsx | 23 ++++--- packages/urls/src/index.ts | 1 + 6 files changed, 78 insertions(+), 27 deletions(-) diff --git a/client/components/inline-support-link/context-links.js b/client/components/inline-support-link/context-links.js index 3cf7996d30e95..b415f65240901 100644 --- a/client/components/inline-support-link/context-links.js +++ b/client/components/inline-support-link/context-links.js @@ -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, diff --git a/client/my-sites/domains/domain-management/dns/dns-records.jsx b/client/my-sites/domains/domain-management/dns/dns-records.jsx index 3642c337827e0..e108be3a6b34a 100644 --- a/client/my-sites/domains/domain-management/dns/dns-records.jsx +++ b/client/my-sites/domains/domain-management/dns/dns-records.jsx @@ -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 ( +
+ +
+ { 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".' + ) } +
+
+ ); + }; + + renderDefaultCNameRecordNotice = () => { + const { translate } = this.props; + + if ( ! this.hasWpcomNameservers() ) { + return null; + } + + if ( this.hasDefaultCnameRecord() ) { + return null; + } + + return ( +
+ +
+ { 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".' + ) } +
+
+ ); + }; + + renderExternalNameserversNotice = () => { const { translate, selectedSite, currentRoute, selectedDomainName, nameservers, domains } = this.props; @@ -267,7 +323,9 @@ class DnsRecords extends Component { { selectedDomain?.canManageDnsRecords ? ( <> - { this.renderNotice() } + { this.renderExternalNameserversNotice() } + { this.renderDefaultARecordsNotice() } + { this.renderDefaultCNameRecordNotice() } { - const isAllDomainManagementEnabled = config.isEnabled( 'calypso/all-domain-management' ); - - if ( isAllDomainManagementEnabled && isAllSitesView ) { - page.show( domainManagementLink ); - return; - } - - window.location.href = domainManagementLink; - }; - return ( { canSelectAnyDomains && ( // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-noninteractive-element-interactions diff --git a/packages/domains-table/src/domains-table/style.scss b/packages/domains-table/src/domains-table/style.scss index 800355d9e2051..390702c9312fe 100644 --- a/packages/domains-table/src/domains-table/style.scss +++ b/packages/domains-table/src/domains-table/style.scss @@ -107,7 +107,6 @@ .domains-table__row { &:has(a.domains-table__domain-name) { - cursor: pointer; &:hover td { background-color: #f7faff; diff --git a/packages/domains-table/src/utils/resolve-domain-status.tsx b/packages/domains-table/src/utils/resolve-domain-status.tsx index 9be77e2a65c2c..b3b12ab087776 100644 --- a/packages/domains-table/src/utils/resolve-domain-status.tsx +++ b/packages/domains-table/src/utils/resolve-domain-status.tsx @@ -6,6 +6,7 @@ import { DOMAIN_EXPIRATION_AUCTION, } from '@automattic/urls'; import moment from 'moment'; +import InlineSupportLink from 'calypso/components/inline-support-link'; //eslint-disable-line no-restricted-imports import { gdprConsentStatus, transferStatus, @@ -503,29 +504,31 @@ export function resolveDomainStatus( } if ( domain.transferStatus === transferStatus.COMPLETED && ! domain.pointsToWpcom ) { - const ctaLink = domain.hasWpcomNameservers - ? domainMagementDNS( siteSlug as string, domain.domain ) - : 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: , - a: e.stopPropagation() } />, + cta: domain.hasWpcomNameservers ? ( + + ) : ( + + ), }, } ), callToAction: domain.hasWpcomNameservers - ? editDNSRecordsCallToAction - : editNameserversCallToAction, + ? editNameserversCallToAction + : editDNSRecordsCallToAction, listStatusWeight: 600, }; } diff --git a/packages/urls/src/index.ts b/packages/urls/src/index.ts index bc784eb480bf8..2d1b2d4ac2fbc 100644 --- a/packages/urls/src/index.ts +++ b/packages/urls/src/index.ts @@ -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/`;