Commit 279dd666 authored by isstuev's avatar isstuev

fix tx stats titles

parent 680efdb2
...@@ -76,7 +76,9 @@ const TxsStats = () => { ...@@ -76,7 +76,9 @@ const TxsStats = () => {
> >
{ txCount24h && ( { txCount24h && (
<StatsWidget <StatsWidget
label={ txsStatsQuery.data?.transactions_24h?.title || 'Transactions' } label={ txsStatsQuery.data?.transactions_24h?.title ?
getLabelFromTitle(txsStatsQuery.data?.transactions_24h?.title) :
'Transactions' }
value={ Number(txCount24h).toLocaleString() } value={ Number(txCount24h).toLocaleString() }
period="24h" period="24h"
isLoading={ isLoading } isLoading={ isLoading }
...@@ -85,7 +87,9 @@ const TxsStats = () => { ...@@ -85,7 +87,9 @@ const TxsStats = () => {
) } ) }
{ operationalTxns24h && ( { operationalTxns24h && (
<StatsWidget <StatsWidget
label={ txsStatsQuery.data?.operational_transactions_24h?.title || 'Daily op txns' } label={ txsStatsQuery.data?.operational_transactions_24h?.title ?
getLabelFromTitle(txsStatsQuery.data?.operational_transactions_24h?.title) :
'Daily op txns' }
value={ Number(operationalTxns24h).toLocaleString() } value={ Number(operationalTxns24h).toLocaleString() }
period="24h" period="24h"
isLoading={ isLoading } isLoading={ isLoading }
...@@ -93,7 +97,9 @@ const TxsStats = () => { ...@@ -93,7 +97,9 @@ const TxsStats = () => {
) } ) }
{ pendingTxns && ( { pendingTxns && (
<StatsWidget <StatsWidget
label={ txsStatsQuery.data?.pending_transactions_30m?.title || 'Pending transactions' } label={ txsStatsQuery.data?.pending_transactions_30m?.title ?
getLabelFromTitle(txsStatsQuery.data?.pending_transactions_30m?.title) :
'Pending transactions' }
value={ Number(pendingTxns).toLocaleString() } value={ Number(pendingTxns).toLocaleString() }
period={ isStatsFeatureEnabled ? '30min' : '1h' } period={ isStatsFeatureEnabled ? '30min' : '1h' }
isLoading={ isLoading } isLoading={ isLoading }
...@@ -101,7 +107,9 @@ const TxsStats = () => { ...@@ -101,7 +107,9 @@ const TxsStats = () => {
) } ) }
{ txFeeSum24h && ( { txFeeSum24h && (
<StatsWidget <StatsWidget
label={ txsStatsQuery.data?.transactions_fee_24h?.title || 'Transactions fees' } label={ txsStatsQuery.data?.transactions_fee_24h?.title ?
getLabelFromTitle(txsStatsQuery.data?.transactions_fee_24h?.title) :
'Transactions fees' }
value={ txFeeSum24h.toLocaleString(undefined, { maximumFractionDigits: 2 }) } value={ txFeeSum24h.toLocaleString(undefined, { maximumFractionDigits: 2 }) }
valuePostfix={ thinsp + config.chain.currency.symbol } valuePostfix={ thinsp + config.chain.currency.symbol }
period="24h" period="24h"
...@@ -111,7 +119,9 @@ const TxsStats = () => { ...@@ -111,7 +119,9 @@ const TxsStats = () => {
) } ) }
{ txFeeAvg && ( { txFeeAvg && (
<StatsWidget <StatsWidget
label={ txsStatsQuery.data?.average_transactions_fee_24h?.title || 'Avg. transaction fee' } label={ txsStatsQuery.data?.average_transactions_fee_24h?.title ?
getLabelFromTitle(txsStatsQuery.data?.average_transactions_fee_24h?.title) :
'Avg. transaction fee' }
value={ txFeeAvg.usd ? txFeeAvg.usd : txFeeAvg.valueStr } value={ txFeeAvg.usd ? txFeeAvg.usd : txFeeAvg.valueStr }
valuePrefix={ txFeeAvg.usd ? '$' : undefined } valuePrefix={ txFeeAvg.usd ? '$' : undefined }
valuePostfix={ txFeeAvg.usd ? undefined : thinsp + config.chain.currency.symbol } valuePostfix={ txFeeAvg.usd ? undefined : thinsp + config.chain.currency.symbol }
...@@ -124,4 +134,9 @@ const TxsStats = () => { ...@@ -124,4 +134,9 @@ const TxsStats = () => {
); );
}; };
// remove period from title
function getLabelFromTitle(title: string) {
return title.replace(/\s*\([^)]*\)\s*$/, '');
}
export default React.memo(TxsStats); export default React.memo(TxsStats);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment