Skip to content

Commit

Permalink
Settings: Hide the delete site notice if the site is not loaded yet
Browse files Browse the repository at this point in the history
  • Loading branch information
Tug committed Feb 2, 2016
1 parent acdea33 commit ddfa596
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
4 changes: 4 additions & 0 deletions client/components/notice/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
&.is-info {
background: $blue-wordpress;
}

&.hidden {
display: none;
}
}

.notice__icon {
Expand Down
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 ddfa596

Please sign in to comment.