build successful. Manually porting Andre's code

This commit is contained in:
Chris Troutner
2020-07-06 09:29:43 -07:00
parent f1d722884d
commit 87b6fdfadb
4 changed files with 83 additions and 118 deletions
+7 -21
View File
@@ -4,6 +4,7 @@ exports.onCreateWebpackConfig = ({ stage, actions, getConfig }) => {
fs: "empty",
},
})
//Ignore css order
if (stage === "build-javascript") {
const config = getConfig()
@@ -17,25 +18,10 @@ exports.onCreateWebpackConfig = ({ stage, actions, getConfig }) => {
}
}
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({})
}
})
exports.createPages = async ({ actions }, themeOptions) => {
const basePath = "/"
actions.createPage({
path: basePath,
component: require.resolve("./src/pages/index.js"),
})
}
-1
View File
@@ -4,7 +4,6 @@
"version": "1.0.0",
"author": "Chris Troutner <chris.troutner@gmail.com>",
"dependencies": {
"@loadable/component": "^5.13.0",
"adminlte-2-react": "^0.1.27",
"gatsby": "^2.22.15",
"gatsby-image": "^2.4.5",
+71 -96
View File
@@ -3,6 +3,7 @@ import PropTypes from "prop-types"
import Configure from "./configure"
import Tokens from "./tokens"
import Wallet from "./wallet"
// import Audit from "./audit"
import AdminLTE, { Sidebar, Navbar } from "adminlte-2-react"
import ScannerModal from "../qr-scanner/modal"
@@ -12,9 +13,7 @@ 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 menuComponents from "../menu-components.js"
import SendReceive from "./send-receive"
@@ -24,10 +23,6 @@ const { Item } = Sidebar
const MENU_HIDE_WIDTH = 770
let _this
const MenuItemComponent = ({ component }) => {
const RenderedComponent = loadable(() => import("./audit"))
return <RenderedComponent />
}
class AdminLTEPage extends React.Component {
constructor(props) {
@@ -48,101 +43,81 @@ class AdminLTEPage extends React.Component {
<Item icon="fas-coins" key="Tokens" text="Tokens" />,
<Item icon="fa-wallet" key="Wallet" text="Wallet" activeOn="/" />,
<Item icon="fa-qrcode" key="qrReader" text="Qr Scanner" />,
<Item icon="fas-cog" key="Configure" text="Configure" />
<Item icon="fas-cog" key="Configure" text="Configure" />,
]
render() {
return (
<StaticQuery
query={graphql`
query {
bchWalletPlugins {
menuItems {
title
component
icon
}
}
}
`}
render={data => (
<>
<AdminLTE
title={["FullStack.cash"]}
titleShort={["PSF"]}
theme="blue"
>
<Sidebar.Core>
<Item key="Balance" text="Balance" icon="fab-bitcoin">
<div className="sidebar-balance">
<div>
<h3>BCH Balance </h3>
<>
<AdminLTE title={["FullStack.cash"]} titleShort={["PSF"]} theme="blue">
<Sidebar.Core>
<Item key="Balance" text="Balance" icon="fab-bitcoin">
<div className="sidebar-balance">
<div>
<h3>BCH Balance </h3>
<p>{_this.state.bchBalance}</p>
</div>
</div>
</Item>
{_this.sidebar}
{data.bchWalletPlugins.menuItems.map(item => (
<Item icon={item.icon} key={item.title} text={item.title} />
))}
</Sidebar.Core>
<Navbar.Core>
<VersionStatus></VersionStatus>
</Navbar.Core>
<Layout path="/">
<div className="components-container">
{_this.state.section === "Send/Receive" && (
<SendReceive
setWalletInfo={_this.props.setWalletInfo}
walletInfo={_this.props.walletInfo}
updateBalance={_this.props.updateBalance}
setBchWallet={_this.props.setBchWallet}
bchWallet={_this.props.bchWallet}
/>
)}
{_this.state.section === "Tokens" && (
<Tokens
walletInfo={_this.props.walletInfo}
bchWallet={_this.props.bchWallet}
/>
)}
{_this.state.section === "Wallet" && (
<Wallet
setWalletInfo={_this.props.setWalletInfo}
walletInfo={_this.props.walletInfo}
updateBalance={_this.props.updateBalance}
setBchWallet={_this.props.setBchWallet}
/>
)}
{_this.state.section === "Configure" && (
<Configure
walletInfo={_this.props.walletInfo}
setWalletInfo={_this.props.setWalletInfo}
setBchWallet={_this.props.setBchWallet}
/>
)}
{data.bchWalletPlugins.menuItems.map(
item =>
_this.state.section === item.title && (
<MenuItemComponent component={item.component} />
)
)}
<p>{_this.state.bchBalance}</p>
</div>
</Layout>
</AdminLTE>
<Router>
<ScannerModal
show={_this.state.showScannerModal}
onHide={_this.toggleScannerModal}
path="/"
/>
</Router>
</>
)}
/>
</div>
</Item>
{_this.sidebar}
</Sidebar.Core>
<Navbar.Core>
<VersionStatus></VersionStatus>
</Navbar.Core>
<Layout path="/">
<div className="components-container">
{_this.state.section === "Send/Receive" && (
<SendReceive
setWalletInfo={_this.props.setWalletInfo}
walletInfo={_this.props.walletInfo}
updateBalance={_this.props.updateBalance}
setBchWallet={_this.props.setBchWallet}
bchWallet={_this.props.bchWallet}
/>
)}
{_this.state.section === "Tokens" && (
<Tokens
walletInfo={_this.props.walletInfo}
bchWallet={_this.props.bchWallet}
/>
)}
{_this.state.section === "Wallet" && (
<Wallet
setWalletInfo={_this.props.setWalletInfo}
walletInfo={_this.props.walletInfo}
updateBalance={_this.props.updateBalance}
setBchWallet={_this.props.setBchWallet}
/>
)}
{_this.state.section === "Configure" && (
<Configure
walletInfo={_this.props.walletInfo}
setWalletInfo={_this.props.setWalletInfo}
setBchWallet={_this.props.setBchWallet}
/>
)}
</div>
</Layout>
</AdminLTE>
<Router>
<ScannerModal
show={_this.state.showScannerModal}
onHide={_this.toggleScannerModal}
path="/"
/>
</Router>
</>
)
}
// Get wallet balance
+5
View File
@@ -0,0 +1,5 @@
const MenuComponents = () => {
}
export default MenuComponents;