diff --git a/apps/trading/components/market-header/mobile-market-header.tsx b/apps/trading/components/market-header/mobile-market-header.tsx index 7d3f852d7..0fd0c08e6 100644 --- a/apps/trading/components/market-header/mobile-market-header.tsx +++ b/apps/trading/components/market-header/mobile-market-header.tsx @@ -40,7 +40,7 @@ export const MobileMarketHeader = () => { data-testid="popover-trigger" className="min-w-0 flex gap-1 items-center" > -

+

{data ? data.tradableInstrument.instrument.code @@ -88,6 +88,7 @@ export const MobileMarketHeader = () => { } // dont render anything so price is vertically centered /> diff --git a/libs/markets/src/lib/components/last-24h-price-change/last-24h-price-change.tsx b/libs/markets/src/lib/components/last-24h-price-change/last-24h-price-change.tsx index ab45f7975..a5a985a4a 100644 --- a/libs/markets/src/lib/components/last-24h-price-change/last-24h-price-change.tsx +++ b/libs/markets/src/lib/components/last-24h-price-change/last-24h-price-change.tsx @@ -1,3 +1,4 @@ +import { type ReactNode } from 'react'; import { addDecimalsFormatNumber, formatNumberPercentage, @@ -14,20 +15,27 @@ import { useT } from '../../use-t'; interface Props { marketId?: string; decimalPlaces: number; - isHeader?: boolean; - noUpdate?: boolean; + fallback: ReactNode; } -export const Last24hPriceChange = ({ marketId, decimalPlaces }: Props) => { +export const Last24hPriceChange = ({ + marketId, + decimalPlaces, + fallback, +}: Props) => { const t = useT(); const { oneDayCandles, error, fiveDaysCandles } = useCandles({ marketId, }); - const fallback = {'-'}; + const nonIdeal = fallback || {'-'}; if (error || !oneDayCandles || !fiveDaysCandles) { - return fallback; + return nonIdeal; + } + + if (fiveDaysCandles.length < 24) { + return nonIdeal; } if (oneDayCandles.length < 24) { @@ -45,7 +53,7 @@ export const Last24hPriceChange = ({ marketId, decimalPlaces }: Props) => { } > - {fallback} + {nonIdeal} ); }