mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 05:40:31 +00:00
feat(Sidebar): Refactoring sidebar menu with feature and permissions abilities control.
This commit is contained in:
72
src/containers/Dashboard/Sidebar/interfaces.ts
Normal file
72
src/containers/Dashboard/Sidebar/interfaces.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
export enum ISidebarMenuItemType {
|
||||
Label = 'label',
|
||||
Link = 'link',
|
||||
Group = 'group',
|
||||
Overlay = 'overlay',
|
||||
Dialog = 'dialog',
|
||||
Drawer = 'drawer',
|
||||
}
|
||||
|
||||
export interface ISidebarMenuItemOverlay extends ISidebarMenuItemCommon {
|
||||
type: ISidebarMenuItemType.Overlay;
|
||||
}
|
||||
|
||||
export interface ISidebarMenuItemLink extends ISidebarMenuItemCommon {
|
||||
text: string | JSX.Element;
|
||||
href: string;
|
||||
type: ISidebarMenuItemType.Link;
|
||||
matchExact?: boolean;
|
||||
}
|
||||
|
||||
export interface ISidebarMenuItemDialog extends ISidebarMenuItemCommon {
|
||||
type: ISidebarMenuItemType.Dialog;
|
||||
dialogName: string;
|
||||
dialogPayload: any;
|
||||
}
|
||||
|
||||
export interface ISidebarMenuItemDrawer extends ISidebarMenuItemCommon {
|
||||
type: ISidebarMenuItemType.Drawer;
|
||||
drawerName: string;
|
||||
drawerPayload: any;
|
||||
}
|
||||
|
||||
export interface ISidebarMenuItemLabel extends ISidebarMenuItemCommon {
|
||||
text?: string;
|
||||
type: ISidebarMenuItemType.Label;
|
||||
}
|
||||
|
||||
export interface ISidebarMenuItemGroup extends ISidebarMenuItemCommon {
|
||||
type: ISidebarMenuItemType.Group;
|
||||
}
|
||||
|
||||
export interface ISidebarMenuItemPermission {
|
||||
subject: string;
|
||||
ability: string;
|
||||
}
|
||||
|
||||
export interface ISidebarMenuItemCommon {
|
||||
ability?: ISidebarMenuItemPermission | ISidebarMenuItemPermission[];
|
||||
feature?: string;
|
||||
disabled?: boolean;
|
||||
children?: ISidebarMenuItem[];
|
||||
onlySubscriptionExpired?: boolean;
|
||||
}
|
||||
|
||||
export type ISidebarMenuItem =
|
||||
| ISidebarMenuItemLink
|
||||
| ISidebarMenuItemLabel
|
||||
| ISidebarMenuItemGroup
|
||||
| ISidebarMenuItemOverlay
|
||||
| ISidebarMenuItemDialog
|
||||
| ISidebarMenuItemDrawer;
|
||||
|
||||
export enum ISidebarMenuOverlayIds {
|
||||
Items = 'Items',
|
||||
Reports = 'Reports',
|
||||
Sales = 'Sales',
|
||||
Purchases = 'Purchases',
|
||||
Financial = 'Financial',
|
||||
Contacts = 'Contacts',
|
||||
Cashflow = 'Cashflow',
|
||||
Expenses = 'Expenses'
|
||||
}
|
||||
Reference in New Issue
Block a user