mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 12:20:31 +00:00
20 lines
541 B
TypeScript
20 lines
541 B
TypeScript
// @ts-nocheck
|
|
import { isEmpty } from 'lodash';
|
|
import { useAbilityContext } from '@/hooks';
|
|
|
|
export const useFilterShortcutBoxesSection = (section) => {
|
|
const ability = useAbilityContext();
|
|
|
|
return section
|
|
.map(({ sectionTitle, shortcuts }) => {
|
|
const shortcut = shortcuts.filter((shortcuts) => {
|
|
return ability.can(shortcuts.ability, shortcuts.subject);
|
|
});
|
|
return {
|
|
sectionTitle: sectionTitle,
|
|
shortcuts: shortcut,
|
|
};
|
|
})
|
|
.filter(({ shortcuts }) => !isEmpty(shortcuts));
|
|
};
|