Skip to content
Snippets Groups Projects
Commit 6ff259cc authored by NGUYEN DINH Quoc-Huy's avatar NGUYEN DINH Quoc-Huy
Browse files

Display HP needed to rank up

parent 466ab7cd
No related branches found
No related tags found
2 merge requests!11merge autoclave into master,!7Refresh Witnesses page design
...@@ -10,7 +10,7 @@ import Userpic from 'app/components/elements/Userpic'; ...@@ -10,7 +10,7 @@ import Userpic from 'app/components/elements/Userpic';
import ByteBuffer from 'bytebuffer'; import ByteBuffer from 'bytebuffer';
import { is, Set, List } from 'immutable'; import { is, Set, List } from 'immutable';
import * as globalActions from 'app/redux/GlobalReducer'; import * as globalActions from 'app/redux/GlobalReducer';
import { vestsToHp, numberWithCommas } from 'app/utils/StateFunctions'; import { vestsToHpf, numberWithCommas } from 'app/utils/StateFunctions';
import tt from 'counterpart'; import tt from 'counterpart';
const Long = ByteBuffer.Long; const Long = ByteBuffer.Long;
...@@ -117,6 +117,7 @@ class Witnesses extends React.Component { ...@@ -117,6 +117,7 @@ class Witnesses extends React.Component {
let witness_vote_count = 30; let witness_vote_count = 30;
let rank = 1; let rank = 1;
let foundWitnessToHighlight = false; let foundWitnessToHighlight = false;
let previousTotalVoteHpf = 0;
const witnesses = sorted_witnesses.map(item => { const witnesses = sorted_witnesses.map(item => {
const owner = item.get('owner'); const owner = item.get('owner');
...@@ -124,12 +125,29 @@ class Witnesses extends React.Component { ...@@ -124,12 +125,29 @@ class Witnesses extends React.Component {
foundWitnessToHighlight = true; foundWitnessToHighlight = true;
} }
const totalVotesVests = item.get('votes'); const totalVotesVests = item.get('votes');
const totalVotesHp = numberWithCommas( const totalVotesHpf = vestsToHpf(
vestsToHp( this.props.state,
this.props.state, `${totalVotesVests / 1000000} VESTS`
`${totalVotesVests / 1000000} VESTS`
)
); );
const totalVotesHp = numberWithCommas(totalVotesHpf.toFixed(3));
let requiredHpToRankUp = '';
if (previousTotalVoteHpf !== 0) {
requiredHpToRankUp = (
<small>
{tt('witnesses_jsx.hp_required_to_rank_up', {
votehp: numberWithCommas(
(previousTotalVoteHpf - totalVotesHpf).toFixed(
3
)
),
})}
</small>
);
}
previousTotalVoteHpf = totalVotesHpf;
const thread = item.get('url').replace('steemit.com', 'hive.blog'); const thread = item.get('url').replace('steemit.com', 'hive.blog');
const myVote = witness_votes ? witness_votes.has(owner) : null; const myVote = witness_votes ? witness_votes.has(owner) : null;
const signingKey = item.get('signing_key'); const signingKey = item.get('signing_key');
...@@ -240,7 +258,11 @@ class Witnesses extends React.Component { ...@@ -240,7 +258,11 @@ class Witnesses extends React.Component {
</div> </div>
</div> </div>
</td> </td>
<td className="Witnesses__votes">{`${totalVotesHp} HP`}</td> <td className="Witnesses__votes">
{`${totalVotesHp} HP`}
<br />
{requiredHpToRankUp}
</td>
<td>{missedBlocks} blocks</td> <td>{missedBlocks} blocks</td>
<td> <td>
<Link <Link
......
...@@ -502,7 +502,8 @@ ...@@ -502,7 +502,8 @@
"last_block": "Last block", "last_block": "Last block",
"running_version": "Running version", "running_version": "Running version",
"received_hp_votes": "Received %(votehp)s worth of votes", "received_hp_votes": "Received %(votehp)s worth of votes",
"votes_received": "Votes received" "votes_received": "Votes received",
"hp_required_to_rank_up": "Needs %(votehp)s to level up"
}, },
"votesandcomments_jsx": { "votesandcomments_jsx": {
"no_responses_yet_click_to_respond": "no_responses_yet_click_to_respond":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment