From 3e44fa9b28535f03fc1a93fb6adaf0611be1c26d Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Mon, 21 May 2018 16:15:46 -0400 Subject: [PATCH] Adding ProposalContainer component and changed module.exports to export default --- app/components/topnavbar.js | 2 +- .../voting-dapp/proposal-container.js | 33 +++++++++++++++++++ app/components/voting-dapp/proposal-form.js | 18 ++++++++++ app/components/voting-dapp/proposal-list.js | 11 +++++++ app/{ => components}/voting-dapp/proposal.js | 2 +- app/components/voting-dapp/voting-dapp.js | 26 +++++++++++++++ app/dapp.js | 5 +++ 7 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 app/components/voting-dapp/proposal-container.js create mode 100644 app/components/voting-dapp/proposal-form.js create mode 100644 app/components/voting-dapp/proposal-list.js rename app/{ => components}/voting-dapp/proposal.js (89%) create mode 100644 app/components/voting-dapp/voting-dapp.js diff --git a/app/components/topnavbar.js b/app/components/topnavbar.js index d8bc689..2f44c8c 100644 --- a/app/components/topnavbar.js +++ b/app/components/topnavbar.js @@ -1,7 +1,7 @@ import EmbarkJS from 'Embark/EmbarkJS'; import React from 'react'; import { Navbar, NavItem, Nav, MenuItem , NavDropdown} from 'react-bootstrap'; -import AccountList from './accountList'; +import AccountList from './accountlist'; class TopNavbar extends React.Component { diff --git a/app/components/voting-dapp/proposal-container.js b/app/components/voting-dapp/proposal-container.js new file mode 100644 index 0000000..ff90d57 --- /dev/null +++ b/app/components/voting-dapp/proposal-container.js @@ -0,0 +1,33 @@ +import web3 from "Embark/web3" +import EmbarkJS from 'Embark/EmbarkJS'; +import React from 'react'; + +import ProposalForm from './proposal-form'; +import Proposal from './proposal'; +import ProposalList from './proposal-list'; + +class ProposalContainer extends React.Component { + + constructor(props) { + super(props); + this.state = { + proposals: [] + }; + } + + componentDidMount(){ + this.fetchProposals(_p => this.setState({proposals: _p})); + } + + fetchProposals(cb){ + // TODO: populate proposals + cb([1, 2, 3]); + } + + render(){ + return ; + } + +} + +export default ProposalContainer; diff --git a/app/components/voting-dapp/proposal-form.js b/app/components/voting-dapp/proposal-form.js new file mode 100644 index 0000000..58d4a95 --- /dev/null +++ b/app/components/voting-dapp/proposal-form.js @@ -0,0 +1,18 @@ +import web3 from "Embark/web3" +import EmbarkJS from 'Embark/EmbarkJS'; +import React from 'react'; + +class ProposalForm extends React.Component { + + constructor(props) { + super(props); + this.state = {}; + } + + render(){ + return
TODO: Form
; + } + +} + +export default ProposalForm; diff --git a/app/components/voting-dapp/proposal-list.js b/app/components/voting-dapp/proposal-list.js new file mode 100644 index 0000000..da941e9 --- /dev/null +++ b/app/components/voting-dapp/proposal-list.js @@ -0,0 +1,11 @@ +import React from 'react'; +import Proposal from './proposal'; + +const ProposalList = props => + + {props.proposals.map((u, i) => ( + + ))} + + +export default ProposalList; diff --git a/app/voting-dapp/proposal.js b/app/components/voting-dapp/proposal.js similarity index 89% rename from app/voting-dapp/proposal.js rename to app/components/voting-dapp/proposal.js index 728ac4b..ab0ceff 100644 --- a/app/voting-dapp/proposal.js +++ b/app/components/voting-dapp/proposal.js @@ -10,4 +10,4 @@ const Proposal = props =>
-module.exports = Proposal; +export default Proposal; diff --git a/app/components/voting-dapp/voting-dapp.js b/app/components/voting-dapp/voting-dapp.js new file mode 100644 index 0000000..8d7bdd4 --- /dev/null +++ b/app/components/voting-dapp/voting-dapp.js @@ -0,0 +1,26 @@ +import web3 from "Embark/web3" +import EmbarkJS from 'Embark/EmbarkJS'; +import React from 'react'; + +import ProposalForm from './proposal-form'; +import ProposalContainer from './proposal-container'; + +class VotingDapp extends React.Component { + + constructor(props) { + super(props); + this.state = { + + }; + } + + render(){ + return
+ + +
; + } + +} + +export default VotingDapp; diff --git a/app/dapp.js b/app/dapp.js index 12a1ff0..930441e 100644 --- a/app/dapp.js +++ b/app/dapp.js @@ -7,6 +7,8 @@ import TopNavbar from './components/topnavbar'; import TestTokenUI from './components/testtoken'; import ERC20TokenUI from './components/erc20token'; +import VotingDapp from './components/voting-dapp/voting-dapp'; + import './dapp.css'; class App extends React.Component { @@ -34,6 +36,9 @@ class App extends React.Component {
+ + +