diff --git a/src/components/admin-lte/index.js b/src/components/admin-lte/index.js index 33604c5..ccad6f2 100644 --- a/src/components/admin-lte/index.js +++ b/src/components/admin-lte/index.js @@ -1,8 +1,6 @@ import React from 'react' import PropTypes from 'prop-types' -import Configure from './configure' -import Tokens from './tokens' -import Wallet from './wallet' + import siteConfig from '../site-config' // import Audit from "./audit" @@ -16,8 +14,6 @@ import VersionStatus from '../version-status' // import { BrowserRouter as Router } from 'react-router-dom' import menuComponents from '../menu-components.js' -import SendReceive from './send-receive' - import { FontAwesomeIcon } from '@fortawesome/react-fontawesome' const { Item } = Sidebar @@ -50,11 +46,7 @@ class AdminLTEPage extends React.Component { _this.BchWallet = BchWallet _this.sidebar = [ - , - , - , - /* , */ - + ] } @@ -101,7 +93,7 @@ class AdminLTEPage extends React.Component { {_this.sidebar} - {_this.renderNewMenuItems()} + {_this.renderNewMenuItems(_this.props)} @@ -109,45 +101,7 @@ class AdminLTEPage extends React.Component {
- {_this.state.section === 'Send/Receive' && ( - - )} - - {_this.state.section === 'Wallet' && ( - - )} - - {_this.state.section === 'Tokens' && ( - - )} - - {_this.state.section === 'Configure' && ( - - )} - - {_this.renderNewViewItems()} + {_this.renderNewViewItems(_this.props)}
@@ -329,9 +283,10 @@ class AdminLTEPage extends React.Component { // Render non-default menu items. The catch ensures that the render function // won't be interrupted if there is an issue porting new menu items. - renderNewMenuItems () { + renderNewMenuItems (props) { try { - return menuComponents && menuComponents.map(m => m.menuItem) + const _menuComponents = menuComponents(props) + return _menuComponents && _menuComponents.map(m => m.menuItem) } catch (err) { // TODO: Figure out how to return an invisible Item. return _this.getInvisibleMenuItem() // @@ -339,11 +294,12 @@ class AdminLTEPage extends React.Component { } // Displays the View corresponding to the dynamically loaded menu item. - renderNewViewItems () { + renderNewViewItems (props) { try { + const _menuComponents = menuComponents(props) return ( - menuComponents && - menuComponents.map(m => { + _menuComponents && + _menuComponents.map(m => { if (_this.state.section === m.key) { return m.component } diff --git a/src/components/menu-components.js b/src/components/menu-components.js index 443bc69..221c7a6 100644 --- a/src/components/menu-components.js +++ b/src/components/menu-components.js @@ -1,3 +1,36 @@ -const MenuComponents = () => {} +import React from 'react' +import { Sidebar } from 'adminlte-2-react' + +import Wallet from './admin-lte/wallet' +import Tokens from './admin-lte/tokens' +import Configure from './admin-lte/configure' +import SendReceive from './admin-lte/send-receive' + +const { Item } = Sidebar + +const MenuComponents = (props) => { + return [ + { + key: 'Send/Receive', + component: , + menuItem: + }, + { + key: 'Tokens', + component: , + menuItem: + }, + { + key: 'Wallet', + component: , + menuItem: + }, + { + key: 'Configure', + component: , + menuItem: + } + ] +} export default MenuComponents