Skip to content
This repository was archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
Shares time logic (#4125)
Browse files Browse the repository at this point in the history
  • Loading branch information
wolovim authored and evertonfraga committed Oct 16, 2018
1 parent f238411 commit c620110
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions interface/components/NodeInfo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,7 @@ class NodeInfo extends Component {
<div className="block-number row-icon">
<i className="icon icon-layers" /> {formattedBlockNumber}
</div>
<div
className={
diff > 60 ? 'block-diff row-icon red' : 'block-diff row-icon'
}
>
{
// TODO: make this i8n compatible
}
<i className="icon icon-clock" />
{diff < 120
? diff + ' seconds'
: Math.floor(diff / 60) + ' minutes'}
</div>
{this.renderTimeSince(diff)}
</div>
);
}
Expand Down Expand Up @@ -147,6 +135,23 @@ class NodeInfo extends Component {
);
}

renderTimeSince(diff) {
return (
<div
title={i18n.t('mist.nodeInfo.timeSinceBlock')}
className={
diff > 60 ? 'block-diff row-icon red' : 'block-diff row-icon'
}
>
{
// TODO: make this i8n compatible
}
<i className="icon icon-clock" />
{diff < 120 ? diff + ' seconds' : Math.floor(diff / 60) + ' minutes'}
</div>
);
}

localStatsSynced() {
const { blockNumber, timestamp, syncMode } = this.props.local;
const formattedBlockNumber = numeral(blockNumber).format('0,0');
Expand All @@ -168,12 +173,7 @@ class NodeInfo extends Component {
{` ${this.props.local.peerCount} ${i18n.t('mist.nodeInfo.peers')}`}
</div>
)}
<div
className="block-diff row-icon"
title={i18n.t('mist.nodeInfo.timeSinceBlock')}
>
<i className="icon icon-clock" /> {diff} seconds
</div>
{this.renderTimeSince(diff)}
</div>
);
}
Expand Down

0 comments on commit c620110

Please sign in to comment.