diff --git a/app/components/AdminView.js b/app/components/AdminView.js
index 5570d5f..5c1fc28 100644
--- a/app/components/AdminView.js
+++ b/app/components/AdminView.js
@@ -1,6 +1,7 @@
import React, { Fragment } from 'react';
import { Tabs, Tab } from 'react-bootstrap';
-import 'bootstrap/dist/css/bootstrap.css';
+//import 'bootstrap/dist/css/bootstrap.css';
+// commented out because it's overriding global CSS, need to migrate to isolated styled components
import TopNavbar from './topnavbar';
import TestTokenUI from './testtoken';
import ERC20TokenUI from './erc20token';
diff --git a/app/components/Voting.js b/app/components/Voting.js
index 4ecef3d..c992474 100644
--- a/app/components/Voting.js
+++ b/app/components/Voting.js
@@ -1,4 +1,4 @@
-import React, { Fragment } from 'react';
+import React, { Fragment, PureComponent } from 'react';
import CssBaseline from '@material-ui/core/CssBaseline';
import 'typeface-roboto';
import AppBar from './standard/AppBar';
@@ -6,14 +6,25 @@ import AddPoll from './simple-voting/AddPoll';
import PollsList from './simple-voting/PollsList';
import StatusLogo from '../ui/components/StatusLogo';
-export default ({ toggleAdmin, rawPolls }) => (
-
-
-
-
-
-
-
- {rawPolls && }
-
-)
+class Voting extends PureComponent {
+ state = { addPoll: false };
+
+ render(){
+ const { toggleAdmin, rawPolls } = this.props;
+ const { addPoll } = this.state;
+ const togglePoll = () => { this.setState({ addPoll: !addPoll })};
+ return (
+
+
+
+
+
+
+ {addPoll && }
+ {rawPolls && }
+
+ )
+ }
+}
+
+export default Voting
diff --git a/app/components/simple-voting/AddPoll.js b/app/components/simple-voting/AddPoll.js
index f5f9c74..f76c71e 100644
--- a/app/components/simple-voting/AddPoll.js
+++ b/app/components/simple-voting/AddPoll.js
@@ -7,6 +7,7 @@ import TextField from '@material-ui/core/TextField';
import Button from '@material-ui/core/Button';
import { map } from 'lodash';
import rlp from 'rlp';
+import LinearProgress from '@material-ui/core/LinearProgress';
import { withStyles } from '@material-ui/core/styles';
import { withFormik } from 'formik';
@@ -83,7 +84,10 @@ const InnerForm = ({
className: classes.textFieldFormLabel
}}
/>
-
+ {!isSubmitting ?
+ :
+
+ }
@@ -98,7 +102,7 @@ const AddPoll = withFormik({
if(description.toString().trim() === "") errors.description = true;
return errors;
},
- async handleSubmit(values, { setSubmitting }) {
+ async handleSubmit(values, { setSubmitting, props }) {
const { description } = values;
const { eth: { getBlockNumber }, utils: { asciiToHex } } = window.web3;
const { addPoll } = PollManager.methods;
@@ -113,9 +117,12 @@ const AddPoll = withFormik({
})
.then(res => {
console.log('sucess:', res);
+ setSubmitting(false);
+ props.togglePoll();
})
.catch(res => {
console.log('fail:', res);
+ setSubmitting(false);
});
}
diff --git a/app/components/standard/AppBar.js b/app/components/standard/AppBar.js
index bc343d8..0c9ef45 100644
--- a/app/components/standard/AppBar.js
+++ b/app/components/standard/AppBar.js
@@ -23,7 +23,7 @@ const styles = {
};
function ButtonAppBar(props) {
- const { classes, toggleAdmin } = props;
+ const { classes, toggleAdmin, togglePoll } = props;
return (
@@ -34,7 +34,7 @@ function ButtonAppBar(props) {
What should we build next?
-
+