catalog and bags

This commit is contained in:
egortriston
2025-07-30 13:57:16 +03:00
parent a8f783767f
commit 95e6b33b56
9 changed files with 123 additions and 40 deletions

View File

@ -277,8 +277,7 @@
}
}
}
const activeCatalog = catalogsData?.partsIndexCategoriesWithGroups?.[tabData.findIndex(tab => tab === mobileCategory)];
const catalogId = activeCatalog?.id || 'fallback';
const catalogId = mobileCategory.catalogId || 'fallback';
handleCategoryClick(catalogId, mobileCategory.links[0], subcategoryId);
}}
style={{ cursor: "pointer" }}
@ -306,8 +305,7 @@
}
}
}
const activeCatalog = catalogsData?.partsIndexCategoriesWithGroups?.[tabData.findIndex(tab => tab === mobileCategory)];
const catalogId = activeCatalog?.id || 'fallback';
const catalogId = mobileCategory.catalogId || 'fallback';
handleCategoryClick(catalogId, link, subcategoryId);
}}
>
@ -333,7 +331,7 @@
{tabData.map((cat, index) => {
// Получаем ID каталога из данных PartsIndex или создаем fallback ID
const catalogId = catalogsData?.partsIndexCategoriesWithGroups?.[index]?.id || `fallback_${index}`;
const groups = catalogsData?.partsIndexCategoriesWithGroups?.[index]?.groups || [];
return (
<div
className="mobile-subcategory"
@ -343,7 +341,7 @@
const categoryWithData = {
...cat,
catalogId,
groups: catalogsData?.partsIndexCategoriesWithGroups?.[index]?.groups
groups
};
setMobileCategory(categoryWithData);
}}