Skip to content

Commit

Permalink
Merge pull request #2983 from Automattic/fix/delete-site-notice-display
Browse files Browse the repository at this point in the history
Site Settings: Hide the delete site notice if the site is not loaded yet
  • Loading branch information
Tug committed Feb 3, 2016
2 parents c58c84e + 01fef7c commit cda0e11
Showing 1 changed file with 23 additions and 11 deletions.
34 changes: 23 additions & 11 deletions client/my-sites/site-settings/delete-site/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var HeaderCake = require( 'components/header-cake' ),
Button = require( 'components/button' ),
Dialog = require( 'components/dialog' ),
config = require( 'config' ),
Gridicon = require ( 'components/gridicon' ),
Gridicon = require( 'components/gridicon' ),
SiteListActions = require( 'lib/sites-list/actions' );

module.exports = React.createClass( {
Expand All @@ -45,6 +45,27 @@ module.exports = React.createClass( {
this.props.sites.off( 'change', this._updateSite );
},

renderNotice: function() {
var site = this.state.site;

if ( ! site ) {
return null;
}

return (
<Notice status="is-warning" showDismiss={ false }>
{ this.translate( '{{strong}}%(domain)s{{/strong}} will be unavailable in the future.', {
components: {
strong: <strong />
},
args: {
domain: site.domain
}
} ) }
</Notice>
);
},

render: function() {
var site = this.state.site,
adminURL = site.options && site.options.admin_url ? site.options.admin_url : '',
Expand Down Expand Up @@ -113,16 +134,7 @@ module.exports = React.createClass( {
<ActionPanel>
<ActionPanelTitle>{ strings.deleteSite }</ActionPanelTitle>
<ActionPanelBody>
<Notice status="is-warning" showDismiss={ false }>
{ this.translate( '{{strong}}%(domain)s{{/strong}} will be unavailable in the future.', {
components: {
strong: <strong />
},
args: {
domain: site.domain
}
} ) }
</Notice>
{ this.renderNotice() }
<ActionPanelFigure>
<h3 className="delete-site__content-list-header">{ this.translate( 'These items will be deleted' ) }</h3>
<ul className="delete-site__content-list">
Expand Down

0 comments on commit cda0e11

Please sign in to comment.