From 20de2d202b532200f8a0b5b9e3ff21c98fa48c1d Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Sat, 15 Dec 2018 15:31:24 -0500 Subject: [PATCH] move all routes to maincontainer --- app/components/MainCointainer.jsx | 12 ++++++++---- app/components/TransfersGraph.jsx | 27 ++++++++++++++++----------- app/dapp.js | 13 +++++-------- 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/app/components/MainCointainer.jsx b/app/components/MainCointainer.jsx index eb3cbff..81e1bb9 100644 --- a/app/components/MainCointainer.jsx +++ b/app/components/MainCointainer.jsx @@ -20,6 +20,7 @@ import ListItemText from '@material-ui/core/ListItemText'; import InboxIcon from '@material-ui/icons/MoveToInbox'; import FundsManagement from './FundsManagement' import ContractAdmin from './ContractAdmin' +import TransferGraph from './TransfersGraph' const drawerWidth = 240 @@ -156,10 +157,12 @@ class PersistentDrawerLeft extends React.Component { - - - - + + + + + + @@ -182,6 +185,7 @@ class PersistentDrawerLeft extends React.Component { })}> } /> + {this.props.children} diff --git a/app/components/TransfersGraph.jsx b/app/components/TransfersGraph.jsx index fb0b7d5..62a9bb6 100644 --- a/app/components/TransfersGraph.jsx +++ b/app/components/TransfersGraph.jsx @@ -1,10 +1,11 @@ import Cytoscape from 'cytoscape' import dagre from 'cytoscape-dagre' -import React, { Fragment, memo } from 'react' +import React, { Fragment } from 'react' import CytoscapeComponent from 'react-cytoscapejs' import { uniq } from 'ramda' import { toEther } from '../utils/conversions' import { getTokenLabel } from '../utils/currencies' +import { FundingContext } from '../context' Cytoscape.use(dagre) const layout = { name: 'dagre' } @@ -68,17 +69,21 @@ const createElements = (transfers, vaultEvents) => { ] } -const TransfersGraph = ({ transfers, vaultEvents }) => { +const TransfersGraph = () => { return ( - - - + + {({ transfers, vaultEvents }) => + + + + } + ) } -export default memo(TransfersGraph) +export default TransfersGraph diff --git a/app/dapp.js b/app/dapp.js index e938192..2299335 100644 --- a/app/dapp.js +++ b/app/dapp.js @@ -9,7 +9,6 @@ import { getAllLPEvents, getAllVaultEvents, getProfileEvents, formatFundProfileE import { getAllPledges, appendToExistingPledges, transferBetweenPledges } from './utils/pledges'; import { FundingContext } from './context' import { cancelProfile } from './utils/fundProfiles' -import TransfersGraph from './components/TransfersGraph' import MainCointainer from './components/MainCointainer' const { getNetworkType } = web3.eth.net @@ -35,7 +34,7 @@ class App extends React.Component { const authorizedPayments = await getAuthorizedPayments() const account = await web3.eth.getCoinbase() const allLpEvents = await getAllLPEvents() - const allVaultEvents = await getAllVaultEvents() + const vaultEvents = await getAllVaultEvents() const transfers = allLpEvents.filter(obj => obj.event === 'Transfer') this.setState({ account, @@ -47,7 +46,7 @@ class App extends React.Component { allPledges, authorizedPayments, allLpEvents, - allVaultEvents, + vaultEvents, transfers }) } @@ -80,15 +79,13 @@ class App extends React.Component { } render() { - const { account, needsInit, lpAllowance, fundProfiles, allPledges, authorizedPayments, transfers, allVaultEvents } = this.state + const { account, needsInit, lpAllowance, fundProfiles, allPledges, authorizedPayments, transfers, vaultEvents } = this.state const { appendFundProfile, appendPledges, transferPledgeAmounts, cancelFundProfile } = this - const fundingContext = { allPledges, appendPledges, appendFundProfile, account, transferPledgeAmounts, authorizedPayments, cancelFundProfile, fundProfiles, needsInit, initVaultAndLP, standardTokenApproval } + const fundingContext = { allPledges, appendPledges, appendFundProfile, account, transferPledgeAmounts, authorizedPayments, cancelFundProfile, fundProfiles, needsInit, initVaultAndLP, standardTokenApproval, transfers, vaultEvents } return ( - - {false &&transfers && } - + )