diff --git a/gatsby-node.js b/gatsby-node.js index 2784078..f72d342 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -1,5 +1,3 @@ - - exports.onCreateWebpackConfig = ({ stage, actions, getConfig }) => { actions.setWebpackConfig({ node: { @@ -18,3 +16,26 @@ exports.onCreateWebpackConfig = ({ stage, actions, getConfig }) => { actions.replaceWebpackConfig(config) } } + +exports.sourceNodes = ({ actions, createNodeId, createContentDigest }) => { + const { createNode } = actions + const defaultMenuItems = [ + { + title: "Audit", + icon: "fas-cog", + component: "./audit" + } + ] + + createNode({ + menuItems: defaultMenuItems, + id: `bch-wallet-plugins`, + parent: null, + children: [], + internal: { + type: `BchWalletPlugins`, + contentDigest: createContentDigest({}) + } + }) +} + diff --git a/package-lock.json b/package-lock.json index 139fb67..945b3ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2637,12 +2637,13 @@ } }, "@loadable/component": { - "version": "5.12.0", - "resolved": "https://registry.npmjs.org/@loadable/component/-/component-5.12.0.tgz", - "integrity": "sha512-eDG7FPZ8tCFA/mqu2IrYV6eS+UxGBo21PwtEV9QpkpYrx25xKRXzJUm36yfQPK3o7jXu43xpPkwiU4mLWcjJlw==", + "version": "5.13.0", + "resolved": "https://registry.npmjs.org/@loadable/component/-/component-5.13.0.tgz", + "integrity": "sha512-+qS6xoA4DN5Pjm5sR6vWuuYEhMWZ9Y7ALgI8JuDOMCiqOG+PTau0phOyqFgrFqDXijVpeInoIoZQdW1FKjGBYA==", "requires": { "@babel/runtime": "^7.7.7", - "hoist-non-react-statics": "^3.3.1" + "hoist-non-react-statics": "^3.3.1", + "react-is": "^16.12.0" } }, "@mdx-js/mdx": { diff --git a/package.json b/package.json index 15d7560..668c63a 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "1.0.0", "author": "Chris Troutner ", "dependencies": { - "@loadable/component": "^5.12.0", + "@loadable/component": "^5.13.0", "adminlte-2-react": "^0.1.27", "gatsby": "^2.22.15", "gatsby-image": "^2.4.5", @@ -29,7 +29,9 @@ "prettier": "2.0.5" }, "keywords": [ - "gatsby" + "gatsby", + "gatsby-plugin", + "gatsby-theme" ], "license": "MIT", "scripts": { diff --git a/src/components/admin-lte/index.js b/src/components/admin-lte/index.js index 3c48c4f..e52e2d9 100644 --- a/src/components/admin-lte/index.js +++ b/src/components/admin-lte/index.js @@ -1,6 +1,5 @@ import React from "react" import PropTypes from "prop-types" -import Audit from "./audit" import Configure from "./configure" import Tokens from "./tokens" import Wallet from "./wallet" @@ -13,13 +12,22 @@ import "./admin-lte.css" import BchWallet from "minimal-slp-wallet" import VersionStatus from "../version-status" import { BrowserRouter as Router } from "react-router-dom" + +import { StaticQuery, graphql } from "gatsby" +import loadable from "@loadable/component" + import SendReceive from "./send-receive" + const { Item } = Sidebar // Screen width to hide the side menu on click const MENU_HIDE_WIDTH = 770 let _this +const MenuItemComponent = ({ component }) => { + const RenderedComponent = loadable(() => import("./audit")) + return () +} class AdminLTEPage extends React.Component { constructor(props) { @@ -46,67 +54,75 @@ class AdminLTEPage extends React.Component { render() { return ( - <> - - - -
-
-

BCH Balance

+ + <> + + + +
+
+

BCH Balance

-

{_this.state.bchBalance}

-
-
-
+

{_this.state.bchBalance}

+
+
+
+ + {_this.sidebar} + {data.bchWalletPlugins.menuItems.map(item => )} +
+ + + + +
+ {_this.state.section === "Wallet" && ( + + )} + {_this.state.section === "Tokens" && + + } + {_this.state.section === "Configure" && ( + + )} + {data.bchWalletPlugins.menuItems.map(item => + _this.state.section === item.title && + )} +
+
+
+ + + + + }/> - {_this.sidebar} - - - - - -
- {_this.state.section === "Wallet" && ( - - )} - {_this.state.section === "Tokens" && - - } - {_this.state.section === "Configure" && ( - - )} - {_this.state.section === "Audit" && } - {_this.state.section === "Send/Receive" && ( - - )} -
-
- - - - - ) } // Get wallet balance