(Update) Display quorum state for a finalized emission funds ballot

This commit is contained in:
Vadim 2018-11-16 12:18:23 +03:00
parent b72d0166e0
commit 68944262d4
2 changed files with 28 additions and 2 deletions

View File

@ -52,6 +52,7 @@ export class BallotCard extends React.Component {
@observable canBeFinalized
@observable hasAlreadyVoted
@observable memo
@observable quorumState
@computed
get cancelOrFinalizeButtonDisplayName() {
@ -81,7 +82,19 @@ export class BallotCard extends React.Component {
@computed
get cancelOrFinalizeDescription() {
if (this.isFinalized || this.isCanceled) {
if (this.isFinalized) {
if (this.props.votingType === 'votingToManageEmissionFunds') {
switch (Number(this.quorumState)) {
case 2:
return 'The funds were sent to the proposed receiver address.'
case 3:
return 'The funds were burnt.'
case 4:
return 'The funds were frozen.'
}
}
return ''
} else if (this.isCanceled) {
return ''
} else if (this.timeToCancel.val > 0) {
return `You can cancel this ballot within ${this.timeToCancel.displayValue}`
@ -266,6 +279,11 @@ export class BallotCard extends React.Component {
this.canBeFinalized = _canBeFinalizedNow
}
getQuorumState = async () => {
const { contractsStore, id, votingType } = this.props
this.quorumState = await this.repeatGetProperty(contractsStore, votingType, id, 'getQuorumState', 0)
}
vote = async ({ choice }) => {
if (this.isCanceled) {
swal('Warning!', messages.INVALID_VOTE_MSG, 'warning')
@ -519,7 +537,7 @@ export class BallotCard extends React.Component {
constructor(props) {
super(props)
const { votingState, contractsStore } = this.props
const { votingState, contractsStore, votingType } = this.props
// getTimes
if (
votingState.hasOwnProperty('creationTime') &&
@ -570,6 +588,10 @@ export class BallotCard extends React.Component {
} else {
this.getHasAlreadyVoted()
}
if (votingType === 'votingToManageEmissionFunds') {
// getQuorumState
this.getQuorumState()
}
this.state = {
detailsCollapsed: this.memo.length > maxDetailsLength
}

View File

@ -69,6 +69,10 @@ export default class VotingToManageEmissionFunds {
return this.instance.methods.getBallotInfo(_id).call()
}
getQuorumState(_id) {
return this.instance.methods.getQuorumState(_id).call()
}
getTime() {
return this.instance.methods.getTime().call()
}