This repository has been archived by the owner on Jul 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 145
/
panels.js
74 lines (71 loc) · 1.66 KB
/
panels.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/**
* External dependencies
*/
import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import OrdersPanel from './orders';
import StockPanel from './stock';
import ReviewsPanel from './reviews';
export function getAllPanels( {
countLowStockProducts,
countUnapprovedReviews,
countUnreadOrders,
manageStock,
isTaskListHidden,
orderStatuses,
publishedProductCount,
reviewsEnabled,
totalOrderCount,
} ) {
if ( ! isTaskListHidden ) {
return [];
}
return [
totalOrderCount > 0 && {
className: 'woocommerce-homescreen-card',
count: countUnreadOrders,
collapsible: true,
id: 'orders-panel',
initialOpen: false,
panel: (
<OrdersPanel
countUnreadOrders={ countUnreadOrders }
orderStatuses={ orderStatuses }
/>
),
title: __( 'Orders', 'woocommerce-admin' ),
},
totalOrderCount > 0 &&
publishedProductCount > 0 &&
manageStock === 'yes' && {
className: 'woocommerce-homescreen-card',
count: countLowStockProducts,
id: 'stock-panel',
initialOpen: false,
collapsible: countLowStockProducts !== 0,
panel: (
<StockPanel
countLowStockProducts={ countLowStockProducts }
/>
),
title: __( 'Stock', 'woocommerce-admin' ),
},
publishedProductCount > 0 &&
reviewsEnabled === 'yes' && {
className: 'woocommerce-homescreen-card',
id: 'reviews-panel',
count: countUnapprovedReviews,
initialOpen: false,
collapsible: countUnapprovedReviews !== 0,
panel: (
<ReviewsPanel
hasUnapprovedReviews={ countUnapprovedReviews > 0 }
/>
),
title: __( 'Reviews', 'woocommerce-admin' ),
},
// Add another panel row here
].filter( Boolean );
}