Hiding badge when remaining tasks is now zero
This commit is contained in:
parent
29e521dca0
commit
27cecd9b83
|
@ -35,6 +35,11 @@ export const Task: React.FC< TaskProps > = ( { query, task } ) => {
|
|||
}
|
||||
|
||||
const currentBadgeCount = Number( badgeElement.innerText );
|
||||
|
||||
if ( currentBadgeCount === 1 ) {
|
||||
badgeElement.remove();
|
||||
}
|
||||
|
||||
badgeElement.innerHTML = String( currentBadgeCount - 1 );
|
||||
}, [] );
|
||||
|
||||
|
|
|
@ -190,6 +190,7 @@ class CoreMenu {
|
|||
}
|
||||
|
||||
$home_item = array();
|
||||
$setup_tasks_remaining = TaskLists::setup_tasks_remaining();
|
||||
if ( defined( '\Automattic\WooCommerce\Internal\Admin\Homescreen::MENU_SLUG' ) ) {
|
||||
$home_item = array(
|
||||
'id' => 'woocommerce-home',
|
||||
|
@ -197,7 +198,7 @@ class CoreMenu {
|
|||
'url' => \Automattic\WooCommerce\Internal\Admin\Homescreen::MENU_SLUG,
|
||||
'order' => 0,
|
||||
'matchExpression' => 'page=wc-admin((?!path=).)*$',
|
||||
'badge' => TaskLists::setup_tasks_remaining(),
|
||||
'badge' => $setup_tasks_remaining ? $setup_tasks_remaining : null,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -497,7 +497,7 @@ class TaskLists {
|
|||
|
||||
$tasks_count = self::setup_tasks_remaining();
|
||||
|
||||
if( !$tasks_count ) {
|
||||
if( ! $tasks_count ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue