import React from 'react'; import ReactDOM from 'react-dom'; import EmbarkJS from 'Embark/EmbarkJS'; import Delegation from 'Embark/contracts/Delegation'; import { HashRouter, Route, Redirect, Link } from "react-router-dom"; import './TopicDemocracy.css'; import DelegationUI from './components/DelegationUI'; import DelegationFactoryUI from './components/DelegationFactoryUI'; import { CssBaseline, AppBar, Toolbar, Typography, withStyles } from '@material-ui/core'; const styles = theme => ({ appBar: { position: 'relative', }, layout: { width: 'auto', marginLeft: theme.spacing.unit * 2, marginRight: theme.spacing.unit * 2, [theme.breakpoints.up(600 + theme.spacing.unit * 2 * 2)]: { width: 600, marginLeft: 'auto', marginRight: 'auto', }, }, }) class TopicDemocracy extends React.Component { constructor(props) { super(props); //this.handleSelect = this.handleSelect.bind(this); this.state = { error: null, defaultAccount: null }; } componentDidMount() { EmbarkJS.onReady((err) => { if (err) { return this.setState({ error: err.message || err }); } this.setState({ defaultAccount: web3.eth.defaultAccount, blockchainEnabled: true }) }); } render() { const { classes } = this.props; const { blockchainEnabled, defaultAccount } = this.state; if (!blockchainEnabled) { return (
Waiting for blockchain.
) } if (!defaultAccount) { return (
Waiting for account.
) } return ( Topic Democracy
( )} /> ( )} />
) } } export default withStyles(styles)(TopicDemocracy);