diff --git a/plugins/woocommerce-admin/client/header/activity-panel/display-options/index.js b/plugins/woocommerce-admin/client/header/activity-panel/display-options/index.js
index 7246cc5d0ce..92694ca155f 100644
--- a/plugins/woocommerce-admin/client/header/activity-panel/display-options/index.js
+++ b/plugins/woocommerce-admin/client/header/activity-panel/display-options/index.js
@@ -47,12 +47,20 @@ const LAYOUTS = [
];
export const DisplayOptions = () => {
- const { defaultHomescreenLayout } = useSelect( ( select ) => {
+ const {
+ defaultHomescreenLayout,
+ taskListComplete,
+ isTaskListHidden,
+ } = useSelect( ( select ) => {
const { getOption } = select( OPTIONS_STORE_NAME );
return {
defaultHomescreenLayout:
getOption( 'woocommerce_default_homepage_layout' ) ||
'single_column',
+ taskListComplete:
+ getOption( 'woocommerce_task_list_complete' ) === 'yes',
+ isTaskListHidden:
+ getOption( 'woocommerce_task_list_hidden' ) === 'yes',
};
} );
const {
@@ -60,51 +68,70 @@ export const DisplayOptions = () => {
homepage_layout: layout,
} = useUserPreferences();
+ const shouldShowStoreLinks = taskListComplete || isTaskListHidden;
+ const hasTwoColumnContent =
+ shouldShowStoreLinks || window.wcAdminFeatures.analytics;
+
return (
- { ( fills ) => (
- }
- /* translators: button label text should, if possible, be under 16 characters. */
- label={ __( 'Display options', 'woocommerce-admin' ) }
- toggleProps={ {
- className:
- 'woocommerce-layout__activity-panel-tab display-options',
- onClick: () =>
- recordEvent( 'homescreen_display_click' ),
- } }
- popoverProps={ {
- className: 'woocommerce-layout__activity-panel-popover',
- } }
- >
- { ( { onClose } ) => (
- <>
- { fills }
-
- {
- updateUserPreferences( {
- homepage_layout: newLayout,
- } );
- onClose();
- recordEvent(
- 'homescreen_display_option',
- {
- display_option: newLayout,
+ { ( fills ) => {
+ // If there is no fill to render and only single column content, don't render the display.
+ if ( fills.length === 0 && ! hasTwoColumnContent ) {
+ return null;
+ }
+ return (
+ }
+ /* translators: button label text should, if possible, be under 16 characters. */
+ label={ __( 'Display options', 'woocommerce-admin' ) }
+ toggleProps={ {
+ className:
+ 'woocommerce-layout__activity-panel-tab display-options',
+ onClick: () =>
+ recordEvent( 'homescreen_display_click' ),
+ } }
+ popoverProps={ {
+ className:
+ 'woocommerce-layout__activity-panel-popover',
+ } }
+ >
+ { ( { onClose } ) => (
+ <>
+ { fills }
+ { hasTwoColumnContent ? (
+
+ {
+ updateUserPreferences( {
+ homepage_layout: newLayout,
+ } );
+ onClose();
+ recordEvent(
+ 'homescreen_display_option',
+ {
+ display_option: newLayout,
+ }
+ );
+ } }
+ value={
+ layout ||
+ defaultHomescreenLayout
}
- );
- } }
- value={ layout || defaultHomescreenLayout }
- />
-
- >
- ) }
-
- ) }
+ />
+
+ ) : null }
+ >
+ ) }
+
+ );
+ } }
);
};
diff --git a/plugins/woocommerce-admin/client/homescreen/layout.js b/plugins/woocommerce-admin/client/homescreen/layout.js
index a791613698c..5692c6cc9ed 100644
--- a/plugins/woocommerce-admin/client/homescreen/layout.js
+++ b/plugins/woocommerce-admin/client/homescreen/layout.js
@@ -57,9 +57,12 @@ export const Layout = ( {
updateOptions,
} ) => {
const userPrefs = useUserPreferences();
+ const shouldShowStoreLinks = taskListComplete || isTaskListHidden;
+ const hasTwoColumnContent =
+ shouldShowStoreLinks || window.wcAdminFeatures.analytics;
const twoColumns =
( userPrefs.homepage_layout || defaultHomescreenLayout ) ===
- 'two_columns';
+ 'two_columns' && hasTwoColumnContent;
const [ showInbox, setShowInbox ] = useState( true );
const isTaskListEnabled = bothTaskListsHidden === false;
@@ -84,7 +87,6 @@ export const Layout = ( {
}, [ maybeToggleColumns ] );
const shouldStickColumns = isWideViewport.current && twoColumns;
- const shouldShowStoreLinks = taskListComplete || isTaskListHidden;
const renderColumns = () => {
return (
@@ -103,7 +105,7 @@ export const Layout = ( {
-
+ { window.wcAdminFeatures.analytics && }
{ shouldShowStoreLinks && }
>
diff --git a/plugins/woocommerce-admin/readme.txt b/plugins/woocommerce-admin/readme.txt
index 98ca0242e15..2c5e835508c 100644
--- a/plugins/woocommerce-admin/readme.txt
+++ b/plugins/woocommerce-admin/readme.txt
@@ -100,6 +100,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
- Fix: Currency display on Orders activity card on homescreen #7181
- Fix: Report export filtering bug. #7165
- Fix: Use tab char for the CSV injection prevention. #7154
+- Tweak: Remove performance indicators when Analytics Flag disabled #7234
- Tweak: Revert Card component removal #7167
- Tweak: Removed unused feature flags #7233
- Update: Notes to use a date range. #7222