Close activity panel tabs by default and track (https://github.com/woocommerce/woocommerce-admin/pull/6566)

* Close activity panels by default and track shown

* Add task list shown data to tracks

* Add changelog and testing instructions

* Fire the panel tracks again when the task list is hidden
This commit is contained in:
Joshua T Flowers 2021-03-15 20:34:20 -04:00 committed by GitHub
parent be7d28d4bc
commit 4d445350ea
4 changed files with 33 additions and 1 deletions

View File

@ -2,6 +2,15 @@
## Unreleased ## Unreleased
### Close activity panel tabs by default and track #6566
1. Open your browser console and enter `localStorage.setItem( 'debug', 'wc-admin:tracks' );`. Make sure the "Verbose" is selected under the levels shown.
2. With the task list enabled, navigate to the homescreen.
3. Check that the `wcadmin_activity_panel_visible_panels` event is shown with `taskList: true` in its data.
4. Hide the task list.
5. Note that `wcadmin_activity_panel_visible_panels` event is shown with visible activity panels.
6. After refreshing, make sure that the "Orders" activity panel is closed by default.
### Update undefined task name properties for help panel tracks #6565 ### Update undefined task name properties for help panel tracks #6565
1. Enter `localStorage.setItem( 'debug', 'wc-admin:*' );` into your console. Leave your console open. 1. Enter `localStorage.setItem( 'debug', 'wc-admin:*' );` into your console. Leave your console open.

View File

@ -12,6 +12,8 @@ import {
} from '@wordpress/components'; } from '@wordpress/components';
import { getSetting } from '@woocommerce/wc-admin-settings'; import { getSetting } from '@woocommerce/wc-admin-settings';
import { OPTIONS_STORE_NAME } from '@woocommerce/data'; import { OPTIONS_STORE_NAME } from '@woocommerce/data';
import { recordEvent } from '@woocommerce/tracks';
import { useEffect } from '@wordpress/element';
/** /**
* Internal dependencies * Internal dependencies
@ -52,6 +54,17 @@ export const ActivityPanel = () => {
const panels = getAllPanels( panelsData ); const panels = getAllPanels( panelsData );
useEffect( () => {
const visiblePanels = panels.reduce(
( acc, panel ) => {
acc[ panel.id ] = true;
return acc;
},
{ taskList: panelsData.isTaskListHidden !== 'yes' }
);
recordEvent( 'activity_panel_visible_panels', visiblePanels );
}, [ panelsData.isTaskListHidden ] );
if ( panels.length === 0 ) { if ( panels.length === 0 ) {
return null; return null;
} }
@ -86,6 +99,15 @@ export const ActivityPanel = () => {
initialOpen={ initialOpen } initialOpen={ initialOpen }
collapsible={ collapsible } collapsible={ collapsible }
disabled={ ! collapsible } disabled={ ! collapsible }
onToggle={ ( isOpen ) => {
if ( ! isOpen ) {
return;
}
recordEvent( 'activity_panel_open', {
tab: id,
} );
} }
> >
<PanelRow>{ panel }</PanelRow> <PanelRow>{ panel }</PanelRow>
</PanelBody> </PanelBody>

View File

@ -31,7 +31,7 @@ export function getAllPanels( {
count: countUnreadOrders, count: countUnreadOrders,
collapsible: true, collapsible: true,
id: 'orders-panel', id: 'orders-panel',
initialOpen: true, initialOpen: false,
panel: ( panel: (
<OrdersPanel <OrdersPanel
countUnreadOrders={ countUnreadOrders } countUnreadOrders={ countUnreadOrders }

View File

@ -75,6 +75,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
== Unreleased == == Unreleased ==
- Dev: Close activity panel tabs by default and track #6566
- Dev: Update undefined task name properties for help panel tracks #6565 - Dev: Update undefined task name properties for help panel tracks #6565
- Fix: Allow the manager role to query certain options #6577 - Fix: Allow the manager role to query certain options #6577
- Fix: Fix hidden menu title on smaller screens #6562 - Fix: Fix hidden menu title on smaller screens #6562