-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Domains: Update domain mapping thank you page #51031
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~1643 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving comments from our call together so that they are not lost.
Sorry for the brevity - the code and approach is overall looking really good. Good job figuring out all the moving pieces from other places in our code!
) : ( | ||
<span /> | ||
); | ||
const renderLinkTo = ( url ) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use ExternalLink
here.
const primaryMessage = translate( | ||
'Please log into your account at your domain registrar and {{strong}}update the name servers{{/strong}} of your domain to use the following values, as detailed in {{link}}these instructions{{/link}}:', | ||
{ | ||
comment: 'Notice for mapped domain notice with NS records pointing to somewhere else', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might not be needed.
<li>{ domain }. IN NS ns1.wordpress.com.</li> | ||
<li>{ domain }. IN NS ns2.wordpress.com.</li> | ||
<li>{ domain }. IN NS ns3.wordpress.com.</li> | ||
const isDataLoaded = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's maybe refactor the whole component to be a normal one - or at least, pull these methods out of this component.
}; | ||
|
||
const renderARecordsList = () => { | ||
if ( isDataLoaded() ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe let's inverse the logic here - and return the placeholder component early. As that's the least interesting case (and avoids big nested lines).
margin: 0; | ||
} | ||
.purchase-detail__image { | ||
@include breakpoint-deprecated( '>660px' ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try to use the new Gutenberg mixins in new code: https://github.com/Automattic/wp-calypso/blob/HEAD/docs/coding-guidelines/css.md#media-queries
And https://github.com/WordPress/gutenberg/blob/0f1f5e75408705f0ec014f5d2ea3d9fcc8a97817/packages/base-styles/_breakpoints.scss
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I really like the separate component that we will be then be able to share in different places. Left a few comments from our call.
Be sure to also test with ?flag=force-sympathy
in development mode to simulate loading Calypso with an empty Redux tree.
domain: PropTypes.object, | ||
isAtomic: PropTypes.bool, | ||
isLoaded: PropTypes.bool, | ||
translate: PropTypes.func.isRequired, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By convention, translate
is not included in the prop types, as it comes from the localize
HOC wrapper.
isLoaded: false, | ||
}; | ||
|
||
render() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By convention, render
is usually the last method in the component. The way I've always approached it was go from most internal to most "public" ones. So, lifecycle methods like willReceiveProps
, etc. first and then smaller render*
methods. And then finally the main render
method.
}; | ||
|
||
render() { | ||
const { domain } = this.props; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid inconsistent messaging as the domain
object is loaded, let's maybe simply show a placeholder here and return early.
static propTypes = { | ||
domain: PropTypes.object, | ||
isAtomic: PropTypes.bool, | ||
isLoaded: PropTypes.bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's maybe put a more descriptive variable name here - it's unclear what exactly "is loaded" otherwise.
|
||
class DomainMappingInstructions extends React.Component { | ||
static propTypes = { | ||
domain: PropTypes.object, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of passing in the whole domain object, maybe it'd be better to pass in only the props we need:
- domain name
- A records list
areDomainDetailsLoaded
type of prop that will probably look like! isRequestingSiteDomains && domain
- meaning, do we have the domain object and we're not waiting for a new version of it.
@@ -0,0 +1,143 @@ | |||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discusses on call, maybe let's put it in my-sites/domains/components/mapping-instructions
, since this will be shared between domain management and checkout 🙇
</div> | ||
); | ||
}; | ||
|
||
const mapStateToProps = ( state, { domain } ) => { | ||
const selectedSite = getSelectedSite( state ); | ||
return { | ||
domains: getDomainsBySiteId( state, selectedSite.ID ), | ||
isBusinessPlan: isBusiness( selectedSite.plan ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably need to add something like isRequestingSiteDomains: isRequestingSiteDomains( state, selectedSite.ID )
here from import { isRequestingSiteDomains } from 'calypso/state/sites/domains/selectors';
.
009ebf2
to
5a86e40
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! This looks almost perfect - I've just left a few nitpicks, but we're almost there ❤️
const selectedSite = getSelectedSite( state ); | ||
return { | ||
domains: getDomainsBySiteId( state, selectedSite.ID ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const selectedSite = getSelectedSite( state ); | |
return { | |
domains: getDomainsBySiteId( state, selectedSite.ID ), | |
const selectedSite = getSelectedSite( state ); | |
const domains = getDomainsBySiteId( state, selectedSite.ID ); | |
return { | |
purchasedDomain: getSelectedDomain( { domains, selectedDomainName: domain } ); |
I'd move fetching the selected domain name to here, instead of doing it inside the component.
import { getSelectedSite } from 'calypso/state/ui/selectors'; | ||
import QuerySiteDomains from 'calypso/components/data/query-site-domains'; | ||
import { getDomainsBySiteId, isRequestingSiteDomains } from 'calypso/state/sites/domains/selectors'; | ||
import DomainMappingInstructions from 'calypso/my-sites/domains/components/mapping-instructions'; | ||
|
||
const DomainMappingDetails = ( { | ||
domain, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe to avoid confusion on whether domain
is the domain object or string, you could rename it here like this:
domain, | |
domain: domainName, |
@@ -78,7 +78,7 @@ export default class PurchaseDetail extends PureComponent { | |||
|
|||
return ( | |||
<div className="purchase-detail__body"> | |||
{ this.renderPurchaseButton() } | |||
{ this.props.href && this.renderPurchaseButton() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change might not be needed or correct in fact - I can imagine a use case where onClick
is the only handler passed (like navigating to a different section in Calypso) and this change would break that behaviour.
Maybe we're misusing this component at all - instead of passing in description
, it should not be a body
?
|
||
> div:last-of-type .foldable-faq__answer { | ||
border-bottom: 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rule was conflicting with another one in mapping-instructions/style.scss
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again and all looks great! 💖
Update instrucitons to be the same as those defined in #50668. Only root domain mapping instructions were updated in this commit, and A records are still not being shown.
Moved from `my-sites/domains/domain-management/` to `my-sites/domains/components/` as the component will be shared between doman management and checkout.
…pping-instructions`
… already fetched
… details are not loaded
The removed check was redundant.
…Instructions component
13b0a98
to
9808de3
Compare
Continuing the changes done in #51031 and #50668, this PR updates the subdomain mapping instructions that are presented to users. These instructions are shown in the thank you page, after the user buys the subdomain mapping, and in the domains management page, when a subdomain isn't mapped yet. This PR presents CNAME or NS records mappings as recommended setups depending if the site is simple or AT, respectively. Alternative mapping setups (e.g. using A records) are shown as advanced setup options.
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/5639196 Hi @leonardost, could you please edit the description of this PR and add a screenshot for our translators? Ideally it'd include this string: Thank you in advance! |
Translation for this Pull Request has now been finished. |
Changes proposed in this Pull Request
In order to improve the user experience when buying domains and mappings, domain mapping instructions were updated in #50668. This PR updates the
Thank You
page, which is shown after a user buys a domain mapping, to reflect the same instructions that were changed in #50668.Depending on the type of site the mapping was bought for - root domain or sub domain, for a simple or AT site - there should be one recommended setup (usually setting name servers) and one or two alternative, more advanced, options, usually setting A or CNAME records.
Testing instructions
Both simple and atomic sites should be tested, as well as root domain mappings and subdomain mappings.
Root domain mappings instructions differ if the site is simple or atomic.
Subdomain mappings should show the following instructions: The recommended setup should be to set CNAME or NS records pointing to our name servers, and no advanced setup should be shown