Skip to content

Commit

Permalink
fix: created function format height
Browse files Browse the repository at this point in the history
juliahermak committed Feb 11, 2024
1 parent 70c0afa commit df59ad0
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/nodes/NodesTable.vue
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@
</div>
<div>&nbsp;<br />&nbsp;</div>
</div>
<div v-if="tab === 'adm'">
<div v-else-if="tab === 'adm'">
<v-checkbox
v-model="preferFastestAdmNodeOption"
:label="$t('nodes.fastest_title')"
@@ -77,7 +77,7 @@ const className = 'nodes-table'
const classes = {
root: className,
info: `${className}__info`,
checkbox: `${className}__checkbox `
checkbox: `${className}__checkbox`
}
type Tab = 'adm' | 'coins'
3 changes: 2 additions & 1 deletion src/components/nodes/hooks/useNodeStatus.ts
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ import { useI18n, VueI18nTranslation } from 'vue-i18n'

import { NodeStatusResult } from '@/lib/nodes/abstract.node'
import { NodeStatus } from '@/lib/nodes/types'
import { formatHeight } from '@/components/nodes/utils/formatHeight'

type StatusColor = 'green' | 'red' | 'grey' | 'orange'
type NodeStatusDetail = {
@@ -44,7 +45,7 @@ function getNodeStatusDetail(
}
} else if (node.online) {
return {
text: node.height.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','),
text: formatHeight(node.height),
icon: 'mdi-cube-outline'
}
}
4 changes: 4 additions & 0 deletions src/components/nodes/utils/formatHeight.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export function formatHeight(height: number) {
const formatted = height.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',')
return formatted
}

0 comments on commit df59ad0

Please sign in to comment.