Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 9x 9x 9x 9x 9x 9x 9x | import { currentUserCan } from '@automattic/jetpack-script-data';
import { __, sprintf } from '@wordpress/i18n';
import { Text } from '@wordpress/ui';
import clsx from 'clsx';
import useSitePurchases from '../../../data/use-site-purchases';
import { getMyJetpackWindowInitialState } from '../../../data/utils/get-my-jetpack-window-state';
import useMyJetpackConnection from '../../../hooks/use-my-jetpack-connection';
import { isHeaderControlsEnabled } from '../../header-controls/slot';
import OverviewBlogPosts from '../../overview-blog-posts';
import ProductCardsSection from '../../product-cards-section';
import OverviewSections from '../../product-cards-section/overview-sections';
import { A4AUpsell } from './a4a-upsell';
import { TypedText, useOverviewLoadAnimation } from './load-animation';
import loadAnimationStyles from './load-animation/style.module.scss';
import styles from './styles.module.scss';
import type { ReactNode } from 'react';
/**
* The Overview content component. The full-width footer band (Plans +
* Connection), when shown, lives in `OverviewFooter`, rendered by `TabContent`.
*
* @param {object} props - Component props.
* @param {ReactNode} props.beforeContent - Notices, shown below the Welcome heading.
* @return The rendered component.
*/
export function OverviewContent( { beforeContent }: { beforeContent?: ReactNode } ) {
const { overviewV1 = false } = getMyJetpackWindowInitialState( 'myJetpackFlags' );
// Loads the plans the header's plan summary shows, so they're ready when it opens.
useSitePurchases( { enabled: isHeaderControlsEnabled() } );
const { userConnectionData } = useMyJetpackConnection();
const name = userConnectionData?.currentUser?.wpcomUser?.display_name ?? '';
const { animate, onPlayed } = useOverviewLoadAnimation();
const welcome = name
? sprintf(
/* translators: %s: The display name of the current user's WordPress.com account. */
__( 'Welcome to Jetpack, %s!', 'jetpack-my-jetpack' ),
name
)
: __( 'Welcome to Jetpack', 'jetpack-my-jetpack' );
return (
<div>
<div className={ styles.products }>
{ overviewV1 ? (
<>
<div className={ styles.welcome }>
<Text variant="heading-xl" render={ <h2 /> }>
{ animate ? <TypedText text={ welcome } onTyped={ onPlayed } /> : welcome }
</Text>
</div>
{ beforeContent }
<OverviewSections className={ clsx( { [ loadAnimationStyles.sections ]: animate } ) } />
<OverviewBlogPosts />
</>
) : (
<ProductCardsSection />
) }
</div>
{ currentUserCan( 'manage_options' ) ? (
<>
<div className={ styles[ 'jetpack-manage-upsell' ] }></div>
<div className={ styles[ 'jetpack-manage-upsell' ] }>
<A4AUpsell />
</div>
</>
) : null }
</div>
);
}
|