Browse Source

feat module 1,2,4 : fixed product banner display under essentials group - web , mobile view

master
nadia 3 days ago
parent
commit
7e1e6f5703

+ 3
- 1
src/components/Navbar/Navbar.jsx View File

32
 import {
32
 import {
33
   NAV_MENU_STRUCTURE as SHARED_NAV_MENU_STRUCTURE,
33
   NAV_MENU_STRUCTURE as SHARED_NAV_MENU_STRUCTURE,
34
   buildNavMenuFromProducts,
34
   buildNavMenuFromProducts,
35
+  getRelatedProductTypes,
35
   normalizeTitle,
36
   normalizeTitle,
36
 } from "../../config/menuCollections";
37
 } from "../../config/menuCollections";
37
 
38
 
400
   const findCollectionForMenuItem = (productType, item) => {
401
   const findCollectionForMenuItem = (productType, item) => {
401
     const targetTitles = (item?.titles || []).map(normalizeTitle);
402
     const targetTitles = (item?.titles || []).map(normalizeTitle);
402
     const targetHandles = (item?.handles || []).map(normalizeTitle);
403
     const targetHandles = (item?.handles || []).map(normalizeTitle);
404
+    const relatedProductTypeSet = new Set(getRelatedProductTypes(productType));
403
 
405
 
404
     return products
406
     return products
405
-      .filter((product) => product.productType === productType)
407
+      .filter((product) => relatedProductTypeSet.has(normalizeTitle(product?.productType)))
406
       .flatMap((product) => product.collections || [])
408
       .flatMap((product) => product.collections || [])
407
       .find((collection) =>
409
       .find((collection) =>
408
         targetTitles.includes(normalizeTitle(collection?.title || "")) ||
410
         targetTitles.includes(normalizeTitle(collection?.title || "")) ||

+ 3
- 1
src/components/Navbar/components/MobileNav/MobileNav.jsx View File

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

Loading…
Cancel
Save