Skip to content

Commit

Permalink
fix: use same function in all percent formattings
Browse files Browse the repository at this point in the history
  • Loading branch information
enzo-bitfly committed Jan 9, 2025
1 parent 4dbe124 commit b709f06
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
20 changes: 9 additions & 11 deletions frontend/components/dashboard/DashboardValidatorOverview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,25 @@ const openValidatorModal = () => {
}
const efficiencyInfos = computed(() =>
TimeFrames.map(k => ({
label: $t(`statistics.${k}`),
value: formatPercent(overview.value?.efficiency[k] ?? 0),
TimeFrames.map(timeFrame => ({
label: $t(`statistics.${timeFrame}`),
value: formatToPercent(overview.value?.efficiency[timeFrame] ?? 0),
})),
)
const rewardsInfos = TimeFrames.map(k =>
createInfo(k, overview.value?.rewards[k] ?? {
const rewardsInfos = TimeFrames.map(timeFrame =>
createInfo(timeFrame, overview.value?.rewards[timeFrame] ?? {
cl: '0',
el: '0',
}, formatValueWei),
)
const apr = computed(() => formatPercent(totalElClNumbers(overview.value?.apr.last_30d ?? {
const apr = computed(() => formatToPercent(totalElClNumbers(overview.value?.apr.last_30d ?? {
cl: 0,
el: 0,
})),
)
const aprInfos = TimeFrames.map(k =>
createInfo(k, overview.value?.apr[k] ?? {
})))
const aprInfos = TimeFrames.map(timeFrame =>
createInfo(timeFrame, overview.value?.apr[timeFrame] ?? {
cl: 0,
el: 0,
}, formatToPercent),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ const openValidatorModal = () => {
{{
$t(`dashboard.validator.summary.tooltip.${compare}`, {
name: groupName,
average: formatPercent(row.average_network_efficiency),
average: formatToPercent(row.average_network_efficiency),
})
}}
</span>
Expand Down
5 changes: 1 addition & 4 deletions frontend/utils/bigMath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ export const subWei = (total: string, value: string): BigNumber | undefined => {

export const totalElClNumbers = (
value: ClElValue<number>,
): number | undefined => {
if (!value) {
return
}
) => {
return value.el + value.cl
}

0 comments on commit b709f06

Please sign in to comment.