mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-20 14:50:32 +00:00
chore(Sidebar): docs.
This commit is contained in:
@@ -35,6 +35,7 @@ SidebarMenuItem.ItemTypes = [
|
|||||||
ISidebarMenuItemType.Overlay,
|
ISidebarMenuItemType.Overlay,
|
||||||
ISidebarMenuItemType.Dialog,
|
ISidebarMenuItemType.Dialog,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Detarmines which sidebar menu item type should display.
|
* Detarmines which sidebar menu item type should display.
|
||||||
* @returns {JSX.Element}
|
* @returns {JSX.Element}
|
||||||
|
|||||||
@@ -53,10 +53,14 @@ export function getMainSidebarMenu() {
|
|||||||
return R.compose(removeSidebarOverlayChildren)(SidebarMenu);
|
return R.compose(removeSidebarOverlayChildren)(SidebarMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Predicates whether the sidebar item has feature ability.
|
||||||
|
*/
|
||||||
function useFilterSidebarItemFeaturePredicater() {
|
function useFilterSidebarItemFeaturePredicater() {
|
||||||
const { featureCan } = useFeatureCan();
|
const { featureCan } = useFeatureCan();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
// Returns false if the item has `feature` prop and that feature has no ability.
|
||||||
predicate: (item) => {
|
predicate: (item) => {
|
||||||
if (item.feature && !featureCan(item.feature)) {
|
if (item.feature && !featureCan(item.feature)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -66,10 +70,14 @@ function useFilterSidebarItemFeaturePredicater() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Predicates whether the sidebar item has permissio ability.
|
||||||
|
*/
|
||||||
function useFilterSidebarItemAbilityPredicater() {
|
function useFilterSidebarItemAbilityPredicater() {
|
||||||
const ability = useAbilityContext();
|
const ability = useAbilityContext();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
// Retruns false if the item has `permission` prop and that permission has no ability.
|
||||||
predicate: (item) => {
|
predicate: (item) => {
|
||||||
if (
|
if (
|
||||||
item.permission &&
|
item.permission &&
|
||||||
@@ -114,7 +122,7 @@ function useFilterSidebarItemSubscriptionPredicater() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters sidebar menu items based on ability of the item permission.
|
* Filters sidebar menu items based on ability of the item permission.
|
||||||
* @param {*} menu
|
* @param {} menu
|
||||||
* @returns {}
|
* @returns {}
|
||||||
*/
|
*/
|
||||||
function useFilterSidebarMenuAbility(menu) {
|
function useFilterSidebarMenuAbility(menu) {
|
||||||
@@ -189,6 +197,9 @@ function useBindSidebarItemDialogClick() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Binds click action for the sidebar overlay item.
|
||||||
|
*/
|
||||||
function useBindSidebarItemOverlayClick() {
|
function useBindSidebarItemOverlayClick() {
|
||||||
const { toggleSidebarSubmenu, closeSidebarSubmenu } =
|
const { toggleSidebarSubmenu, closeSidebarSubmenu } =
|
||||||
useSidebarSubmnuActions();
|
useSidebarSubmnuActions();
|
||||||
@@ -209,9 +220,7 @@ function useBindSidebarItemOverlayClick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Binds click action of the given sidebar menu for each item based on item type.
|
||||||
* @param {} menu
|
|
||||||
* @returns {}
|
|
||||||
*/
|
*/
|
||||||
function useBindSidebarItemClick(menu) {
|
function useBindSidebarItemClick(menu) {
|
||||||
const { bindOnClick: bindLinkClickEvt } = useBindSidebarItemLinkClick();
|
const { bindOnClick: bindLinkClickEvt } = useBindSidebarItemLinkClick();
|
||||||
|
|||||||
Reference in New Issue
Block a user