@@ -28,6 +28,7 @@ import {
2828import { TrendingUp , TrendingDown , Dumbbell , X , Activity , Layers , PersonStanding , BicepsFlexed } from 'lucide-react' ;
2929import { normalizeMuscleGroup , type NormalizedMuscleGroup } from '../utils/muscle/muscleNormalization' ;
3030import { LazyRender } from './LazyRender' ;
31+ import { formatDeltaPercentage , getDeltaFormatPreset } from '../utils/format/deltaFormat' ;
3132import { ChartSkeleton } from './ChartSkeleton' ;
3233import { Tooltip as HoverTooltip , TooltipData } from './Tooltip' ;
3334import { CHART_TOOLTIP_STYLE } from '../utils/ui/uiConstants' ;
@@ -493,11 +494,15 @@ export const MuscleAnalysis: React.FC<MuscleAnalysisProps> = ({ data, filtersSlo
493494 const delta = Number ( ( current - previous ) . toFixed ( 1 ) ) ;
494495 const deltaPercent = Math . round ( ( delta / previous ) * 100 ) ;
495496
497+ // Use centralized formatting for better UX with large percentages
498+ const formattedPercent = formatDeltaPercentage ( deltaPercent , getDeltaFormatPreset ( 'badge' ) ) ;
499+
496500 return {
497501 current,
498502 previous,
499503 delta,
500504 deltaPercent,
505+ formattedPercent,
501506 direction : delta > 0 ? 'up' : delta < 0 ? 'down' : 'same' as 'up' | 'down' | 'same' ,
502507 } ;
503508 } , [ trendData ] ) ;
@@ -851,7 +856,7 @@ export const MuscleAnalysis: React.FC<MuscleAnalysisProps> = ({ data, filtersSlo
851856 : 'bg-rose-500/10 text-rose-400'
852857 } `} >
853858 { volumeDelta . direction === 'up' ? < TrendingUp className = "w-3 h-3" /> : < TrendingDown className = "w-3 h-3" /> }
854- { volumeDelta . direction === 'up' ? '+' : '' } { volumeDelta . deltaPercent } % vs prev { trendPeriod === 'weekly' ? 'wk' : trendPeriod === 'monthly' ? 'mo' : 'day' }
859+ { volumeDelta . formattedPercent } vs prev { trendPeriod === 'weekly' ? 'wk' : trendPeriod === 'monthly' ? 'mo' : 'day' }
855860 </ span >
856861 ) }
857862 </ div >
0 commit comments