@@ -1044,6 +1044,16 @@ const Analysis: React.FC<Props> = ({
10441044 ( ) => Math . max ( 0 , Math . min ( 100 , displayedMaiaWhiteWinBar . percent ) ) ,
10451045 [ displayedMaiaWhiteWinBar . percent ] ,
10461046 )
1047+ const renderedMaiaWhiteWinBar = useMemo (
1048+ ( ) =>
1049+ analysisEnabled
1050+ ? displayedMaiaWhiteWinBar
1051+ : { hasValue : false , percent : 50 , label : '--' } ,
1052+ [ analysisEnabled , displayedMaiaWhiteWinBar ] ,
1053+ )
1054+ const maiaWhiteWinBarPositionTargetPercent = analysisEnabled
1055+ ? maiaWhiteWinPositionPercent
1056+ : 50
10471057
10481058 const smoothedMaiaWhiteWinPosition = useSpring ( 50 , {
10491059 stiffness : 520 ,
@@ -1056,8 +1066,8 @@ const Analysis: React.FC<Props> = ({
10561066 )
10571067
10581068 useIsomorphicLayoutEffect ( ( ) => {
1059- smoothedMaiaWhiteWinPosition . set ( maiaWhiteWinPositionPercent )
1060- } , [ maiaWhiteWinPositionPercent , smoothedMaiaWhiteWinPosition ] )
1069+ smoothedMaiaWhiteWinPosition . set ( maiaWhiteWinBarPositionTargetPercent )
1070+ } , [ maiaWhiteWinBarPositionTargetPercent , smoothedMaiaWhiteWinPosition ] )
10611071
10621072 const desktopMaiaBubbleReservePx = useMemo (
10631073 ( ) => ( width >= 1360 ? 62 : 52 ) ,
@@ -1197,10 +1207,28 @@ const Analysis: React.FC<Props> = ({
11971207 smoothedEvalPosition ,
11981208 ( value ) => `${ 100 - value } %` ,
11991209 )
1210+ const renderedStockfishEvalBar = useMemo (
1211+ ( ) =>
1212+ analysisEnabled
1213+ ? displayedStockfishEvalBar
1214+ : {
1215+ hasEval : false ,
1216+ pawns : 0 ,
1217+ displayPawns : 0 ,
1218+ label : '--' ,
1219+ } ,
1220+ [ analysisEnabled , displayedStockfishEvalBar ] ,
1221+ )
1222+ const renderedStockfishEvalText = analysisEnabled
1223+ ? displayedStockfishEvalText
1224+ : '--'
1225+ const evalBarPositionTargetPercent = analysisEnabled
1226+ ? evalPositionPercent
1227+ : 50
12001228
12011229 useIsomorphicLayoutEffect ( ( ) => {
1202- smoothedEvalPosition . set ( evalPositionPercent )
1203- } , [ evalPositionPercent , smoothedEvalPosition ] )
1230+ smoothedEvalPosition . set ( evalBarPositionTargetPercent )
1231+ } , [ evalBarPositionTargetPercent , smoothedEvalPosition ] )
12041232
12051233 const NestedGameInfo = ( ) => (
12061234 < div className = "flex w-full flex-col" >
@@ -1486,11 +1514,12 @@ const Analysis: React.FC<Props> = ({
14861514 >
14871515 < div className = "pointer-events-none flex justify-center py-1" >
14881516 < AnalysisMaiaWinrateBar
1489- hasValue = { displayedMaiaWhiteWinBar . hasValue }
1490- displayText = { displayedMaiaWhiteWinBar . label }
1517+ hasValue = { renderedMaiaWhiteWinBar . hasValue }
1518+ displayText = { renderedMaiaWhiteWinBar . label }
14911519 labelPositionTop = {
14921520 smoothedMaiaWhiteWinVerticalPositionLabel
14931521 }
1522+ disabled = { ! analysisEnabled }
14941523 desktopSize = { desktopBarChromeSize }
14951524 />
14961525 </ div >
@@ -1555,9 +1584,10 @@ const Analysis: React.FC<Props> = ({
15551584 </ div >
15561585 < div className = "pointer-events-none flex justify-center py-1" >
15571586 < AnalysisStockfishEvalBar
1558- hasEval = { displayedStockfishEvalBar . hasEval }
1559- displayText = { displayedStockfishEvalText }
1587+ hasEval = { renderedStockfishEvalBar . hasEval }
1588+ displayText = { renderedStockfishEvalText }
15601589 labelPositionTop = { smoothedEvalVerticalPositionLabel }
1590+ disabled = { ! analysisEnabled }
15611591 variant = "desktop"
15621592 desktopSize = { desktopBarChromeSize }
15631593 />
@@ -1786,9 +1816,10 @@ const Analysis: React.FC<Props> = ({
17861816 < div className = "pointer-events-none relative min-h-0 min-w-0 self-stretch" >
17871817 < div className = "absolute inset-y-0 left-[68%] w-4 -translate-x-1/2" >
17881818 < AnalysisStockfishEvalBar
1789- hasEval = { displayedStockfishEvalBar . hasEval }
1790- displayText = { displayedStockfishEvalText }
1819+ hasEval = { renderedStockfishEvalBar . hasEval }
1820+ displayText = { renderedStockfishEvalText }
17911821 labelPositionTop = { smoothedEvalVerticalPositionLabel }
1822+ disabled = { ! analysisEnabled }
17921823 />
17931824 </ div >
17941825 </ div >
0 commit comments