Merge pull request #184 from varasev/issue-183
(Feature) Display a quorum state for a finalized emission funds ballot
This commit is contained in:
commit
b9db941c1e
|
@ -52,6 +52,7 @@ export class BallotCard extends React.Component {
|
||||||
@observable canBeFinalized
|
@observable canBeFinalized
|
||||||
@observable hasAlreadyVoted
|
@observable hasAlreadyVoted
|
||||||
@observable memo
|
@observable memo
|
||||||
|
@observable quorumState
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
get cancelOrFinalizeButtonDisplayName() {
|
get cancelOrFinalizeButtonDisplayName() {
|
||||||
|
@ -81,7 +82,19 @@ export class BallotCard extends React.Component {
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
get cancelOrFinalizeDescription() {
|
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 ''
|
return ''
|
||||||
} else if (this.timeToCancel.val > 0) {
|
} else if (this.timeToCancel.val > 0) {
|
||||||
return `You can cancel this ballot within ${this.timeToCancel.displayValue}`
|
return `You can cancel this ballot within ${this.timeToCancel.displayValue}`
|
||||||
|
@ -266,6 +279,11 @@ export class BallotCard extends React.Component {
|
||||||
this.canBeFinalized = _canBeFinalizedNow
|
this.canBeFinalized = _canBeFinalizedNow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getQuorumState = async () => {
|
||||||
|
const { contractsStore, id, votingType } = this.props
|
||||||
|
this.quorumState = await this.repeatGetProperty(contractsStore, votingType, id, 'getQuorumState', 0)
|
||||||
|
}
|
||||||
|
|
||||||
vote = async ({ choice }) => {
|
vote = async ({ choice }) => {
|
||||||
if (this.isCanceled) {
|
if (this.isCanceled) {
|
||||||
swal('Warning!', messages.INVALID_VOTE_MSG, 'warning')
|
swal('Warning!', messages.INVALID_VOTE_MSG, 'warning')
|
||||||
|
@ -519,7 +537,7 @@ export class BallotCard extends React.Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
const { votingState, contractsStore } = this.props
|
const { votingState, contractsStore, votingType } = this.props
|
||||||
// getTimes
|
// getTimes
|
||||||
if (
|
if (
|
||||||
votingState.hasOwnProperty('creationTime') &&
|
votingState.hasOwnProperty('creationTime') &&
|
||||||
|
@ -570,6 +588,10 @@ export class BallotCard extends React.Component {
|
||||||
} else {
|
} else {
|
||||||
this.getHasAlreadyVoted()
|
this.getHasAlreadyVoted()
|
||||||
}
|
}
|
||||||
|
if (votingType === 'votingToManageEmissionFunds') {
|
||||||
|
// getQuorumState
|
||||||
|
this.getQuorumState()
|
||||||
|
}
|
||||||
this.state = {
|
this.state = {
|
||||||
detailsCollapsed: this.memo.length > maxDetailsLength
|
detailsCollapsed: this.memo.length > maxDetailsLength
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,6 +69,10 @@ export default class VotingToManageEmissionFunds {
|
||||||
return this.instance.methods.getBallotInfo(_id).call()
|
return this.instance.methods.getBallotInfo(_id).call()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getQuorumState(_id) {
|
||||||
|
return this.instance.methods.getQuorumState(_id).call()
|
||||||
|
}
|
||||||
|
|
||||||
getTime() {
|
getTime() {
|
||||||
return this.instance.methods.getTime().call()
|
return this.instance.methods.getTime().call()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue