Skip to content

Commit

Permalink
Merge pull request #16 from eco-stake/highlight-ecostake
Browse files Browse the repository at this point in the history
Highlight ECOStake a little more
  • Loading branch information
tombeynon committed Jun 17, 2023
2 parents 6c7e1f6 + 84dd202 commit bf53dec
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/components/ValidatorProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function ValidatorProfile(props) {
const uptime = <span>{_.round(period.uptime * 100, 2)}% <small>(missed {blockPeriod.missed.toLocaleString()} of {blockPeriod.blocks.toLocaleString()} blocks)</small></span>
if(!validator.slashes) return uptime

const slashes = <small>{validator.slashes.length < 1 ? <>Never slashed</> : <>Slashed {validator.slashes.length} times ({_.round(multiply(validator.slashes.reduce((sum, s) => add(sum, s.fraction), 0), 100), 1)}% total stake)</>}</small>
const slashes = <small>{validator.slashes.length < 1 ? <>Never slashed</> : <>Slashed {validator.slashes.length} times ({_.round(multiply(validator.slashes.reduce((sum, s) => add(sum, s.fraction), 0), 100), 2)}% total stake)</>}</small>
return <span>{uptime}<br />{slashes}</span>
}

Expand Down
26 changes: 22 additions & 4 deletions src/components/ValidatorServices.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Link } from 'react-router-dom'
import {
OverlayTrigger,
OverlayTrigger,
Tooltip
} from 'react-bootstrap'
import {
Expand All @@ -20,20 +20,38 @@ function ValidatorServices(props) {

const services = []

if(Object.entries(validator.public_nodes || {}).length){
if(validator.path === 'ecostake'){
const publicNodes = Object.entries(validator.public_nodes || {}).length
let tooltip = 'Created REStake and cosmos.directory'
if(publicNodes) tooltip = <>{tooltip}, and provides public nodes</>
services.push({
key: 'nodes',
tooltip: 'Provides public nodes used by REStake and other apps',
tooltip,
render: () => {
return (
<Link to={`/${network.path}/${validator.address}`} className="text-reset">
<HeartPulse height={props.height || 18} width={props.width || 18} className="d-block" />
<HeartPulse height={props.height || 18} width={props.width || 18} className="d-block text-success" />
</Link>
)
}
})
}else{
if(Object.entries(validator.public_nodes || {}).length){
services.push({
key: 'nodes',
tooltip: 'Provides public nodes used by REStake and other apps',
render: () => {
return (
<Link to={`/${network.path}/${validator.address}`} className="text-reset">
<HeartPulse height={props.height || 18} width={props.width || 18} className="d-block" />
</Link>
)
}
})
}
}


if(validator.services?.staking_rewards){
let verified = validator.services.staking_rewards.verified
let icon = verified ? StakingRewardsVerifiedIcon : StakingRewardsIcon
Expand Down
5 changes: 3 additions & 2 deletions src/components/Validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ function Validators(props) {
const delegation = delegations && delegations[address]
return 0 - (delegation?.balance?.amount || 0)
});
return _.sortBy(validators, ({ operator_address: address, public_nodes }) => {
if(network.data.ownerAddress === address) return -5
return _.sortBy(validators, ({ operator_address: address, public_nodes, path }) => {
if(network.data.ownerAddress === address) return -6
if(path === 'ecostake') return -5

const delegation = delegations && delegations[address]
const publicNodes = Object.entries(public_nodes || {}).length > 0
Expand Down

0 comments on commit bf53dec

Please sign in to comment.