diff --git a/_inc/client/admin.js b/_inc/client/admin.js
index 5681d9bf1d5c6..028321da28256 100644
--- a/_inc/client/admin.js
+++ b/_inc/client/admin.js
@@ -64,11 +64,9 @@ function render() {
- { __( 'Your site must be accessible by search engines for this feature to work properly. You can change this in {{a}}Reading Settings{{/a}}.', { - components: { - a: - } - } ) } -
} - ; - } - - /** - * Array of modules that directly map to a card for rendering - * @type {Array} - */ - let cards = [ - [ 'seo-tools', getModule( 'seo-tools' ).name, getModule( 'seo-tools' ).description, getModule( 'seo-tools' ).learn_more_button ], - [ 'wordads', getModule( 'wordads' ).name, getModule( 'wordads' ).description, getModule( 'wordads' ).learn_more_button ], - [ 'google-analytics', getModule( 'google-analytics' ).name, getModule( 'google-analytics' ).description, getModule( 'google-analytics' ).learn_more_button ], - [ 'stats', getModule( 'stats' ).name, getModule( 'stats' ).description, getModule( 'stats' ).learn_more_button ], - [ 'sharedaddy', getModule( 'sharedaddy' ).name, getModule( 'sharedaddy' ).description, getModule( 'sharedaddy' ).learn_more_button ], - [ 'publicize', getModule( 'publicize' ).name, getModule( 'publicize' ).description, getModule( 'publicize' ).learn_more_button ], - [ 'related-posts', getModule( 'related-posts' ).name, getModule( 'related-posts' ).description, getModule( 'related-posts' ).learn_more_button ], - [ 'likes', getModule( 'likes' ).name, getModule( 'likes' ).description, getModule( 'likes' ).learn_more_button ], - [ 'subscriptions', getModule( 'subscriptions' ).name, getModule( 'subscriptions' ).description, getModule( 'subscriptions' ).learn_more_button ], - [ 'gravatar-hovercards', getModule( 'gravatar-hovercards' ).name, getModule( 'gravatar-hovercards' ).description, getModule( 'gravatar-hovercards' ).learn_more_button ], - [ 'sitemaps', getModule( 'sitemaps' ).name, sitemapsDesc, getModule( 'sitemaps' ).learn_more_button ], - [ 'enhanced-distribution', getModule( 'enhanced-distribution' ).name, getModule( 'enhanced-distribution' ).description, getModule( 'enhanced-distribution' ).learn_more_button ], - [ 'verification-tools', getModule( 'verification-tools' ).name, getModule( 'verification-tools' ).description, getModule( 'verification-tools' ).learn_more_button ], - ], - nonAdminAvailable = [ 'publicize' ]; - // Put modules available to non-admin user at the top of the list. - if ( ! isAdmin ) { - let cardsCopy = cards.slice(); - cardsCopy.reverse().forEach( ( element ) => { - if ( includes( nonAdminAvailable, element[0] ) ) { - cards.unshift( element ); - } - } ); - cards = cards.filter( ( element, index ) => cards.indexOf( element ) === index ); - } - cards = cards.map( ( element ) => { - if ( ! includes( moduleList, element[0] ) ) { - return null; - } - - let unavailableInDevMode = props.isUnavailableInDevMode( element[0] ), - customClasses = unavailableInDevMode ? 'devmode-disabled' : '', - toggle = '', - adminAndNonAdmin = isAdmin || includes( nonAdminAvailable, element[0] ), - isPro = includes( [ 'seo-tools', 'wordads', 'google-analytics' ], element[0] ), - proProps = { - module: element[0], - configure_url: '' - }, - isModuleActive = isModuleActivated( element[0] ), - planLoaded = 'undefined' !== typeof props.sitePlan.product_slug, - hasBusiness = false, - hasPremiumOrBusiness = false, - wordAdsSubHeader = element[2]; - - hasBusiness = - planLoaded && - ( props.sitePlan.product_slug === 'jetpack_business' || - props.sitePlan.product_slug === 'jetpack_business_monthly' ); - - hasPremiumOrBusiness = - planLoaded && - ( props.sitePlan.product_slug === 'jetpack_premium' || - props.sitePlan.product_slug === 'jetpack_premium_monthly' || - props.sitePlan.product_slug === 'jetpack_business' || - props.sitePlan.product_slug === 'jetpack_business_monthly' ); - - if ( unavailableInDevMode ) { - toggle = __( 'Unavailable in Dev Mode' ); - } else if ( isAdmin ) { - if ( ( 'seo-tools' === element[0] && ! hasBusiness ) || - ( 'google-analytics' === element[0] && ! hasBusiness ) || - ( 'wordads' === element[0] && ! hasPremiumOrBusiness ) ) { - toggle ={ - __( "The Testimonial custom content type allows you to add, organize, and display your testimonials. If your theme doesn’t support it yet, you can display testimonials using the testimonial shortcode ( [testimonials] ) or you can view a full archive of your testimonials." ) + __( 'The Testimonial custom content type allows you to add, organize, and display your testimonials. If your theme doesn’t support it yet, you can display testimonials using the testimonial shortcode ( [testimonials] ) or you can view a full archive of your testimonials.' ) }
@@ -90,7 +97,7 @@ export const CustomContentTypes = moduleSettingsForm(
{
- __( "The Portfolio custom content type allows you to add, organize, and display your portfolios. If your theme doesn’t support it yet, you can display portfolios using the portfolio shortcode ( [portfolios] ) or you can view a full archive of your portfolios." )
+ __( 'The Portfolio custom content type allows you to add, organize, and display your portfolios. If your theme doesn’t support it yet, you can display portfolios using the portfolio shortcode ( [portfolios] ) or you can view a full archive of your portfolios.' )
}
@@ -105,3 +112,12 @@ export const CustomContentTypes = moduleSettingsForm(
}
} )
);
+
+export default connect(
+ ( state ) => {
+ return {
+ module: ( module_name ) => getModule( state, module_name ),
+ isModuleFound: ( module_name ) => _isModuleFound( state, module_name )
+ }
+ }
+)( CustomContentTypes );
diff --git a/_inc/client/writing/index.jsx b/_inc/client/writing/index.jsx
index 53892bf3bc5b5..831382fffc2a5 100644
--- a/_inc/client/writing/index.jsx
+++ b/_inc/client/writing/index.jsx
@@ -10,12 +10,13 @@ import { connect } from 'react-redux';
import { getModule } from 'state/modules';
import { getSettings } from 'state/settings';
import { isDevMode, isUnavailableInDevMode } from 'state/connection';
+import { isModuleFound as _isModuleFound } from 'state/search';
import QuerySite from 'components/data/query-site';
-import { Composing } from './composing';
-import { Media } from './media';
-import { CustomContentTypes } from './custom-content-types';
-import { ThemeEnhancements } from './theme-enhancements';
-import { PostByEmail } from './post-by-email';
+import Composing from './composing';
+import Media from './media';
+import CustomContentTypes from './custom-content-types';
+import ThemeEnhancements from './theme-enhancements';
+import PostByEmail from './post-by-email';
export const Writing = React.createClass( {
displayName: 'WritingSettings',
@@ -27,19 +28,34 @@ export const Writing = React.createClass( {
isDevMode: this.props.isDevMode,
isUnavailableInDevMode: this.props.isUnavailableInDevMode
};
+
+ let found = [
+ 'markdown',
+ 'after-the-deadline',
+ 'custom-content-types',
+ 'photon',
+ 'carousel',
+ 'post-by-email',
+ 'infinite-scroll',
+ 'minileven'
+ ].some( this.props.isModuleFound );
+
+ if ( ! this.props.searchTerm && ! this.props.active ) {
+ return null;
+ }
+
+ if ( ! found ) {
+ return null;
+ }
+
return (