@@ -43,7 +43,6 @@ const AnimatedGameReplay: React.FC<{
4343 onMoveClick,
4444} ) => {
4545 const [ currentMoveIndex , setCurrentMoveIndex ] = useState ( - 1 )
46- const [ isPlaying , setIsPlaying ] = useState ( false ) // Start paused for interactive mode
4746 const [ chess ] = useState ( ( ) => new Chess ( openingFen ) )
4847 const [ currentFen , setCurrentFen ] = useState ( openingFen )
4948 const [ currentMoveQuality , setCurrentMoveQuality ] = useState < string | null > (
@@ -218,14 +217,6 @@ const AnimatedGameReplay: React.FC<{
218217 Watch your opening unfold with move quality indicators
219218 </ p >
220219 </ div >
221- < div className = "flex gap-2" >
222- < button
223- onClick = { ( ) => setIsPlaying ( ! isPlaying ) }
224- className = "rounded bg-human-4 px-2 py-1 text-xs transition-colors hover:bg-human-4/80"
225- >
226- { isPlaying ? 'Pause' : 'Play' }
227- </ button >
228- </ div >
229220 </ div >
230221
231222 { /* Chess Board */ }
@@ -471,16 +462,12 @@ const EvaluationChart: React.FC<{
471462 evaluationChart : DrillPerformanceData [ 'evaluationChart' ]
472463 moveAnalyses : MoveAnalysis [ ]
473464 currentMoveIndex ?: number
474- chartHighlightMove ?: number | null
475465 onHoverMove ?: ( moveIndex : number ) => void
476- onClickMove ?: ( moveIndex : number ) => void
477466} > = ( {
478467 evaluationChart,
479468 moveAnalyses,
480469 currentMoveIndex = - 1 ,
481- chartHighlightMove,
482470 onHoverMove,
483- onClickMove,
484471} ) => {
485472 if ( evaluationChart . length === 0 ) {
486473 return (
@@ -490,7 +477,7 @@ const EvaluationChart: React.FC<{
490477 )
491478 }
492479
493- // Transform data for Recharts with move analysis
480+ // Transform data for Recharts with proper area handling at zero crossings
494481 const chartData = evaluationChart . map ( ( point , index ) => {
495482 // Find corresponding move analysis to get SAN notation
496483 const moveAnalysis = moveAnalyses [ index ]
@@ -502,9 +489,11 @@ const EvaluationChart: React.FC<{
502489 moveClassification : point . moveClassification ,
503490 isCurrentMove : index === currentMoveIndex ,
504491 san : moveAnalysis ?. san || '' ,
505- // For shaded areas - split positive and negative evaluations
492+ // Areas extend from zero line to evaluation (no gaps)
506493 whiteAdvantage : point . evaluation > 0 ? point . evaluation : 0 ,
507494 blackAdvantage : point . evaluation < 0 ? point . evaluation : 0 ,
495+ // Add zero baseline for proper area rendering
496+ zero : 0 ,
508497 }
509498 } )
510499
@@ -529,26 +518,21 @@ const EvaluationChart: React.FC<{
529518 < div className = "mb-3" >
530519 < h4 className = "text-sm font-medium" > Position Evaluation</ h4 >
531520 < p className = "text-xs text-secondary" >
532- Track how the position's value changed throughout the opening
521+ Track how the position's value changed throughout the
522+ post-opening
533523 </ p >
534524 </ div >
535525 < div className = "h-64" >
536526 < ResponsiveContainer width = "100%" height = "100%" >
537527 < ComposedChart
538528 data = { chartData }
539- margin = { { top : 15 , right : 20 , left : 25 , bottom : 25 } }
529+ margin = { { top : 15 , right : 20 , left : - 20 , bottom : 20 } }
540530 onMouseMove = { ( data ) => {
541531 if ( data && data . activeLabel && onHoverMove ) {
542532 const moveIndex = parseInt ( data . activeLabel as string ) - 1
543533 onHoverMove ( moveIndex )
544534 }
545535 } }
546- onClick = { ( data ) => {
547- if ( data && data . activeLabel && onClickMove ) {
548- const moveIndex = parseInt ( data . activeLabel as string ) - 1
549- onClickMove ( moveIndex )
550- }
551- } }
552536 >
553537 < CartesianGrid
554538 strokeDasharray = "3 3"
@@ -561,7 +545,6 @@ const EvaluationChart: React.FC<{
561545 label = { {
562546 value : 'Ply Number' ,
563547 position : 'insideBottom' ,
564- offset : - 15 ,
565548 style : {
566549 textAnchor : 'middle' ,
567550 fill : '#9ca3af' ,
@@ -577,6 +560,7 @@ const EvaluationChart: React.FC<{
577560 label = { {
578561 value : 'Evaluation' ,
579562 angle : - 90 ,
563+ dx : 24 ,
580564 position : 'insideLeft' ,
581565 style : {
582566 textAnchor : 'middle' ,
@@ -587,20 +571,24 @@ const EvaluationChart: React.FC<{
587571 />
588572 < Tooltip content = { < CustomTooltip /> } />
589573
590- { /* Shaded areas for advantage - enhanced visibility */ }
574+ { /* White advantage area (positive evaluations only) */ }
591575 < Area
592576 type = "monotone"
593577 dataKey = "whiteAdvantage"
594578 stroke = "none"
595- fill = "rgba(240, 240, 240, 0.6)"
596- fillOpacity = { 0.7 }
579+ fill = "rgba(255, 255, 255, 0.4)"
580+ fillOpacity = { 0.5 }
581+ connectNulls = { false }
597582 />
583+
584+ { /* Black advantage area (negative evaluations only) */ }
598585 < Area
599586 type = "monotone"
600587 dataKey = "blackAdvantage"
601588 stroke = "none"
602- fill = "rgba(60, 60, 60, 0.6)"
603- fillOpacity = { 0.8 }
589+ fill = "rgba(75, 85, 99, 0.5)"
590+ fillOpacity = { 0.6 }
591+ connectNulls = { false }
604592 />
605593
606594 { /* Reference line at 0 evaluation */ }
@@ -610,44 +598,13 @@ const EvaluationChart: React.FC<{
610598 strokeWidth = { 2 }
611599 />
612600
613- { /* Current move reference line */ }
614- { currentMoveIndex >= 0 && currentMoveIndex < chartData . length && (
615- < ReferenceLine
616- x = { currentMoveIndex + 1 }
617- stroke = "#f59e0b"
618- strokeWidth = { 3 }
619- strokeDasharray = "5 5"
620- opacity = { 0.8 }
621- />
622- ) }
623-
624- { /* Clicked move reference line (from move list) */ }
625- { chartHighlightMove !== null &&
626- chartHighlightMove !== undefined &&
627- chartHighlightMove >= 0 &&
628- chartHighlightMove < chartData . length &&
629- chartHighlightMove !== currentMoveIndex && (
630- < ReferenceLine
631- x = { chartHighlightMove + 1 }
632- stroke = "#ec4899"
633- strokeWidth = { 2 }
634- strokeDasharray = "3 3"
635- opacity = { 0.9 }
636- />
637- ) }
638-
639601 < Line
640602 type = "monotone"
641603 dataKey = "evaluation"
642604 stroke = "#e5e7eb"
643605 strokeWidth = { 2 }
644606 dot = { < CustomDot /> }
645- activeDot = { {
646- r : 8 ,
647- stroke : '#f59e0b' ,
648- strokeWidth : 2 ,
649- fill : '#f59e0b' ,
650- } }
607+ activeDot = { false }
651608 />
652609 </ ComposedChart >
653610 </ ResponsiveContainer >
@@ -835,9 +792,6 @@ export const DrillPerformanceModal: React.FC<Props> = ({
835792 isLastDrill,
836793} ) => {
837794 const [ currentMoveIndex , setCurrentMoveIndex ] = useState ( - 1 )
838- const [ chartHighlightMove , setChartHighlightMove ] = useState < number | null > (
839- null ,
840- )
841795 const [ hoveredMoveIndex , setHoveredMoveIndex ] = useState < number | null > ( null )
842796
843797 const { drill, evaluationChart, moveAnalyses, ratingComparison } =
@@ -848,9 +802,8 @@ export const DrillPerformanceModal: React.FC<Props> = ({
848802 setHoveredMoveIndex ( moveIndex )
849803 }
850804
851- // Handle click on move list - highlight on chart
805+ // Handle click on move list
852806 const handleMoveClick = ( moveIndex : number ) => {
853- setChartHighlightMove ( moveIndex )
854807 setCurrentMoveIndex ( moveIndex )
855808 }
856809
@@ -902,9 +855,7 @@ export const DrillPerformanceModal: React.FC<Props> = ({
902855 evaluationChart = { evaluationChart }
903856 moveAnalyses = { moveAnalyses }
904857 currentMoveIndex = { currentMoveIndex }
905- chartHighlightMove = { chartHighlightMove }
906858 onHoverMove = { handleChartHover }
907- onClickMove = { handleMoveClick }
908859 />
909860 </ div >
910861
0 commit comments