From 46e57ae8e2691514e9d8071d2a5cb7a9e4625005 Mon Sep 17 00:00:00 2001 From: Barry Gitarts Date: Thu, 12 Jul 2018 15:54:13 -0400 Subject: [PATCH] display poll in app --- .../simple-voting/OrderingFilter.js | 4 +- app/components/simple-voting/PollsList.js | 55 +++++++++++++++++-- package.json | 1 + 3 files changed, 54 insertions(+), 6 deletions(-) diff --git a/app/components/simple-voting/OrderingFilter.js b/app/components/simple-voting/OrderingFilter.js index 8d30b8d..84397f0 100644 --- a/app/components/simple-voting/OrderingFilter.js +++ b/app/components/simple-voting/OrderingFilter.js @@ -74,9 +74,9 @@ class OrderingDialog extends PureComponent { onClose={this.handleClose} TransitionComponent={Transition} > - + - + diff --git a/app/components/simple-voting/PollsList.js b/app/components/simple-voting/PollsList.js index 6b9dbda..92a1dde 100644 --- a/app/components/simple-voting/PollsList.js +++ b/app/components/simple-voting/PollsList.js @@ -1,12 +1,19 @@ import React, { Fragment, PureComponent } from 'react'; +import AppBar from '@material-ui/core/AppBar'; +import Toolbar from '@material-ui/core/Toolbar'; +import Iframe from 'react-iframe'; import Card from '@material-ui/core/Card'; import CardContent from '@material-ui/core/CardContent'; import CardActions from '@material-ui/core/CardActions'; import Button from '@material-ui/core/Button'; +import Dialog from '@material-ui/core/Dialog'; +import Slide from '@material-ui/core/Slide'; import Typography from '@material-ui/core/Typography'; import Slider from '@material-ui/lab/Slider'; import PollManager from 'Embark/contracts/PollManager'; import MiniMeTokenInterface from 'Embark/contracts/MiniMeTokenInterface'; +import IconButton from '@material-ui/core/IconButton'; +import CloseIcon from '@material-ui/icons/Close'; import web3 from "Embark/web3" import CircularProgress from '@material-ui/core/CircularProgress'; import { withStyles } from '@material-ui/core/styles'; @@ -21,7 +28,16 @@ const styles = { thumb: { width: '24px', height: '24px' - } + }, + appBar: { + position: 'relative', + }, + flex: { + flex: 1, + }, +}; +function Transition(props) { + return ; }; const getIdeaFromStr = str => { @@ -39,9 +55,17 @@ class Poll extends PureComponent { constructor(props){ super(props); - this.state = { value: 0, balance: 0, isSubmitting: false }; + this.state = { value: 0, balance: 0, isSubmitting: false, open: false }; } + handleClickOpen = () => { + this.setState({ open: true }); + }; + + handleClose = () => { + this.setState({ open: false }); + }; + handleChange = (event, value) => { this.setState({ value }) }; @@ -125,7 +149,7 @@ class Poll extends PureComponent { const maxValue = Math.floor(Math.sqrt(balance)); const buttonText = originalValue != 0 && value != originalValue ? 'Change Vote' : 'Vote'; const idea = getIdeaFromStr(_description) - const ideaSite = ideaSites.filter(site => site.includes(idea)); + const ideaSite = ideaSites && ideaSites.filter(site => site.includes(idea)); return ( @@ -141,7 +165,30 @@ class Poll extends PureComponent { {balance != 0 && !_canVote && You can not vote on this poll} } {error && {error}} - {ideaSite.length && {ideaSite}} + {ideaSite.length && {ideaSite}} + {ideaSite && + + + + + + + close + + + +