Skip to content

Commit

Permalink
add private sites module
Browse files Browse the repository at this point in the history
  • Loading branch information
scruffian committed Oct 16, 2018
1 parent 08d3ac7 commit c7139f9
Show file tree
Hide file tree
Showing 7 changed files with 1,387 additions and 235 deletions.
1 change: 1 addition & 0 deletions _inc/client/lib/plans/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const FEATURE_SEO_TOOLS_JETPACK = 'seo-tools-jetpack';
export const FEATURE_WORDADS_JETPACK = 'wordads-jetpack';
export const FEATURE_GOOGLE_ANALYTICS_JETPACK = 'google-analytics-jetpack';
export const FEATURE_SEARCH_JETPACK = 'search-jetpack';
export const FEATURE_PRIVATE_JETPACK = 'private-jetpack';

export function isMonthly( plan ) {
return includes( JETPACK_MONTHLY_PLANS, plan );
Expand Down
10 changes: 10 additions & 0 deletions _inc/client/traffic/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import QuerySite from 'components/data/query-site';
import { SEO } from './seo';
import { GoogleAnalytics } from './google-analytics';
import { Ads } from './ads';
import Private from './private';
import { SiteStats } from './site-stats';
import { RelatedPosts } from './related-posts';
import Search from './search';
Expand Down Expand Up @@ -42,6 +43,7 @@ export class Traffic extends React.Component {
foundVerification = this.props.isModuleFound( 'verification-tools' ),
foundSitemaps = this.props.isModuleFound( 'sitemaps' ),
foundSearch = this.props.isModuleFound( 'search' ),
foundPrivateSites = this.props.isModuleFound( 'private' ),
foundAnalytics = this.props.isModuleFound( 'google-analytics' );

if ( ! this.props.searchTerm && ! this.props.active ) {
Expand All @@ -56,6 +58,7 @@ export class Traffic extends React.Component {
! foundVerification &&
! foundSitemaps &&
! foundAnalytics &&
! foundPrivateSites &&
! foundSearch
) {
return null;
Expand All @@ -64,6 +67,13 @@ export class Traffic extends React.Component {
return (
<div>
<QuerySite />
{
foundPrivateSites && (
<Private
{ ...commonProps }
/>
)
}
{
foundSearch && (
<Search
Expand Down
59 changes: 59 additions & 0 deletions _inc/client/traffic/private.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/**
* External dependencies
*/
import React from 'react';
import { translate as __ } from 'i18n-calypso';

/**
* Internal dependencies
*/
import { FEATURE_PRIVATE_JETPACK } from 'lib/plans/constants';
import { ModuleSettingsForm as moduleSettingsForm } from 'components/module-settings/module-settings-form';
import { ModuleToggle } from 'components/module-toggle';
import SettingsCard from 'components/settings-card';
import SettingsGroup from 'components/settings-group';
import { FormFieldset } from 'components/forms';

class Private extends React.Component {
render() {
const module_enabled = this.props.getOptionValue( 'private' );
return (
<SettingsCard
{ ...this.props }
module="private"
feature={ FEATURE_PRIVATE_JETPACK }
hideButton
>
<SettingsGroup
hasChild
module={ { module: 'private' } }
support={ {
text: __( 'Jetpack private sites' ),
link: 'https://jetpack.com/support/private',
} }>
<p>{ __( 'Private sites can only be seen by you and users your approve.' ) } </p>

<ModuleToggle
slug="private"
compact
activated={ module_enabled }
toggling={ this.props.isSavingAnyOption( 'private' ) }
toggleModule={ this.props.toggleModuleNow }>
{ __( 'Make your site private' ) }
</ModuleToggle>

{ module_enabled && (
<FormFieldset>
<p className="jp-form-setting-explanation">
{ __( 'Your site is only visible to you and users you approve.' ) }
</p>
</FormFieldset>
) }
</SettingsGroup>
</SettingsCard>
);
}
}

export default moduleSettingsForm( Private );

Loading

0 comments on commit c7139f9

Please sign in to comment.