Skip to content

Instantly share code, notes, and snippets.

@p-jackson
Created October 6, 2019 23:58
Show Gist options
  • Save p-jackson/1b09c98fb70b646754cda6f9460c03b3 to your computer and use it in GitHub Desktop.
Save p-jackson/1b09c98fb70b646754cda6f9460c03b3 to your computer and use it in GitHub Desktop.
diff --git a/client/my-sites/checkout/checkout/checkout-container.jsx b/client/my-sites/checkout/checkout/checkout-container.jsx
index 3f03dbf5ca..c5a68b0101 100644
--- a/client/my-sites/checkout/checkout/checkout-container.jsx
+++ b/client/my-sites/checkout/checkout/checkout-container.jsx
@@ -35,13 +35,10 @@ function isSiteCreatedDateNew( createdAt, creationWindowInMinutes = 5 ) {
class CheckoutContainer extends React.Component {
state = {
headerText: '',
- shouldDisplaySiteCreatedNotice:
- this.props.isComingFromSignup &&
- isSiteCreatedDateNew( get( this.props, 'selectedSite.options.created_at', '' ) ),
};
componentDidMount() {
- if ( this.state.shouldDisplaySiteCreatedNotice ) {
+ if ( this.shouldDisplaySiteCreatedNotice() ) {
this.setHeaderText(
this.props.translate(
'Your WordPress.com site is ready! Finish your purchase to get the most out of it.'
@@ -50,6 +47,14 @@ class CheckoutContainer extends React.Component {
}
}
+ shouldDisplaySiteCreatedNotice() {
+ return (
+ this.props.isComingFromSignup &&
+ this.props.selectedSite &&
+ isSiteCreatedDateNew( get( this.props, 'selectedSite.options.created_at', '' ) )
+ );
+ }
+
renderCheckoutHeader() {
return this.state.headerText && <FormattedHeader headerText={ this.state.headerText } />;
}
@@ -74,7 +79,7 @@ class CheckoutContainer extends React.Component {
return (
<>
{ this.renderCheckoutHeader() }
- { this.state.shouldDisplaySiteCreatedNotice && (
+ { this.shouldDisplaySiteCreatedNotice() && (
<TransactionData>
<SignupSiteCreatedNotice selectedSite={ this.props.selectedSite } />
</TransactionData>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment