From c7e59db7c18a54195f92bc711a3dacc4178e89a9 Mon Sep 17 00:00:00 2001 From: Christian Gastrell Date: Mon, 7 Sep 2026 18:36:32 -0300 Subject: [PATCH 1/2] Jetpack: remove the unreachable "manage" branch from DashItem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `DashItem` carries a branch for `module="manage"` that swaps the module toggle for either an "Updates needed" badge or an "Active" label. Nothing has passed that module since manage stopped being one — the file's own comment says so — and the only caller left is the test fixture. The two dynamic call sites, `backups.jsx` and `scan.jsx`, take `props.feature`, and the sole `feature=` in At a Glance is `jetpack_videopress`. Removing it also retires the component's last `SimpleNotice` import. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01NfGbCrDbhYmgwY5hW68VLA --- .../client/components/dash-item/index.jsx | 31 +------------ .../components/dash-item/test/component.jsx | 44 ------------------- .../changelog/remove-dash-item-manage-branch | 5 +++ 3 files changed, 7 insertions(+), 73 deletions(-) create mode 100644 projects/plugins/jetpack/changelog/remove-dash-item-manage-branch diff --git a/projects/plugins/jetpack/_inc/client/components/dash-item/index.jsx b/projects/plugins/jetpack/_inc/client/components/dash-item/index.jsx index 5c0e1c8b3f5a..f5dfcae65451 100644 --- a/projects/plugins/jetpack/_inc/client/components/dash-item/index.jsx +++ b/projects/plugins/jetpack/_inc/client/components/dash-item/index.jsx @@ -1,5 +1,4 @@ -import { getRedirectUrl } from '@automattic/jetpack-components'; -import { __, _x } from '@wordpress/i18n'; +import { _x } from '@wordpress/i18n'; import clsx from 'clsx'; import PropTypes from 'prop-types'; import { Component } from 'react'; @@ -8,7 +7,6 @@ import Button from 'components/button'; import Card from 'components/card'; import { withModuleSettingsFormHelpers } from 'components/module-settings/with-module-settings-form-helpers'; import { ModuleToggle } from 'components/module-toggle'; -import SimpleNotice from 'components/notice'; import SectionHeader from 'components/section-header'; import SupportInfo from 'components/support-info'; import analytics from 'lib/analytics'; @@ -79,9 +77,7 @@ export class DashItem extends Component { 'videopress', ].includes( this.props.module ) && this.props.isOfflineMode ) || - this.props.noToggle || - // Avoid toggle for manage as it's no longer a module - 'manage' === this.props.module ? ( + this.props.noToggle ? ( '' ) : ( ); - if ( 'manage' === this.props.module ) { - if ( 'is-warning' === this.props.status ) { - toggle = ( - - - { _x( 'Updates needed', 'Short warning message', 'jetpack' ) } - - - ); - } - if ( 'is-working' === this.props.status ) { - toggle = ( - { __( 'Active', 'jetpack' ) } - ); - } - } - if ( 'rewind' === this.props.module ) { toggle = null; } diff --git a/projects/plugins/jetpack/_inc/client/components/dash-item/test/component.jsx b/projects/plugins/jetpack/_inc/client/components/dash-item/test/component.jsx index e024e7787d2f..9c549c0a4d35 100644 --- a/projects/plugins/jetpack/_inc/client/components/dash-item/test/component.jsx +++ b/projects/plugins/jetpack/_inc/client/components/dash-item/test/component.jsx @@ -171,50 +171,6 @@ describe( 'DashItem', () => { } ); } ); - describe( 'if this is the DashItem for Manage module', () => { - const manageProps = { - label: 'Manage', - module: 'manage', - status: 'is-warning', - pro: false, - isOfflineMode: false, - userCanToggle: true, - siteAdminUrl: 'https://example.org/wp-admin/', - siteRawUrl: 'example.org', - getOptionValue: () => true, - isUpdating: () => false, - }; - - it( "shows a warning badge when status is 'is-warning'", () => { - const { container } = render( , { - initialState: buildInitialState(), - } ); - // eslint-disable-next-line testing-library/no-container - expect( container.querySelector( '.dops-notice.is-warning' ) ).toBeInTheDocument(); - } ); - - it( 'when it is activated, the warning badge is linked to Plugins screen in WordPress.com', () => { - const { container } = render( , { - initialState: buildInitialState(), - } ); - // eslint-disable-next-line testing-library/no-container - const node = container.querySelector( '.dops-notice.is-warning' ).closest( 'a' ); - expect( node ).toBeInTheDocument(); - expect( node ).toHaveAttribute( - 'href', - getRedirectUrl( 'calypso-plugins-manage', { site: manageProps.siteRawUrl } ) - ); - } ); - - it( "when status is 'is-working', the warning badge has an 'active' label", () => { - const { container } = render( , { - initialState: buildInitialState(), - } ); - // eslint-disable-next-line testing-library/no-container - expect( container.querySelector( '.jp-dash-item__active-label' ) ).toBeInTheDocument(); - } ); - } ); - describe( 'if this is the DashItem for Monitor module', () => { const monitorProps = { module: 'monitor', diff --git a/projects/plugins/jetpack/changelog/remove-dash-item-manage-branch b/projects/plugins/jetpack/changelog/remove-dash-item-manage-branch new file mode 100644 index 000000000000..fa6b05964adc --- /dev/null +++ b/projects/plugins/jetpack/changelog/remove-dash-item-manage-branch @@ -0,0 +1,5 @@ +Significance: patch +Type: other +Comment: Removes unreachable code; no user-facing change. + + From 8dfca1b10fd923232de2dbdf70bb471ad8db0923 Mon Sep 17 00:00:00 2001 From: Christian Gastrell Date: Tue, 8 Sep 2026 10:43:30 -0300 Subject: [PATCH 2/2] Jetpack: drop the leftovers of the removed DashItem "manage" branch The deleted branch was the only consumer of `.jp-dash-item__active-label`, and that rule was the only user of `@use "sass:color"` in the file. `siteRawUrl` is no longer read by the component; `siteAdminUrl` stays, since `ProStatus` still takes it. The `status` propType and its ten call sites are left alone: removing them also strips `status:` keys from seventeen `renderCard` argument objects in `backups.jsx`, `scan.jsx` and `search.jsx`, which is a wider change than this PR. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01NfGbCrDbhYmgwY5hW68VLA --- .../jetpack/_inc/client/components/dash-item/index.jsx | 3 +-- .../_inc/client/components/dash-item/style.scss | 10 ---------- .../client/components/dash-item/test/component.jsx | 2 -- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/projects/plugins/jetpack/_inc/client/components/dash-item/index.jsx b/projects/plugins/jetpack/_inc/client/components/dash-item/index.jsx index f5dfcae65451..7413d1fcab5a 100644 --- a/projects/plugins/jetpack/_inc/client/components/dash-item/index.jsx +++ b/projects/plugins/jetpack/_inc/client/components/dash-item/index.jsx @@ -12,7 +12,7 @@ import SupportInfo from 'components/support-info'; import analytics from 'lib/analytics'; import ProStatus from 'pro-status'; import { isOfflineMode } from 'state/connection'; -import { getSiteRawUrl, getSiteAdminUrl, userCanManageModules } from 'state/initial-state'; +import { getSiteAdminUrl, userCanManageModules } from 'state/initial-state'; import { getModule as _getModule } from 'state/modules'; export class DashItem extends Component { @@ -143,7 +143,6 @@ export default connect( state => { getModule: module_name => _getModule( state, module_name ), isOfflineMode: isOfflineMode( state ), userCanToggle: userCanManageModules( state ), - siteRawUrl: getSiteRawUrl( state ), siteAdminUrl: getSiteAdminUrl( state ), }; } )( withModuleSettingsFormHelpers( DashItem ) ); diff --git a/projects/plugins/jetpack/_inc/client/components/dash-item/style.scss b/projects/plugins/jetpack/_inc/client/components/dash-item/style.scss index c17af43b4e4b..26db1a08b4c5 100644 --- a/projects/plugins/jetpack/_inc/client/components/dash-item/style.scss +++ b/projects/plugins/jetpack/_inc/client/components/dash-item/style.scss @@ -1,4 +1,3 @@ -@use "sass:color"; @use "../../scss/functions/rem"; @use "../../scss/calypso-colors"; @use "../../scss/mixins/ui"; @@ -136,15 +135,6 @@ } } -.jp-dash-item__active-label { - display: inline-block; - color: color.adjust(colors.$gray, $lightness: -10%); - color: colors.$gray; - font-size: rem.convert(12px); - font-weight: 400; - text-transform: uppercase; -} - // conditional styles for content when items are inactive .jp-dash-item__is-inactive { diff --git a/projects/plugins/jetpack/_inc/client/components/dash-item/test/component.jsx b/projects/plugins/jetpack/_inc/client/components/dash-item/test/component.jsx index 9c549c0a4d35..b2cbfb841a86 100644 --- a/projects/plugins/jetpack/_inc/client/components/dash-item/test/component.jsx +++ b/projects/plugins/jetpack/_inc/client/components/dash-item/test/component.jsx @@ -49,7 +49,6 @@ describe( 'DashItem', () => { href: getRedirectUrl( 'jetpack' ), userCanToggle: true, siteAdminUrl: 'https://example.org/wp-admin/', - siteRawUrl: 'example.org', getOptionValue: () => true, isUpdating: () => false, }; @@ -180,7 +179,6 @@ describe( 'DashItem', () => { isOfflineMode: false, userCanToggle: true, siteAdminUrl: 'https://example.org/wp-admin/', - siteRawUrl: 'example.org', getOptionValue: () => true, isUpdating: () => false, };