From fedc8ba5fa40c040c4a68c7ec3f32d677135de35 Mon Sep 17 00:00:00 2001 From: Tom Butcher Date: Fri, 21 Aug 2026 19:09:40 +0100 Subject: [PATCH] Enhance DashboardSidebar Item Mapping Logic - Updated the mapItemsRecursively function to accept an additional parameter for controlling tooltip visibility on collapsed items, improving user experience. - Adjusted the recursive mapping of children items to ensure tooltips are displayed correctly based on the new parameter, enhancing clarity in the sidebar's item representation. --- src/components/Dashboard/common/DashboardSidebar.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/Dashboard/common/DashboardSidebar.jsx b/src/components/Dashboard/common/DashboardSidebar.jsx index e01cd478..b88c9b32 100644 --- a/src/components/Dashboard/common/DashboardSidebar.jsx +++ b/src/components/Dashboard/common/DashboardSidebar.jsx @@ -75,17 +75,19 @@ const DashboardSidebar = ({ } // Recursive function to map items and their children - const mapItemsRecursively = (items) => { + const mapItemsRecursively = (items, showCollapsedTooltip = true) => { return items.map((item) => { if (item?.type === 'divider') { return item } + console.log(item) + const icon = item.icon || getSidebarIconNode(item.iconKey) const mappedItem = { key: item.key, icon: - collapsed && !isMobile ? ( + collapsed && !isMobile && showCollapsedTooltip && !item.children ? ( ) : ( icon @@ -100,7 +102,7 @@ const DashboardSidebar = ({ // Recursively map children if they exist if (item?.children && Array.isArray(item.children)) { - mappedItem.children = mapItemsRecursively(item.children) + mappedItem.children = mapItemsRecursively(item.children, false) } return mappedItem