@@ -66,17 +66,16 @@ export default class Proposal extends Component{
66
66
67
67
componentDidUpdate ( prevProps ) {
68
68
if ( this . props . proposal != prevProps . proposal ) {
69
- // console.log(this.props.proposal.value);
70
69
this . setState ( {
71
70
proposal : this . props . proposal ,
72
71
deposit : < div > { this . props . proposal . total_deposit ?this . props . proposal . total_deposit . map ( ( deposit , i ) => {
73
- return < div key = { i } > { new Coin ( deposit . amount , deposit . denom ) . toString ( ) } </ div >
72
+ return < div key = { i } > { new Coin ( deposit . amount , deposit . denom ) . toString ( 6 ) } </ div >
74
73
} ) :'' } </ div >
75
74
} ) ;
76
75
77
76
let now = moment ( ) ;
78
77
const powerReduction = Meteor . settings . public . powerReduction || Coin . StakingCoin . fraction ;
79
- let totalVotingPower = this . props . chain . activeVotingPower * powerReduction ;
78
+ let totalVotingPower = ( this . props . activeVotingPower || this . props . chain . activeVotingPower ) * powerReduction ;
80
79
if ( this . props . proposal . voting_start_time != '0001-01-01T00:00:00Z' ) {
81
80
if ( now . diff ( moment ( this . props . proposal . voting_start_time ) ) > 0 ) {
82
81
let endVotingTime = moment ( this . props . proposal . voting_end_time ) ;
@@ -97,7 +96,7 @@ export default class Proposal extends Component{
97
96
abstainPercent : ( totalVotes > 0 ) ?parseInt ( this . props . proposal . tally . abstain ) / totalVotes * 100 :0 ,
98
97
noPercent : ( totalVotes > 0 ) ?parseInt ( this . props . proposal . tally . no ) / totalVotes * 100 :0 ,
99
98
noWithVetoPercent : ( totalVotes > 0 ) ?parseInt ( this . props . proposal . tally . no_with_veto ) / totalVotes * 100 :0 ,
100
- proposalValid : ( this . state . totalVotes / totalVotingPower > parseFloat ( this . props . chain . gov . tallyParams . quorum ) ) ?true :false
99
+ proposalValid : ( this . state . totalVotes / totalVotingPower > parseFloat ( this . props . chain . gov . tally_params . quorum ) ) ?true :false
101
100
} )
102
101
}
103
102
else {
@@ -116,7 +115,7 @@ export default class Proposal extends Component{
116
115
abstainPercent : ( totalVotes > 0 ) ?parseInt ( this . props . proposal . final_tally_result . abstain ) / totalVotes * 100 :0 ,
117
116
noPercent : ( totalVotes > 0 ) ?parseInt ( this . props . proposal . final_tally_result . no ) / totalVotes * 100 :0 ,
118
117
noWithVetoPercent : ( totalVotes > 0 ) ?parseInt ( this . props . proposal . final_tally_result . no_with_veto ) / totalVotes * 100 :0 ,
119
- proposalValid : ( this . state . totalVotes / totalVotingPower > parseFloat ( this . props . chain . gov . tallyParams . quorum ) ) ?true :false
118
+ proposalValid : ( this . state . totalVotes / totalVotingPower > parseFloat ( this . props . chain . gov . tally_params . quorum ) ) ?true :false
120
119
} )
121
120
}
122
121
}
@@ -263,7 +262,7 @@ export default class Proposal extends Component{
263
262
</ Col >
264
263
< Col className = "voting-power-percent data" md = { 3 } >
265
264
< i className = "material-icons d-md-none" > equalizer</ i >
266
- { ( vote . votingPower !== undefined ) ?numbro ( vote . votingPower / this . state . totalVotes ) . format ( '0,0.00 %' ) :"" }
265
+ { ( vote . votingPower !== undefined ) ?numbro ( vote . votingPower / this . state . totalVotes ) . format ( '0,0.000000 %' ) :"" }
267
266
</ Col >
268
267
</ Row > </ Card >
269
268
) }
@@ -280,7 +279,7 @@ export default class Proposal extends Component{
280
279
// console.log(this.state.proposal);
281
280
const proposalId = Number ( this . props . proposal . proposalId ) , maxProposalId = Number ( this . props . proposalCount ) ;
282
281
const powerReduction = Meteor . settings . public . powerReduction || Coin . StakingCoin . fraction ;
283
- let totalVotingPower = this . props . chain . activeVotingPower * powerReduction ;
282
+ let totalVotingPower = ( this . props . activeVotingPower || this . props . chain . activeVotingPower ) * powerReduction ;
284
283
let proposalType = this . props . proposal . content [ "@type" ] . split ( '.' ) ;
285
284
proposalType = proposalType [ proposalType . length - 1 ] . match ( / [ A - Z ] + [ ^ A - Z ] * | [ ^ A - Z ] + / g) . join ( " " ) ;
286
285
@@ -294,7 +293,7 @@ export default class Proposal extends Component{
294
293
< Row className = "mb-2 border-top" >
295
294
< Col md = { 3 } className = "label" > < T > proposals.proposalID</ T > </ Col >
296
295
< Col md = { this . state . user ?6 :9 } className = "value" > { this . props . proposal . proposalId } </ Col >
297
- { /* {this.state.user?<Col md={3}><ProposalActionButtons history={this.props.history} proposalId={proposalId}/></Col>:null } */ }
296
+ { /* {( this.state.user && !this.state.voteEnded) ?<Col md={3}><ProposalActionButtons history={this.props.history} proposalId={proposalId}/></Col>:null } */ }
298
297
</ Row >
299
298
< Row className = "mb-2 border-top" >
300
299
< Col md = { 3 } className = "label" > < T > proposals.proposer</ T > </ Col >
@@ -316,7 +315,7 @@ export default class Proposal extends Component{
316
315
{ ( this . props . proposal . content . type === 'cosmos-sdk/CommunityPoolSpendProposal' ) ?< Row className = "mb-2 border-top" >
317
316
< Col md = { 3 } className = "label" > < T > proposals.amount</ T > </ Col >
318
317
< Col md = { 9 } className = "value" > { this . props . proposal . content . amount . map ( ( amount , j ) => {
319
- return < div key = { j } > { new Coin ( amount . amount , amount . denom ) . toString ( ) } </ div >
318
+ return < div key = { j } > { new Coin ( amount . amount , amount . denom ) . toString ( 6 ) } </ div >
320
319
} ) } </ Col >
321
320
</ Row > :null }
322
321
< Row className = "mb-2 border-top" >
@@ -338,7 +337,7 @@ export default class Proposal extends Component{
338
337
return < li key = { i } >
339
338
< Account address = { deposit . depositor } />
340
339
{ deposit . amount . map ( ( amount , j ) => {
341
- return < div key = { j } > { new Coin ( amount . amount , amount . denom ) . toString ( ) } </ div >
340
+ return < div key = { j } > { new Coin ( amount . amount , amount . denom ) . toString ( 6 ) } </ div >
342
341
} ) }
343
342
</ li >
344
343
} ) :'' }
@@ -439,7 +438,7 @@ export default class Proposal extends Component{
439
438
< Card body className = "tally-info" >
440
439
< em >
441
440
< T _purify = { false } percent = { numbro ( this . state . totalVotes / totalVotingPower ) . format ( "0.00%" ) } > proposals.percentageVoted</ T > < br />
442
- { this . state . proposalValid ?< T _props = { { className :'text-success' } } tentative = { ( ! this . state . voteEnded ) ?'(tentatively) ' :'' } _purify = { false } > proposals.validMessage</ T > :( this . state . voteEnded ) ?< T _props = { { className :'text-danger' } } quorum = { numbro ( this . props . chain . gov . tallyParams . quorum ) . format ( "0.00%" ) } _purify = { false } > proposals.invalidMessage</ T > :< T moreVotes = { numbro ( ( totalVotingPower * this . props . chain . gov . tallyParams . quorum - this . state . totalVotes ) / Meteor . settings . public . powerReduction ) . format ( "0,0" ) } _purify = { false } > proposals.moreVoteMessage</ T > }
441
+ { this . state . proposalValid ?< T _props = { { className :'text-success' } } tentative = { ( ! this . state . voteEnded ) ?'(tentatively) ' :'' } _purify = { false } > proposals.validMessage</ T > :( this . state . voteEnded ) ?< T _props = { { className :'text-danger' } } quorum = { numbro ( this . props . chain . gov . tally_params . quorum ) . format ( "0.00%" ) } _purify = { false } > proposals.invalidMessage</ T > :< T moreVotes = { numbro ( ( totalVotingPower * this . props . chain . gov . tally_params . quorum - this . state . totalVotes ) / Meteor . settings . public . powerReduction ) . format ( "0,0" ) } _purify = { false } > proposals.moreVoteMessage</ T > }
443
442
</ em >
444
443
</ Card >
445
444
</ Col >
0 commit comments