Skip to content

Commit

Permalink
Make validator info line work even when stake percentage is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
sisou committed Oct 7, 2024
1 parent 5c46eff commit 16dd1fe
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/prestaking/ValidatorListItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
<!-- <ValidatorTrustScore v-if="'trust' in validator" :score="validator.trust" />
<strong v-if="'trust' in validator && payoutText" class="dot">&middot;</strong>
<div v-if="payoutText" class="validator-payout">{{ payoutText }}</div> -->
<div v-if="validatorStake" class="validator-stake">
{{ $t('Stake: {validatorStake}%', { validatorStake }) }}
<div v-if="validator.stake !== null" class="validator-stake">
{{ $t('Stake: {validatorStake}%', { validatorStake: validatorStakePercentage }) }}
</div>
<template v-if="isUnderdog">
<strong class="dot">&middot;</strong>
Expand Down Expand Up @@ -79,16 +79,16 @@ export default defineComponent({
console.log('validator changed', props.validator.stake); // eslint-disable-line no-console
});
const validatorStake = computed(
const validatorStakePercentage = computed(
() => Math.round(((props.validator.stake || 0) / globalStake.value) * 1000) / 10,
);
const isUnderdog = computed(() => validatorStake.value && validatorStake.value < 10);
const hasHighStake = computed(() => validatorStake.value && validatorStake.value >= 20);
const isUnderdog = computed(() => props.validator.stake !== null && validatorStakePercentage.value < 10);
const hasHighStake = computed(() => props.validator.stake !== null && validatorStakePercentage.value >= 20);
return {
// payoutText,
validatorStake,
validatorStakePercentage,
isUnderdog,
hasHighStake,
};
Expand Down

0 comments on commit 16dd1fe

Please sign in to comment.