|
|
@@ -4,6 +4,7 @@ import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
4
|
4
|
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
5
|
5
|
import Grid from '@mui/material/Grid2';
|
|
6
|
6
|
import logoSrc from "../../../../assets/images/amberlogo.png";
|
|
|
7
|
+import { getRelatedProductTypes } from "../../../../config/menuCollections";
|
|
7
|
8
|
|
|
8
|
9
|
const getProductTypeMenuLabel = (productType = "") => {
|
|
9
|
10
|
return productType.trim().toUpperCase() === "BEAUTY" ? "Essentials" : productType;
|
|
|
@@ -31,9 +32,10 @@ const MobileNav = ({ open, onClose, menu = [], infomenu = [], products = [] }) =
|
|
31
|
32
|
const findCollectionForMenuItem = (productType, item) => {
|
|
32
|
33
|
const targetTitles = (item?.titles || []).map(normalizeTitle);
|
|
33
|
34
|
const targetHandles = (item?.handles || []).map(normalizeTitle);
|
|
|
35
|
+ const relatedProductTypeSet = new Set(getRelatedProductTypes(productType));
|
|
34
|
36
|
|
|
35
|
37
|
return products
|
|
36
|
|
- .filter((product) => product.productType === productType)
|
|
|
38
|
+ .filter((product) => relatedProductTypeSet.has(normalizeTitle(product?.productType)))
|
|
37
|
39
|
.flatMap((product) => product.collections || [])
|
|
38
|
40
|
.find((collection) =>
|
|
39
|
41
|
targetTitles.includes(normalizeTitle(collection?.title || "")) ||
|