Skip to content

Commit

Permalink
Create new launchpad only home structure (#98476)
Browse files Browse the repository at this point in the history
* Create new launchpad only home structure

* Rename feature flag

* Allow dismissing the full-screen Launchpad in My Home

---------

Co-authored-by: Luis Felipe Zaguini <[email protected]>
  • Loading branch information
candy02058912 and zaguiini authored Jan 17, 2025
1 parent d7fb6bd commit 02eb91b
Show file tree
Hide file tree
Showing 20 changed files with 70 additions and 43 deletions.
1 change: 1 addition & 0 deletions client/assets/stylesheets/shared/mixins/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@import "clear-text";
@import "dropdown-menu";
@import "elevation";
@import "grid-mixins";
@import "heading";
@import "hide-content-accessibly";
@import "long-content-fade";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@import "@wordpress/base-styles/breakpoints";
@import "@wordpress/base-styles/mixins";
@import "../../../grid-mixins";

.site-setup-list {
&.card {
Expand Down
16 changes: 16 additions & 0 deletions client/my-sites/customer-home/components/full-screen-launchpad.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { Button } from '@wordpress/components';
import { useI18n } from '@wordpress/react-i18n';
import LaunchpadPreLaunch from '../cards/launchpad/pre-launch';

export const FullScreenLaunchpad = ( { onClose }: { onClose: () => void } ) => {
const { __ } = useI18n();

return (
<div css={ { display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '24px' } }>
<div css={ { width: '100%' } }>
<LaunchpadPreLaunch />
</div>
<Button onClick={ onClose }>{ __( 'Hide onboarding setup' ) }</Button>
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@ import { useEffect, useState } from 'react';
import { connect, useSelector } from 'react-redux';
import SiteIcon from 'calypso/blocks/site-icon';
import AsyncLoad from 'calypso/components/async-load';
import DocumentHead from 'calypso/components/data/document-head';
import EmptyContent from 'calypso/components/empty-content';
import { JetpackConnectionHealthBanner } from 'calypso/components/jetpack/connection-health';
import Main from 'calypso/components/main';
import NavigationHeader from 'calypso/components/navigation-header';
import Notice from 'calypso/components/notice';
import NoticeAction from 'calypso/components/notice/notice-action';
import useDomainDiagnosticsQuery from 'calypso/data/domains/diagnostics/use-domain-diagnostics-query';
import { useGetDomainsQuery } from 'calypso/data/domains/use-get-domains-query';
import useHomeLayoutQuery, { getCacheKey } from 'calypso/data/home/use-home-layout-query';
import PageViewTracker from 'calypso/lib/analytics/page-view-tracker';
import TrackComponentView from 'calypso/lib/analytics/track-component-view';
import { setDomainNotice } from 'calypso/lib/domains/set-domain-notice';
import { preventWidows } from 'calypso/lib/formatting';
Expand Down Expand Up @@ -50,11 +47,11 @@ import {
} from 'calypso/state/sites/selectors';
import isJetpackSite from 'calypso/state/sites/selectors/is-jetpack-site';
import { getSelectedSite, getSelectedSiteId } from 'calypso/state/ui/selectors';
import CelebrateLaunchModal from './components/celebrate-launch-modal';
import CelebrateLaunchModal from '../celebrate-launch-modal';

import './style.scss';

const Home = ( {
const HomeContent = ( {
canUserUseCustomerHome,
hasWooCommerceInstalled,
isJetpack,
Expand Down Expand Up @@ -291,9 +288,7 @@ const Home = ( {
};

return (
<Main wideLayout className="customer-home__main">
<PageViewTracker path="/home/:site" title={ translate( 'My Home' ) } />
<DocumentHead title={ translate( 'My Home' ) } />
<div className="customer-home__main">
{ siteId && isJetpack && isPossibleJetpackConnectionProblem && (
<JetpackConnectionHealthBanner siteId={ siteId } />
) }
Expand Down Expand Up @@ -338,7 +333,7 @@ const Home = ( {
/>
) }
<AsyncLoad require="calypso/lib/analytics/track-resurrections" placeholder={ null } />
</Main>
</div>
);
};

Expand Down Expand Up @@ -396,6 +391,8 @@ const mergeProps = ( stateProps, dispatchProps, ownProps ) => {
};
};

const connectHome = connect( mapStateToProps, mapDispatchToProps, mergeProps );

export default connectHome( withJetpackConnectionProblem( Home ) );
export default connect(
mapStateToProps,
mapDispatchToProps,
mergeProps
)( withJetpackConnectionProblem( HomeContent ) );
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "./grid-mixins";
@import "@wordpress/base-styles/breakpoints";
@import "@wordpress/base-styles/mixins";

Expand Down
3 changes: 1 addition & 2 deletions client/my-sites/customer-home/controller.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
import { redirectToLaunchpad } from 'calypso/utils';
import CustomerHome from './main';

export default async function ( context, next ) {
export default async function renderHome( context, next ) {
const state = await context.store.getState();
const siteId = getSelectedSiteId( state );

Expand All @@ -28,7 +28,6 @@ export default async function ( context, next ) {
}

context.primary = <CustomerHome key={ siteId } />;

next();
}

Expand Down
12 changes: 10 additions & 2 deletions client/my-sites/customer-home/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import page from '@automattic/calypso-router';
import { makeLayout, render as clientRender } from 'calypso/controller';
import { navigation, siteSelection, sites } from 'calypso/my-sites/controller';
import home, { maybeRedirect } from './controller';
import renderHome, { maybeRedirect } from './controller';

export default function () {
page( '/home', siteSelection, sites, makeLayout, clientRender );

page( '/home/:siteId', siteSelection, maybeRedirect, navigation, home, makeLayout, clientRender );
page(
'/home/:siteId',
siteSelection,
maybeRedirect,
navigation,
renderHome,
makeLayout,
clientRender
);
}
28 changes: 28 additions & 0 deletions client/my-sites/customer-home/main.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import config from '@automattic/calypso-config';
import { useTranslate } from 'i18n-calypso';
import { useState } from 'react';
import DocumentHead from 'calypso/components/data/document-head';
import Main from 'calypso/components/main';
import PageViewTracker from 'calypso/lib/analytics/page-view-tracker';
import { FullScreenLaunchpad } from './components/full-screen-launchpad';
import HomeContent from './components/home-content';

export default function CustomerHome() {
const [ isShowingLaunchpad, setIsShowingLaunchpad ] = useState(
config.isEnabled( 'home/launchpad-first' )
);

const translate = useTranslate();

return (
<Main wideLayout>
<PageViewTracker path="/home/:site" title={ translate( 'My Home' ) } />
<DocumentHead title={ translate( 'My Home' ) } />
{ isShowingLaunchpad ? (
<FullScreenLaunchpad onClose={ () => setIsShowingLaunchpad( false ) } />
) : (
<HomeContent />
) }
</Main>
);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "../../../customer-home/grid-mixins";
@import "@wordpress/base-styles/mixins";
@import "@wordpress/base-styles/breakpoints";
@import "@wordpress/base-styles/colors";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "../../../../customer-home/grid-mixins";
@import "@automattic/onboarding/styles/mixins";
@import "@automattic/typography/styles/variables";
@import "@wordpress/base-styles/breakpoints";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@import "../../../../customer-home/grid-mixins";
@import "@automattic/onboarding/styles/mixins";
@import "@automattic/typography/styles/variables";
@import "@wordpress/base-styles/breakpoints";
Expand Down
20 changes: 0 additions & 20 deletions client/my-sites/plugins/grid-mixins.scss

This file was deleted.

1 change: 0 additions & 1 deletion client/my-sites/plugins/style-compatibilty.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@import "@wordpress/base-styles/breakpoints";
@import "@wordpress/base-styles/mixins";
@import "./grid-mixins";

body.is-section-plugins .plugin-management-wrapper {
@include break-small {
Expand Down
1 change: 0 additions & 1 deletion client/my-sites/plugins/style.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@import "@wordpress/base-styles/breakpoints";
@import "@wordpress/base-styles/mixins";
@import "./grid-mixins";
@import "./woocommerce-box";

.is-section-plugins .main {
Expand Down
1 change: 1 addition & 0 deletions config/development.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"global-styles/on-personal-plan": false,
"help": true,
"help/gpt-response": true,
"home/launchpad-first": false,
"home/layout-dev": true,
"hosting-server-settings-enhancements": true,
"hosting/datacenter-picker": true,
Expand Down
1 change: 1 addition & 0 deletions config/horizon.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"google-my-business": false,
"global-styles/on-personal-plan": false,
"help": true,
"home/launchpad-first": false,
"home/layout-dev": true,
"hosting-server-settings-enhancements": true,
"i18n/empathy-mode": false,
Expand Down
1 change: 1 addition & 0 deletions config/production.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"global-styles/on-personal-plan": false,
"help": true,
"help/gpt-response": true,
"home/launchpad-first": false,
"hosting-server-settings-enhancements": true,
"i18n/empathy-mode": false,
"i18n/translation-scanner": true,
Expand Down
1 change: 1 addition & 0 deletions config/stage.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"global-styles/on-personal-plan": false,
"help": true,
"help/gpt-response": true,
"home/launchpad-first": false,
"hosting-server-settings-enhancements": true,
"i18n/empathy-mode": true,
"importer/site-backups": true,
Expand Down
1 change: 1 addition & 0 deletions config/wpcalypso.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"global-styles/on-personal-plan": false,
"help": true,
"help/gpt-response": true,
"home/launchpad-first": false,
"home/layout-dev": true,
"hosting/datacenter-picker": true,
"hosting-server-settings-enhancements": true,
Expand Down

0 comments on commit 02eb91b

Please sign in to comment.