|  |  |  | 
|---|
|  |  |  | import SubMenu from './SubMenu'; | 
|---|
|  |  |  | import SettingsIcon from '@mui/icons-material/Settings'; | 
|---|
|  |  |  | import DashboardIcon from '@mui/icons-material/Dashboard'; | 
|---|
|  |  |  | import DehazeIcon from '@mui/icons-material/Dehaze'; | 
|---|
|  |  |  | import HorizontalRuleIcon from '@mui/icons-material/HorizontalRule'; | 
|---|
|  |  |  | import PersonIcon from '@mui/icons-material/Person'; | 
|---|
|  |  |  | import * as Icons from '@mui/icons-material'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const getIconComponent = (iconStr) => { | 
|---|
|  |  |  | return Icons[iconStr] || DehazeIcon; | 
|---|
|  |  |  | return Icons[iconStr] || HorizontalRuleIcon; | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export const MyMenu = ({ dense = false }) => { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const getIcon = (iconStr) => { | 
|---|
|  |  |  | const IconComponent = getIconComponent(iconStr); | 
|---|
|  |  |  | return <IconComponent />; | 
|---|
|  |  |  | if (IconComponent) { | 
|---|
|  |  |  | return <IconComponent />; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const generateMenu = (permissions) => { | 
|---|
|  |  |  | 
|---|
|  |  |  | </SubMenu> | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <MenuItemLink | 
|---|
|  |  |  | key={node.id} | 
|---|
|  |  |  | to={node.component} // correspond to Resource.name | 
|---|
|  |  |  | state={{ _scrollToTop: true }} | 
|---|
|  |  |  | // primaryText={translate(`resources.orders.name`, { | 
|---|
|  |  |  | //     smart_count: 2, | 
|---|
|  |  |  | // })} | 
|---|
|  |  |  | primaryText={node.name} | 
|---|
|  |  |  | leftIcon={getIcon(node.icon)} | 
|---|
|  |  |  | dense={dense} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if (node.component) { | 
|---|
|  |  |  | return ( | 
|---|
|  |  |  | <MenuItemLink | 
|---|
|  |  |  | key={node.id} | 
|---|
|  |  |  | to={node.component} // correspond to Resource.name | 
|---|
|  |  |  | state={{ _scrollToTop: true }} | 
|---|
|  |  |  | // primaryText={translate(`resources.orders.name`, { | 
|---|
|  |  |  | //     smart_count: 2, | 
|---|
|  |  |  | // })} | 
|---|
|  |  |  | primaryText={node.name} | 
|---|
|  |  |  | leftIcon={getIcon(node.icon)} | 
|---|
|  |  |  | dense={dense} | 
|---|
|  |  |  | /> | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }; | 
|---|