From 4274e045406e90d29e998304d31e5b0f70598984 Mon Sep 17 00:00:00 2001 From: shubham Date: Fri, 13 Dec 2024 15:15:03 +0530 Subject: [PATCH 1/2] format block height with commas --- views/NodeInfo.tsx | 3 ++- views/Sync.tsx | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/views/NodeInfo.tsx b/views/NodeInfo.tsx index 3573b6d3e..841403dbf 100644 --- a/views/NodeInfo.tsx +++ b/views/NodeInfo.tsx @@ -11,6 +11,7 @@ import Screen from '../components/Screen'; import { version } from '../package.json'; import { localeString } from '../utils/LocaleUtils'; import { themeColor } from '../utils/ThemeUtils'; +import { numberWithCommas } from '../utils/UnitsUtils'; import NodeInfoStore from '../stores/NodeInfoStore'; import SettingsStore from '../stores/SettingsStore'; @@ -125,7 +126,7 @@ export default class NodeInfo extends React.Component { {nodeInfo.currentBlockHeight && ( )} diff --git a/views/Sync.tsx b/views/Sync.tsx index 7af285a8a..8bba7f05b 100644 --- a/views/Sync.tsx +++ b/views/Sync.tsx @@ -13,6 +13,7 @@ import SyncStore from '../stores/SyncStore'; import { localeString } from '../utils/LocaleUtils'; import { themeColor } from '../utils/ThemeUtils'; +import { numberWithCommas } from '../utils/UnitsUtils'; interface SyncProps { navigation: StackNavigationProp; @@ -90,13 +91,13 @@ export default class Sync extends React.PureComponent { keyValue={localeString( 'views.Sync.currentBlockHeight' )} - value={currentBlockHeight} + value={numberWithCommas(currentBlockHeight)} /> )} {bestBlockHeight && ( )} {!!numBlocksUntilSynced && ( @@ -104,7 +105,7 @@ export default class Sync extends React.PureComponent { keyValue={localeString( 'views.Sync.numBlocksUntilSynced' )} - value={numBlocksUntilSynced} + value={numberWithCommas(numBlocksUntilSynced)} /> )} From 4e9fef7f7bea7b506b9519781a69b8a6a1722157 Mon Sep 17 00:00:00 2001 From: shubham Date: Sun, 15 Dec 2024 18:49:45 +0530 Subject: [PATCH 2/2] format commas in NetworkInfo view --- views/NetworkInfo.tsx | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/views/NetworkInfo.tsx b/views/NetworkInfo.tsx index 58b03ad03..97fa69521 100644 --- a/views/NetworkInfo.tsx +++ b/views/NetworkInfo.tsx @@ -9,6 +9,7 @@ import Screen from '../components/Screen'; import { localeString } from '../utils/LocaleUtils'; import { themeColor } from '../utils/ThemeUtils'; +import { numberWithCommas } from '../utils/UnitsUtils'; import NodeInfoStore from '../stores/NodeInfoStore'; @@ -32,27 +33,33 @@ export default class NetworkInfo extends React.Component { const NETWORK_INFO = [ { label: 'views.NetworkInfo.numChannels', - value: networkInfo.num_channels || 0 + value: networkInfo.num_channels || 0, + formatValue: true }, { label: 'views.NetworkInfo.numNodes', - value: networkInfo.num_nodes || 0 + value: networkInfo.num_nodes || 0, + formatValue: true }, { label: 'views.NetworkInfo.numZombieChannels', - value: networkInfo.num_zombie_chans || 0 + value: networkInfo.num_zombie_chans || 0, + formatValue: true }, { label: 'views.NetworkInfo.graphDiameter', - value: networkInfo.graph_diameter || 0 + value: networkInfo.graph_diameter || 0, + formatValue: false }, { label: 'views.NetworkInfo.averageOutDegree', - value: networkInfo.avg_out_degree || 0 + value: networkInfo.avg_out_degree || 0, + formatValue: false }, { label: 'views.NetworkInfo.maxOutDegree', - value: networkInfo.max_out_degree || 0 + value: networkInfo.max_out_degree || 0, + formatValue: false } ]; @@ -75,10 +82,14 @@ export default class NetworkInfo extends React.Component { renderItem={({ item }) => ( )} - onRefresh={() => getNetworkInfo} + onRefresh={() => getNetworkInfo()} refreshing={loading} style={styles.content} />