fix bug related to spinner not loading

This commit is contained in:
Barry Gitarts 2018-07-01 15:46:39 -04:00
parent f248438e74
commit 9603413242
1 changed files with 4 additions and 3 deletions

View File

@ -112,7 +112,8 @@ class Poll extends PureComponent {
classes
} = this.props;
const { value, originalValue, isSubmitting } = this.state;
const disableVote = balance == 0 || !_canVote || isSubmitting;
const cantVote = balance == 0 || !_canVote;
const disableVote = cantVote || isSubmitting;
const { fromWei } = web3.utils;
const maxValue = Math.floor(Math.sqrt(balance));
const buttonText = originalValue != 0 && value != originalValue ? 'Change Vote' : 'Vote';
@ -126,12 +127,12 @@ class Poll extends PureComponent {
<Typography variant="subheading" color="textSecondary">
<b>Your vote:</b> {value} votes ({value * value} SNT)
</Typography>
{disableVote && <Typography variant="body2" color="error">
{cantVote && <Typography variant="body2" color="error">
{balance == 0 && <span>You can not vote because your account had no SNT when this poll was created</span>}
{balance != 0 && !_canVote && <span>You can not vote on this poll</span>}
</Typography>}
</CardContent>
{!disableVote && <CardActions className={classes.card}>
{!cantVote && <CardActions className={classes.card}>
<Slider style={{ width: '95%' }} classes={{ thumb: classes.thumb }} disabled={disableVote} value={value || 0} min={0} max={maxValue} step={1} onChange={this.handleChange} />
{isSubmitting ? <CircularProgress /> : <Button variant="contained" disabled={disableVote} color="primary" onClick={this.handleClick}>{buttonText}</Button>}
</CardActions>}