From 2c1a3d106c7592df194c80bb45776aa4a4b2aabd Mon Sep 17 00:00:00 2001 From: Madalina Raicu Date: Wed, 7 Feb 2024 14:39:25 +0000 Subject: [PATCH] chore(trading): refactor last price change render prop --- .../market/market-header-stats.tsx | 4 +++- .../market-header/mobile-market-header.tsx | 1 - .../last-24h-price-change.tsx | 19 +++++-------------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/apps/trading/client-pages/market/market-header-stats.tsx b/apps/trading/client-pages/market/market-header-stats.tsx index b916ad5fe..1b72f5a9c 100644 --- a/apps/trading/client-pages/market/market-header-stats.tsx +++ b/apps/trading/client-pages/market/market-header-stats.tsx @@ -54,7 +54,9 @@ export const MarketHeaderStats = ({ market }: MarketHeaderStatsProps) => { + > + - + { { const t = useT(); const { oneDayCandles, error, fiveDaysCandles } = useCandles({ @@ -37,10 +37,6 @@ export const Last24hPriceChange = ({ fiveDaysCandles.length > 0 && (!oneDayCandles || oneDayCandles?.length === 0) ) { - // render nothing instead of '-' when there is no price change - if (hideZero) { - return null; - } return ( } > - - + {children} ); } if (error || !isNumeric(decimalPlaces)) { - return -; + return {children}; } const candles = oneDayCandles?.map((c) => c.close) || initialValue || []; const change = priceChange(candles); const changePercentage = priceChangePercentage(candles); - // render nothing instead of '-' when there is no price change - if (!change && !changePercentage && hideZero) { - return null; - } - return (