|
@@ -20,7 +20,13 @@ const ProductSelected = () => {
|
20
|
20
|
useEffect(() => {
|
21
|
21
|
|
22
|
22
|
if (products.length > 0) {
|
23
|
|
- setFilterProducts(products.filter(({ selected }) => selected))
|
|
23
|
+
|
|
24
|
+ let selectedProducts = products.filter(({ selected }) => selected) || []
|
|
25
|
+
|
|
26
|
+ //sort
|
|
27
|
+ selectedProducts = selectedProducts.sort((a, b) => new Date(b.createdAt) - new Date(a.createdAt));
|
|
28
|
+ setFilterProducts(selectedProducts)
|
|
29
|
+
|
24
|
30
|
}
|
25
|
31
|
|
26
|
32
|
}, [products])
|
|
@@ -68,8 +74,8 @@ const ProductSelected = () => {
|
68
|
74
|
/>
|
69
|
75
|
|
70
|
76
|
<Button sx={{ position: "absolute", top: 20, left: 20, boxShadow: 0 }} variant="contained">
|
71
|
|
- NEW
|
72
|
|
- </Button>
|
|
77
|
+ NEW
|
|
78
|
+ </Button>
|
73
|
79
|
|
74
|
80
|
<Box sx={{ pb: 5, pt: 3 }}>
|
75
|
81
|
<Typography variant="body1" sx={{ fontWeight: "400", mb: 1 }}>
|