add react-router
This commit is contained in:
parent
4cd878c2a6
commit
31b218e003
|
@ -0,0 +1,22 @@
|
|||
import React, { Fragment } from 'react'
|
||||
import Button from '@material-ui/core/Button'
|
||||
import { FundingContext } from '../context'
|
||||
import SetMockedTime from './SetMockedTime'
|
||||
|
||||
const ContractAdmin = () => (
|
||||
<FundingContext.Consumer>
|
||||
{({ needsInit, initVaultAndLP, standardTokenApproval }) =>
|
||||
<Fragment>
|
||||
{needsInit && <Button variant="outlined" color="secondary" onClick={initVaultAndLP}>
|
||||
Initialize Contracts
|
||||
</Button>}
|
||||
<Button variant="outlined" color="primary" onClick={standardTokenApproval}>
|
||||
GIVE VAULT TOKEN APPROVAL
|
||||
</Button>
|
||||
<SetMockedTime />
|
||||
</Fragment>
|
||||
}
|
||||
</FundingContext.Consumer>
|
||||
)
|
||||
|
||||
export default ContractAdmin
|
34
app/dapp.js
34
app/dapp.js
|
@ -1,4 +1,5 @@
|
|||
import React from 'react';
|
||||
import React from 'react'
|
||||
import { HashRouter as Router, Route, Link, Switch } from 'react-router-dom'
|
||||
import EmbarkJS from 'Embark/EmbarkJS';
|
||||
import LPVault from 'Embark/contracts/LPVault';
|
||||
import LiquidPledgingMock from 'Embark/contracts/LiquidPledgingMock';
|
||||
|
@ -17,6 +18,7 @@ import { cancelProfile } from './utils/fundProfiles'
|
|||
import SetMockedTime from './components/SetMockedTime'
|
||||
import TransfersGraph from './components/TransfersGraph'
|
||||
import MainCointainer from './components/MainCointainer'
|
||||
import ContractAdmin from './components/ContractAdmin'
|
||||
|
||||
const { getNetworkType } = web3.eth.net
|
||||
|
||||
|
@ -88,24 +90,22 @@ class App extends React.Component {
|
|||
render() {
|
||||
const { account, needsInit, lpAllowance, fundProfiles, allPledges, authorizedPayments, transfers, allVaultEvents } = this.state
|
||||
const { appendFundProfile, appendPledges, transferPledgeAmounts, cancelFundProfile } = this
|
||||
const fundingContext = { account, transferPledgeAmounts, authorizedPayments }
|
||||
const fundingContext = { account, transferPledgeAmounts, authorizedPayments, needsInit, initVaultAndLP, standardTokenApproval, }
|
||||
return (
|
||||
<FundingContext.Provider value={fundingContext}>
|
||||
<MainCointainer>
|
||||
{transfers && <TransfersGraph transfers={transfers} vaultEvents={allVaultEvents} />}
|
||||
{!!allPledges.length && <PledgesTable data={allPledges} transferPledgeAmounts={transferPledgeAmounts} fundProfiles={fundProfiles} />}
|
||||
{!!fundProfiles.length && <FunderProfilesTable data={fundProfiles} cancelFundProfile={cancelFundProfile}/>}
|
||||
<AddFunder appendFundProfile={appendFundProfile} />
|
||||
<Divider variant="middle" />
|
||||
<CreateFunding refreshTable={appendPledges} />
|
||||
{needsInit && <Button variant="outlined" color="secondary" onClick={initVaultAndLP}>
|
||||
Initialize Contracts
|
||||
</Button>}
|
||||
<Button variant="outlined" color="primary" onClick={standardTokenApproval}>
|
||||
GIVE VAULT TOKEN APPROVAL
|
||||
</Button>
|
||||
<SetMockedTime />
|
||||
</MainCointainer>
|
||||
<Router>
|
||||
<MainCointainer>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', width: '95vw' }}>
|
||||
{transfers && <TransfersGraph transfers={transfers} vaultEvents={allVaultEvents} />}
|
||||
{!!allPledges.length && <PledgesTable data={allPledges} transferPledgeAmounts={transferPledgeAmounts} fundProfiles={fundProfiles} />}
|
||||
{!!fundProfiles.length && <FunderProfilesTable data={fundProfiles} cancelFundProfile={cancelFundProfile}/>}
|
||||
</div>
|
||||
<AddFunder appendFundProfile={appendFundProfile} />
|
||||
<Divider variant="middle" />
|
||||
<CreateFunding refreshTable={appendPledges} />
|
||||
<Route path="/admin" component={ContractAdmin} />
|
||||
</MainCointainer>
|
||||
</Router>
|
||||
</FundingContext.Provider>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
"ramda": "^0.26.1",
|
||||
"react": "^16.6.3",
|
||||
"react-cytoscapejs": "^1.1.0",
|
||||
"react-dom": "^16.6.3"
|
||||
"react-dom": "^16.6.3",
|
||||
"react-router-dom": "^4.3.1"
|
||||
}
|
||||
}
|
||||
|
|
59
yarn.lock
59
yarn.lock
|
@ -3653,6 +3653,17 @@ heap@0.2.6, heap@^0.2.6:
|
|||
version "0.2.6"
|
||||
resolved "https://registry.yarnpkg.com/heap/-/heap-0.2.6.tgz#087e1f10b046932fc8594dd9e6d378afc9d1e5ac"
|
||||
|
||||
history@^4.7.2:
|
||||
version "4.7.2"
|
||||
resolved "https://registry.yarnpkg.com/history/-/history-4.7.2.tgz#22b5c7f31633c5b8021c7f4a8a954ac139ee8d5b"
|
||||
integrity sha512-1zkBRWW6XweO0NBcjiphtVJVsIQ+SXF29z9DVkceeaSLVMFXHool+fdCZD4spDCfZJCILPILc3bm7Bc+HRi0nA==
|
||||
dependencies:
|
||||
invariant "^2.2.1"
|
||||
loose-envify "^1.2.0"
|
||||
resolve-pathname "^2.2.0"
|
||||
value-equal "^0.4.0"
|
||||
warning "^3.0.0"
|
||||
|
||||
hmac-drbg@^1.0.0:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1"
|
||||
|
@ -3661,7 +3672,7 @@ hmac-drbg@^1.0.0:
|
|||
minimalistic-assert "^1.0.0"
|
||||
minimalistic-crypto-utils "^1.0.1"
|
||||
|
||||
hoist-non-react-statics@^2.3.1, hoist-non-react-statics@^2.5.5:
|
||||
hoist-non-react-statics@^2.3.1, hoist-non-react-statics@^2.5.0, hoist-non-react-statics@^2.5.5:
|
||||
version "2.5.5"
|
||||
resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47"
|
||||
integrity sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw==
|
||||
|
@ -3823,7 +3834,7 @@ inquirer@^6.1.0:
|
|||
strip-ansi "^4.0.0"
|
||||
through "^2.3.6"
|
||||
|
||||
invariant@^2.2.2:
|
||||
invariant@^2.2.1, invariant@^2.2.2, invariant@^2.2.4:
|
||||
version "2.2.4"
|
||||
resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6"
|
||||
dependencies:
|
||||
|
@ -4643,7 +4654,7 @@ looper@^3.0.0:
|
|||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/looper/-/looper-3.0.0.tgz#2efa54c3b1cbaba9b94aee2e5914b0be57fbb749"
|
||||
|
||||
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
|
||||
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.1, loose-envify@^1.4.0:
|
||||
version "1.4.0"
|
||||
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
|
||||
dependencies:
|
||||
|
@ -5418,6 +5429,13 @@ path-to-regexp@0.1.7:
|
|||
version "0.1.7"
|
||||
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c"
|
||||
|
||||
path-to-regexp@^1.7.0:
|
||||
version "1.7.0"
|
||||
resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-1.7.0.tgz#59fde0f435badacba103a84e9d3bc64e96b9937d"
|
||||
integrity sha1-Wf3g9DW62suhA6hOnTvGTpa5k30=
|
||||
dependencies:
|
||||
isarray "0.0.1"
|
||||
|
||||
path-type@^1.0.0:
|
||||
version "1.1.0"
|
||||
resolved "https://registry.yarnpkg.com/path-type/-/path-type-1.1.0.tgz#59c44f7ee491da704da415da5a4070ba4f8fe441"
|
||||
|
@ -5750,6 +5768,31 @@ react-lifecycles-compat@^3.0.2, react-lifecycles-compat@^3.0.4:
|
|||
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
|
||||
integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA==
|
||||
|
||||
react-router-dom@^4.3.1:
|
||||
version "4.3.1"
|
||||
resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-4.3.1.tgz#4c2619fc24c4fa87c9fd18f4fb4a43fe63fbd5c6"
|
||||
integrity sha512-c/MlywfxDdCp7EnB7YfPMOfMD3tOtIjrQlj/CKfNMBxdmpJP8xcz5P/UAFn3JbnQCNUxsHyVVqllF9LhgVyFCA==
|
||||
dependencies:
|
||||
history "^4.7.2"
|
||||
invariant "^2.2.4"
|
||||
loose-envify "^1.3.1"
|
||||
prop-types "^15.6.1"
|
||||
react-router "^4.3.1"
|
||||
warning "^4.0.1"
|
||||
|
||||
react-router@^4.3.1:
|
||||
version "4.3.1"
|
||||
resolved "https://registry.yarnpkg.com/react-router/-/react-router-4.3.1.tgz#aada4aef14c809cb2e686b05cee4742234506c4e"
|
||||
integrity sha512-yrvL8AogDh2X42Dt9iknk4wF4V8bWREPirFfS9gLU1huk6qK41sg7Z/1S81jjTrGHxa3B8R3J6xIkDAA6CVarg==
|
||||
dependencies:
|
||||
history "^4.7.2"
|
||||
hoist-non-react-statics "^2.5.0"
|
||||
invariant "^2.2.4"
|
||||
loose-envify "^1.3.1"
|
||||
path-to-regexp "^1.7.0"
|
||||
prop-types "^15.6.1"
|
||||
warning "^4.0.1"
|
||||
|
||||
react-text-mask@=5.4.1:
|
||||
version "5.4.1"
|
||||
resolved "https://registry.yarnpkg.com/react-text-mask/-/react-text-mask-5.4.1.tgz#c3dd3e550e31d38b7c9da0178a2725960770e443"
|
||||
|
@ -6046,6 +6089,11 @@ resolve-from@^1.0.0:
|
|||
resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-1.0.1.tgz#26cbfe935d1aeeeabb29bc3fe5aeb01e93d44226"
|
||||
integrity sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=
|
||||
|
||||
resolve-pathname@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.2.0.tgz#7e9ae21ed815fd63ab189adeee64dc831eefa879"
|
||||
integrity sha512-bAFz9ld18RzJfddgrO2e/0S2O81710++chRMUxHjXOYKF6jTAMrUNZrEZ1PvV0zlhfjidm08iRPdTLPno1FuRg==
|
||||
|
||||
resolve-url@^0.2.1:
|
||||
version "0.2.1"
|
||||
resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a"
|
||||
|
@ -7059,6 +7107,11 @@ validate-npm-package-license@^3.0.1:
|
|||
spdx-correct "^3.0.0"
|
||||
spdx-expression-parse "^3.0.0"
|
||||
|
||||
value-equal@^0.4.0:
|
||||
version "0.4.0"
|
||||
resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.4.0.tgz#c5bdd2f54ee093c04839d71ce2e4758a6890abc7"
|
||||
integrity sha512-x+cYdNnaA3CxvMaTX0INdTCN8m8aF2uY9BvEqmxuYp8bL09cs/kWVQPVGcA35fMktdOsP69IgU7wFj/61dJHEw==
|
||||
|
||||
vary@^1, vary@~1.1.2:
|
||||
version "1.1.2"
|
||||
resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
|
||||
|
|
Loading…
Reference in New Issue