From d4ab7705bf0fbc6bbd8cc08c1abacbb779726bf9 Mon Sep 17 00:00:00 2001 From: Dylan Munson <65001528+CodeyGuyDylan@users.noreply.github.com> Date: Tue, 1 Oct 2024 08:49:41 -0600 Subject: [PATCH] Update/at a glance unify connection ctas (#39585) * Unify connection notices on At A Glance * changelog * Fix nudges on settings page * Fix tests --- .../_inc/client/at-a-glance/connections.jsx | 12 +--- .../_inc/client/at-a-glance/monitor.jsx | 34 ++++++----- .../_inc/client/at-a-glance/style.scss | 34 +++++++++++ .../_inc/client/at-a-glance/test/component.js | 6 +- .../components/connect-button/index.jsx | 44 ++++++++++---- .../connect-button/test/component.js | 59 ++++++++----------- .../connect-button/test/fixtures.js | 27 +++++++++ .../update-at-a-glance-unify-connection-ctas | 4 ++ .../pages/wp-admin/jetpack-dashboard.js | 2 +- 9 files changed, 149 insertions(+), 73 deletions(-) create mode 100644 projects/plugins/jetpack/_inc/client/components/connect-button/test/fixtures.js create mode 100644 projects/plugins/jetpack/changelog/update-at-a-glance-unify-connection-ctas diff --git a/projects/plugins/jetpack/_inc/client/at-a-glance/connections.jsx b/projects/plugins/jetpack/_inc/client/at-a-glance/connections.jsx index 812d536a8e5d1..75b497f5429fa 100644 --- a/projects/plugins/jetpack/_inc/client/at-a-glance/connections.jsx +++ b/projects/plugins/jetpack/_inc/client/at-a-glance/connections.jsx @@ -71,7 +71,6 @@ export class DashConnections extends Component { ) }
- { __( 'Your site is connected to WordPress.com.', 'jetpack' ) } { this.props.isConnectionOwner && ( { __( 'You are the Jetpack owner.', 'jetpack' ) } @@ -100,7 +99,7 @@ export class DashConnections extends Component { */ userConnection() { const maybeShowLinkUnlinkBtn = this.props.isConnectionOwner ? null : ( - + ); let cardContent = ''; @@ -131,14 +130,7 @@ export class DashConnections extends Component { } if ( ! this.props.isLinked ) { - cardContent = ( -
-
- { __( 'Get the most out of Jetpack.', 'jetpack' ) } -
-
{ maybeShowLinkUnlinkBtn }
-
- ); + cardContent =
{ maybeShowLinkUnlinkBtn }
; } else if ( this.props.isFetchingUserData ) { cardContent = __( 'Loading…', 'jetpack' ); } else if ( ! this.props.wpComConnectedUser?.email ) { diff --git a/projects/plugins/jetpack/_inc/client/at-a-glance/monitor.jsx b/projects/plugins/jetpack/_inc/client/at-a-glance/monitor.jsx index 077da4c240e10..fbb2b5a1e08fd 100644 --- a/projects/plugins/jetpack/_inc/client/at-a-glance/monitor.jsx +++ b/projects/plugins/jetpack/_inc/client/at-a-glance/monitor.jsx @@ -3,9 +3,10 @@ import { createInterpolateElement } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; import Button from 'components/button'; import DashItem from 'components/dash-item'; +import JetpackBanner from 'components/jetpack-banner'; import analytics from 'lib/analytics'; import PropTypes from 'prop-types'; -import React, { Component } from 'react'; +import { Component } from 'react'; import { connect } from 'react-redux'; import { isOfflineMode, hasConnectedOwner, connectUser } from 'state/connection'; import { isModuleAvailable } from 'state/modules'; @@ -78,26 +79,29 @@ class DashMonitor extends Component { support={ support } className="jp-dash-item__is-inactive" noToggle={ ! this.props.hasConnectedOwner } + overrideContent={ + ( ! this.props.hasConnectedOwner && ! this.props.isOfflineMode && ( + + ) ) || + null + } >

{ this.props.isOfflineMode ? __( 'Unavailable in Offline Mode.', 'jetpack' ) : activateMessage }

- - { ! this.props.isOfflineMode && ! this.props.hasConnectedOwner && ( -

- { createInterpolateElement( - __( - ' account to use this feature.', - 'jetpack' - ), - { - Button: