Skip to content

Commit 4641a1b

Browse files
committed
PoC
1 parent 32c27e3 commit 4641a1b

File tree

13 files changed

+109
-36
lines changed

13 files changed

+109
-36
lines changed

client/hosting/overview/controller.tsx

+20-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import i18n from 'i18n-calypso';
44
import HostingActivate from 'calypso/hosting/server-settings/hosting-activate';
55
import Hosting from 'calypso/hosting/server-settings/main';
66
import PageViewTracker from 'calypso/lib/analytics/page-view-tracker';
7+
import { PanelWithSidebar } from 'calypso/sites/components/panel-sidebar';
78
import HostingOverview from 'calypso/sites/overview/components/hosting-overview';
9+
import { SettingsSidebar } from 'calypso/sites/settings/controller';
810
import { successNotice } from 'calypso/state/notices/actions';
911

1012
export function hostingOverview( context: PageJSContext, next: () => void ) {
@@ -32,7 +34,15 @@ export function hostingConfiguration( context: PageJSContext, next: () => void )
3234
removeQueryArgs( window.location.href, 'hosting_features' )
3335
);
3436
}
35-
context.primary = (
37+
const isDuplicateViewsExperiment = true;
38+
context.primary = isDuplicateViewsExperiment ? (
39+
<PanelWithSidebar>
40+
<SettingsSidebar />
41+
<div className="hosting-configuration">
42+
<Hosting />
43+
</div>
44+
</PanelWithSidebar>
45+
) : (
3646
<div className="hosting-configuration">
3747
<Hosting />
3848
</div>
@@ -41,7 +51,15 @@ export function hostingConfiguration( context: PageJSContext, next: () => void )
4151
}
4252

4353
export function hostingActivate( context: PageJSContext, next: () => void ) {
44-
context.primary = (
54+
const isDuplicateViewsExperiment = true;
55+
context.primary = isDuplicateViewsExperiment ? (
56+
<PanelWithSidebar>
57+
<SettingsSidebar />
58+
<div className="hosting-configuration">
59+
<HostingActivate />
60+
</div>
61+
</PanelWithSidebar>
62+
) : (
4563
<div className="hosting-configuration">
4664
<HostingActivate />
4765
</div>

client/hosting/server-settings/main.tsx

+7-3
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ const ServerSettings = ( { fetchUpdatedData }: ServerSettingsProps ) => {
240240
);
241241

242242
const getPageTitle = () => {
243-
return translate( 'Server Settings' );
243+
return translate( 'Server settings' );
244244
};
245245

246246
const getUpgradeBanner = () => {
@@ -280,13 +280,17 @@ const ServerSettings = ( { fetchUpdatedData }: ServerSettingsProps ) => {
280280

281281
const getContent = () => {
282282
const WrapperComponent = ! isSiteAtomic ? FeatureExample : Fragment;
283+
const isDuplicateViewsExperiment = true;
284+
const Inner = isDuplicateViewsExperiment
285+
? ( { children }: { children: React.ReactNode } ) => <div>{ children }</div>
286+
: MasonryGrid;
283287

284288
return (
285289
<>
286290
{ isSiteAtomic && <QuerySites siteId={ siteId } /> }
287291
{ isJetpack && siteId && <QueryJetpackModules siteId={ siteId } /> }
288292
<WrapperComponent>
289-
<MasonryGrid>
293+
<Inner>
290294
<AllCards
291295
isAdvancedHostingDisabled={ ! hasSftpFeature || ! isSiteAtomic }
292296
isBasicHostingDisabled={ ! hasAtomicFeature || ! isSiteAtomic }
@@ -295,7 +299,7 @@ const ServerSettings = ( { fetchUpdatedData }: ServerSettingsProps ) => {
295299
siteSlug={ siteSlug }
296300
isJetpack={ isJetpack }
297301
/>
298-
</MasonryGrid>
302+
</Inner>
299303
</WrapperComponent>
300304
</>
301305
);

client/my-sites/site-settings/form-general.jsx

+5-1
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,8 @@ export class SiteSettingsFormGeneral extends Component {
391391
return null;
392392
}
393393

394+
const isDuplicateViewsExperiment = true;
395+
394396
return (
395397
<div className={ clsx( classes ) }>
396398
{ site && <QuerySiteSettings siteId={ site.ID } /> }
@@ -418,7 +420,9 @@ export class SiteSettingsFormGeneral extends Component {
418420
</Card>
419421
</>
420422
) }
421-
{ ! isEnabled( 'untangling/hosting-menu' ) && <SiteSettingsForm { ...this.props } /> }
423+
{ ! ( isEnabled( 'untangling/hosting-menu' ) || isDuplicateViewsExperiment ) && (
424+
<SiteSettingsForm { ...this.props } />
425+
) }
422426
{ ! isDevelopmentSite && this.renderAdminInterface() }
423427
</div>
424428
);

client/my-sites/site-settings/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ export default function () {
5555
return page.redirect( redirectPath );
5656
} );
5757

58-
if ( isEnabled( 'untangling/hosting-menu' ) ) {
58+
const isDuplicateViewsExperiment = true;
59+
if ( isEnabled( 'untangling/hosting-menu' ) || isDuplicateViewsExperiment ) {
5960
page( '/settings/delete-site/:site', ( context ) => {
6061
page.redirect( `/sites/settings/administration/${ context.params.site }/delete-site` );
6162
} );
@@ -90,7 +91,7 @@ export default function () {
9091
clientRender
9192
);
9293

93-
if ( isEnabled( 'untangling/hosting-menu' ) ) {
94+
if ( isEnabled( 'untangling/hosting-menu' ) || true ) {
9495
page( '/settings/start-over/:site', ( context ) => {
9596
page.redirect( `/sites/settings/administration/${ context.params.site }/reset-site` );
9697
} );
@@ -117,7 +118,7 @@ export default function () {
117118
clientRender
118119
);
119120

120-
if ( isEnabled( 'untangling/hosting-menu' ) ) {
121+
if ( isEnabled( 'untangling/hosting-menu' ) || true ) {
121122
page( '/settings/start-site-transfer/:site', ( context ) => {
122123
page.redirect( `/sites/settings/administration/${ context.params.site }/transfer-site` );
123124
} );

client/my-sites/site-settings/section-general.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@ import { getSelectedSite, getSelectedSiteId } from 'calypso/state/ui/selectors';
1212
import P2PreapprovedDomainsForm from './settings-p2/preapproved-domains';
1313
import { SOURCE_SETTINGS_GENERAL } from './site-tools/utils';
1414

15+
const isDuplicateViewsExperiment = true;
1516
const SiteSettingsGeneral = ( { site, isWPForTeamsSite, isP2Hub, isWpcomStagingSite } ) => (
1617
<div className="site-settings__main general-settings">
1718
{ site && <GeneralForm site={ site } /> }
1819
{ isWPForTeamsSite && isP2Hub && <P2PreapprovedDomainsForm siteId={ site?.ID } /> }
1920
{ ! isWpcomStagingSite && ! isEnabled( 'untangling/hosting-menu' ) && (
2021
<SiteTools headerTitle={ translate( 'Site tools' ) } source={ SOURCE_SETTINGS_GENERAL } />
2122
) }
22-
{ isEnabled( 'untangling/hosting-menu' ) && site && (
23+
{ ( isEnabled( 'untangling/hosting-menu' ) || isDuplicateViewsExperiment ) && site && (
2324
<Notice
2425
showDismiss={ false }
2526
status="is-info"

client/my-sites/site-settings/settings-controller.js

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export function siteSettings( context, next ) {
4747
}
4848

4949
if ( isEnabled( 'untangling/hosting-menu' ) ) {
50+
// TODO: Why only Classic Admin Interface?
5051
if ( isAdminInterfaceWPAdmin( state, siteId ) ) {
5152
return page.redirect( `/sites/settings/site/${ siteSlug }` );
5253
}

client/my-sites/site-settings/site-admin-interface/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ const SiteAdminInterface = ( { siteId, siteSlug, isHosting = false } ) => {
180180
href={
181181
adminInterface === 'wp-admin'
182182
? `${ siteAdminUrl }options-general.php`
183-
: `/settings/general/${ siteSlug }#admin-interface-style`
183+
: // TODO:
184+
`/settings/general/${ siteSlug }#admin-interface-style`
184185
}
185186
rel="noreferrer"
186187
/>

client/my-sites/site-settings/sitemaps.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class Sitemaps extends Component {
8282

8383
renderNonPublicExplanation() {
8484
const { siteSlug, translate } = this.props;
85-
85+
const isDuplicateViewsExperiment = true;
8686
return (
8787
<FormSettingExplanation>
8888
{ translate(
@@ -93,7 +93,7 @@ class Sitemaps extends Component {
9393
a: (
9494
<a
9595
href={
96-
isEnabled( 'untangling/hosting-menu' )
96+
isEnabled( 'untangling/hosting-menu' ) || isDuplicateViewsExperiment
9797
? '/sites/settings/site/' + siteSlug
9898
: '/settings/general/' + siteSlug
9999
}

client/sites/components/site-preview-pane/dotcom-preview-pane.tsx

+21-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import config from '@automattic/calypso-config';
22
import { useHasEnTranslation } from '@automattic/i18n-utils';
33
import { SiteExcerptData } from '@automattic/sites';
44
import { useI18n } from '@wordpress/react-i18n';
5-
import React, { useMemo, useEffect } from 'react';
5+
import React, { useMemo, useEffect, useState } from 'react';
66
import ItemView from 'calypso/layout/hosting-dashboard/item-view';
7+
import { loadExperimentAssignment } from 'calypso/lib/explat';
78
import HostingFeaturesIcon from 'calypso/sites/hosting-features/components/hosting-features-icon';
89
import { areHostingFeaturesSupported } from 'calypso/sites/hosting-features/features';
910
import { useStagingSite } from 'calypso/sites/tools/staging-site/hooks/use-staging-site';
@@ -81,6 +82,18 @@ const DotcomPreviewPane = ( {
8182
const isPlanExpired = !! site.plan?.expired;
8283
const isMigrationPending = getMigrationStatus( site ) === 'pending';
8384

85+
const [ isDuplicateViewsExperiment, setIsDuplicateViewsExperiment ] = useState( false );
86+
useEffect( () => {
87+
const experimentName = 'calypso_post_onboarding_holdout_160125';
88+
( async () => {
89+
const duplicateViewsExperimentAssignment = await loadExperimentAssignment( experimentName );
90+
if ( duplicateViewsExperimentAssignment.variationName === 'treatment' ) {
91+
console.log( 'You are in the duplicate views experiment' );
92+
setIsDuplicateViewsExperiment( true );
93+
}
94+
} )();
95+
}, [] );
96+
8497
const features: FeaturePreviewInterface[] = useMemo( () => {
8598
const isActiveAtomicSite = isAtomicSite && ! isPlanExpired;
8699
const siteFeatures = [
@@ -168,8 +181,8 @@ const DotcomPreviewPane = ( {
168181
featureIds: [ TOOLS ],
169182
},
170183
{
171-
label: __( 'Settings' ),
172-
enabled: config.isEnabled( 'untangling/hosting-menu' ),
184+
label: __( 'Site Settings' ),
185+
enabled: config.isEnabled( 'untangling/hosting-menu' ) || isDuplicateViewsExperiment,
173186
featureIds: [
174187
SETTINGS_SITE,
175188
SETTINGS_ADMINISTRATION,
@@ -178,13 +191,17 @@ const DotcomPreviewPane = ( {
178191
SETTINGS_ADMINISTRATION_DELETE_SITE,
179192
SETTINGS_CACHING,
180193
SETTINGS_WEB_SERVER,
194+
...[ isDuplicateViewsExperiment ? DOTCOM_HOSTING_CONFIG : null ],
181195
],
182196
},
183197
{
184198
label: hasEnTranslation( 'Server Settings' )
185199
? __( 'Server Settings' )
186200
: __( 'Server Config' ),
187-
enabled: isActiveAtomicSite && ! config.isEnabled( 'untangling/hosting-menu' ),
201+
enabled:
202+
! isDuplicateViewsExperiment &&
203+
isActiveAtomicSite &&
204+
! config.isEnabled( 'untangling/hosting-menu' ),
188205
featureIds: [ DOTCOM_HOSTING_CONFIG ],
189206
},
190207
];

client/sites/settings/caching/form.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -109,17 +109,19 @@ export default function CachingForm( { disabled }: CachingFormProps ) {
109109
dispatch( clearWordPressCache( siteId, 'Manually clearing again.' ) );
110110
};
111111

112+
const isDuplicateViewsExperiment = true;
112113
const edgeCacheToggleDescription = isEdgeCacheEligible
113114
? translate( 'Enable global edge caching for faster content delivery.' )
114115
: translate(
115116
'Global edge cache can only be enabled for public sites. {{a}}Review privacy settings{{/a}}',
116117
{
117118
components: {
118-
a: config.isEnabled( 'untangling/hosting-menu' ) ? (
119-
<a href={ '/sites/settings/site/' + siteSlug } />
120-
) : (
121-
<a href={ '/settings/general/' + siteSlug + '#site-privacy-settings' } />
122-
),
119+
a:
120+
config.isEnabled( 'untangling/hosting-menu' ) || isDuplicateViewsExperiment ? (
121+
<a href={ '/sites/settings/site/' + siteSlug } />
122+
) : (
123+
<a href={ '/settings/general/' + siteSlug + '#site-privacy-settings' } />
124+
),
123125
},
124126
}
125127
);

client/sites/settings/controller.tsx

+19-11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import config from '@automattic/calypso-config';
12
import { __ } from '@wordpress/i18n';
23
import { useSelector } from 'react-redux';
34
import PageViewTracker from 'calypso/lib/analytics/page-view-tracker';
@@ -21,17 +22,24 @@ export function SettingsSidebar() {
2122

2223
return (
2324
<Sidebar>
24-
<SidebarItem href={ `/sites/settings/site/${ slug }` }>{ __( 'Site' ) }</SidebarItem>
25-
<SidebarItem
26-
enabled={ shouldShowAdministration }
27-
href={ `/sites/settings/administration/${ slug }` }
28-
>
29-
{ __( 'Administration' ) }
30-
</SidebarItem>
31-
<SidebarItem href={ `/sites/settings/caching/${ slug }` }>{ __( 'Caching' ) }</SidebarItem>
32-
<SidebarItem href={ `/sites/settings/web-server/${ slug }` }>
33-
{ __( 'Web server' ) }
34-
</SidebarItem>
25+
<SidebarItem href={ `/sites/settings/site/${ slug }` }>{ __( 'General' ) }</SidebarItem>
26+
<SidebarItem href={ `/hosting-config/${ slug }` }>{ __( 'Server' ) }</SidebarItem>
27+
{ config.isEnabled( 'untangling/hosting-menu' ) && (
28+
<>
29+
<SidebarItem
30+
enabled={ shouldShowAdministration }
31+
href={ `/sites/settings/administration/${ slug }` }
32+
>
33+
{ __( 'Administration' ) }
34+
</SidebarItem>
35+
<SidebarItem href={ `/sites/settings/caching/${ slug }` }>
36+
{ __( 'Caching' ) }
37+
</SidebarItem>
38+
<SidebarItem href={ `/sites/settings/web-server/${ slug }` }>
39+
{ __( 'Web server' ) }
40+
</SidebarItem>
41+
</>
42+
) }
3543
</Sidebar>
3644
);
3745
}

client/sites/settings/site/index.tsx

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import { useTranslate } from 'i18n-calypso';
2+
import QuerySitePurchases from 'calypso/components/data/query-site-purchases';
23
import NavigationHeader from 'calypso/components/navigation-header';
4+
import Notice from 'calypso/components/notice';
35
import { Panel } from 'calypso/components/panel';
6+
import { SOURCE_SETTINGS_ADMINISTRATION } from 'calypso/my-sites/site-settings/site-tools/utils';
47
import wrapSettingsForm from 'calypso/my-sites/site-settings/wrap-settings-form';
8+
import AdministrationTools from 'calypso/sites/settings/administration/tools';
59
import { useSelector } from 'calypso/state';
610
import isAtomicSite from 'calypso/state/selectors/is-site-automated-transfer';
711
import isSiteWpcomStaging from 'calypso/state/selectors/is-site-wpcom-staging';
812
import getIsUnlaunchedSite from 'calypso/state/selectors/is-unlaunched-site';
913
import { useSelectedSiteSelector } from 'calypso/state/sites/hooks';
1014
import { getSiteOption, isJetpackSite, isWpcomSite } from 'calypso/state/sites/selectors';
11-
import { getSelectedSite } from 'calypso/state/ui/selectors';
15+
import { getSelectedSite, getSelectedSiteId } from 'calypso/state/ui/selectors';
1216
import SiteSettingsForm from './form';
1317

1418
import './style.scss';
@@ -17,6 +21,7 @@ import './style.scss';
1721
export function SiteSettings( props: any ) {
1822
const translate = useTranslate();
1923
const site = useSelector( getSelectedSite );
24+
const siteId = useSelector( getSelectedSiteId );
2025
const siteIsJetpack = useSelectedSiteSelector( isJetpackSite );
2126
const isUnlaunchedSite = useSelectedSiteSelector( getIsUnlaunchedSite );
2227
const editingToolkitIsActive = useSelectedSiteSelector(
@@ -40,10 +45,20 @@ export function SiteSettings( props: any ) {
4045
return (
4146
<Panel className="settings-site">
4247
<NavigationHeader
43-
title={ translate( 'Site' ) }
48+
title={ translate( 'General settings' ) }
4449
subtitle={ translate( 'Manage your site settings, including site visibility, and more.' ) }
4550
/>
4651
<SiteSettingsForm { ...props } { ...additionalProps } />
52+
{ ! isWpcomStagingSite ? (
53+
<>
54+
<QuerySitePurchases siteId={ siteId } />
55+
<AdministrationTools source={ SOURCE_SETTINGS_ADMINISTRATION } />
56+
</>
57+
) : (
58+
<Notice showDismiss={ false } status="is-warning">
59+
{ translate( 'This setting is not supported for staging sites.' ) }
60+
</Notice>
61+
) }
4762
</Panel>
4863
);
4964
}

client/sites/settings/utils.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { isEnabled } from '@automattic/calypso-config';
22

33
export function isHostingMenuUntangled() {
4+
const isDuplicateViewsExperiment = true;
45
return (
5-
isEnabled( 'untangling/hosting-menu' ) &&
6+
( isEnabled( 'untangling/hosting-menu' ) || isDuplicateViewsExperiment ) &&
67
window?.location?.pathname?.startsWith( '/sites/settings' )
78
);
89
}

0 commit comments

Comments
 (0)