2020-11-06 01:21:05 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { __ } from '@wordpress/i18n';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
import OrdersPanel from './orders';
|
2020-11-25 18:51:15 +00:00
|
|
|
import StockPanel from './stock';
|
2020-11-06 01:21:05 +00:00
|
|
|
|
2020-11-23 15:06:55 +00:00
|
|
|
export function getAllPanels( {
|
2020-11-25 18:51:15 +00:00
|
|
|
countLowStockProducts,
|
2020-11-23 15:06:55 +00:00
|
|
|
countUnreadOrders,
|
2020-11-25 18:51:15 +00:00
|
|
|
manageStock,
|
2020-11-23 15:06:55 +00:00
|
|
|
orderStatuses,
|
|
|
|
totalOrderCount,
|
|
|
|
} ) {
|
2020-11-06 01:21:05 +00:00
|
|
|
return [
|
2020-11-23 15:06:55 +00:00
|
|
|
totalOrderCount > 0 && {
|
2020-11-06 01:21:05 +00:00
|
|
|
className: 'woocommerce-homescreen-card',
|
|
|
|
count: countUnreadOrders,
|
|
|
|
id: 'orders-panel',
|
|
|
|
initialOpen: true,
|
2020-11-06 16:50:24 +00:00
|
|
|
panel: (
|
|
|
|
<OrdersPanel
|
|
|
|
countUnreadOrders={ countUnreadOrders }
|
|
|
|
orderStatuses={ orderStatuses }
|
|
|
|
/>
|
|
|
|
),
|
2020-11-06 01:21:05 +00:00
|
|
|
title: __( 'Orders', 'woocommerce-admin' ),
|
|
|
|
},
|
2020-11-25 18:51:15 +00:00
|
|
|
manageStock === 'yes' && {
|
|
|
|
className: 'woocommerce-homescreen-card',
|
|
|
|
count: countLowStockProducts,
|
|
|
|
id: 'stock-panel',
|
|
|
|
initialOpen: false,
|
|
|
|
panel: (
|
|
|
|
<StockPanel countLowStockProducts={ countLowStockProducts } />
|
|
|
|
),
|
|
|
|
title: __( 'Stock', 'woocommerce-admin' ),
|
|
|
|
},
|
2020-11-06 01:21:05 +00:00
|
|
|
// Add another panel row here
|
2020-11-23 15:06:55 +00:00
|
|
|
].filter( Boolean );
|
2020-11-06 01:21:05 +00:00
|
|
|
}
|