From 023176256f4047ab6775823de49b80a794293ce4 Mon Sep 17 00:00:00 2001 From: Manish Gupta Date: Mon, 21 Oct 2024 21:16:43 -0400 Subject: [PATCH] Landing table - fix negative values --- components/layout/LandingMetricsTable.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/components/layout/LandingMetricsTable.tsx b/components/layout/LandingMetricsTable.tsx index dafe082e..bd9625f7 100644 --- a/components/layout/LandingMetricsTable.tsx +++ b/components/layout/LandingMetricsTable.tsx @@ -400,6 +400,7 @@ const ChainRankCell = memo(function ChainRankIcon( let rawValue = values[types.indexOf(valueKey)]; let isNegative = rawValue < 0; let value = formatNumber(Math.abs(rawValue), decimals); + let absoluteValue = formatNumber(Math.abs(rawValue), decimals); if (types.includes("value_eth")) { if (!showUsd) { @@ -413,12 +414,20 @@ const ChainRankCell = memo(function ChainRankIcon( values[types.indexOf("value_eth")] * 1000000000, decimals, ); + absoluteValue = formatNumber( + Math.abs(values[types.indexOf("value_eth")]) * 1000000000, + decimals, + ); } } else { value = formatNumber(values[types.indexOf("value_usd")], decimals); + absoluteValue = formatNumber( + Math.abs(values[types.indexOf("value_usd")]), + decimals, + ); } } - return { value, prefix, suffix, isNegative }; + return { value, prefix, suffix, isNegative, absoluteValue }; }, [master, showGwei, showUsd], ); @@ -508,7 +517,7 @@ const ChainRankCell = memo(function ChainRankIcon( {getDisplayValue(metric, values, valueKeys).prefix} )} - {getDisplayValue(metric, values, valueKeys).value} + {getDisplayValue(metric, values, valueKeys).absoluteValue} {getDisplayValue(metric, values, valueKeys).suffix && (
{getDisplayValue(metric, values, valueKeys).suffix}