diff --git a/src/containers/Dashboard/Sidebar/SidebarMenu.js b/src/containers/Dashboard/Sidebar/SidebarMenu.js index 3b3ddc46c..82572a755 100644 --- a/src/containers/Dashboard/Sidebar/SidebarMenu.js +++ b/src/containers/Dashboard/Sidebar/SidebarMenu.js @@ -35,6 +35,7 @@ SidebarMenuItem.ItemTypes = [ ISidebarMenuItemType.Overlay, ISidebarMenuItemType.Dialog, ]; + /** * Detarmines which sidebar menu item type should display. * @returns {JSX.Element} diff --git a/src/containers/Dashboard/Sidebar/hooks.js b/src/containers/Dashboard/Sidebar/hooks.js index 83ea34d0c..df8168d13 100644 --- a/src/containers/Dashboard/Sidebar/hooks.js +++ b/src/containers/Dashboard/Sidebar/hooks.js @@ -53,10 +53,14 @@ export function getMainSidebarMenu() { return R.compose(removeSidebarOverlayChildren)(SidebarMenu); } +/** + * Predicates whether the sidebar item has feature ability. + */ function useFilterSidebarItemFeaturePredicater() { const { featureCan } = useFeatureCan(); return { + // Returns false if the item has `feature` prop and that feature has no ability. predicate: (item) => { if (item.feature && !featureCan(item.feature)) { return false; @@ -66,10 +70,14 @@ function useFilterSidebarItemFeaturePredicater() { }; } +/** + * Predicates whether the sidebar item has permissio ability. + */ function useFilterSidebarItemAbilityPredicater() { const ability = useAbilityContext(); return { + // Retruns false if the item has `permission` prop and that permission has no ability. predicate: (item) => { if ( item.permission && @@ -114,7 +122,7 @@ function useFilterSidebarItemSubscriptionPredicater() { /** * Filters sidebar menu items based on ability of the item permission. - * @param {*} menu + * @param {} menu * @returns {} */ function useFilterSidebarMenuAbility(menu) { @@ -189,6 +197,9 @@ function useBindSidebarItemDialogClick() { }; } +/** + * Binds click action for the sidebar overlay item. + */ function useBindSidebarItemOverlayClick() { const { toggleSidebarSubmenu, closeSidebarSubmenu } = useSidebarSubmnuActions(); @@ -209,9 +220,7 @@ function useBindSidebarItemOverlayClick() { } /** - * - * @param {} menu - * @returns {} + * Binds click action of the given sidebar menu for each item based on item type. */ function useBindSidebarItemClick(menu) { const { bindOnClick: bindLinkClickEvt } = useBindSidebarItemLinkClick();