@@ -421,6 +421,17 @@ const Analysis: React.FC<Props> = ({
421421} : Props ) => {
422422 const { width, height } = useContext ( WindowSizeContext )
423423 const isMobile = useMemo ( ( ) => width > 0 && width <= 670 , [ width ] )
424+ const useMobileStyleAnalysisLayout = useMemo ( ( ) => {
425+ if ( isMobile ) return true
426+
427+ // Use mobile-style analysis layout for tablet/medium widths to avoid the
428+ // cramped intermediate desktop layout (e.g. iPad and narrow desktop windows).
429+ return width > 670 && width <= 1120
430+ } , [ isMobile , width ] )
431+ const isTabletUsingMobileStyleLayout = useMemo (
432+ ( ) => useMobileStyleAnalysisLayout && ! isMobile ,
433+ [ isMobile , useMobileStyleAnalysisLayout ] ,
434+ )
424435 const desktopBoardHeaderStripRef = useRef < HTMLDivElement | null > ( null )
425436 const desktopBlunderMeterSectionRef = useRef < HTMLDivElement | null > ( null )
426437 const [ desktopMiddleMeasuredHeights , setDesktopMiddleMeasuredHeights ] =
@@ -430,7 +441,7 @@ const Analysis: React.FC<Props> = ({
430441 } )
431442
432443 useIsomorphicLayoutEffect ( ( ) => {
433- if ( isMobile ) return
444+ if ( useMobileStyleAnalysisLayout ) return
434445
435446 const headerEl = desktopBoardHeaderStripRef . current
436447 const blunderEl = desktopBlunderMeterSectionRef . current
@@ -462,7 +473,7 @@ const Analysis: React.FC<Props> = ({
462473 // Intentionally avoid observing live content changes here; the blunder-meter
463474 // rows can vary slightly by move, which causes distracting board-size jitter
464475 // during arrow-key paging. Re-measure on width changes only.
465- } , [ isMobile , width ] )
476+ } , [ useMobileStyleAnalysisLayout , width ] )
466477 const [ hoverArrow , setHoverArrow ] = useState < DrawShape | null > ( null )
467478 const [ currentSquare , setCurrentSquare ] = useState < Key | null > ( null )
468479 const [ promotionFromTo , setPromotionFromTo ] = useState <
@@ -1185,7 +1196,9 @@ const Analysis: React.FC<Props> = ({
11851196 > ( desktopLeftPanelTabs [ 0 ] . id )
11861197
11871198 useEffect ( ( ) => {
1188- if ( isMobile || desktopLeftPanelTab !== 'select-game' ) return
1199+ if ( useMobileStyleAnalysisLayout || desktopLeftPanelTab !== 'select-game' ) {
1200+ return
1201+ }
11891202
11901203 const keyboardNavigationDisabled =
11911204 controller . gameAnalysis . progress . isAnalyzing ||
@@ -1231,7 +1244,7 @@ const Analysis: React.FC<Props> = ({
12311244 controller . goToPreviousNode ,
12321245 controller . learnFromMistakes . state . isActive ,
12331246 desktopLeftPanelTab ,
1234- isMobile ,
1247+ useMobileStyleAnalysisLayout ,
12351248 ] )
12361249
12371250 const smoothedEvalPosition = useSpring ( 50 , {
@@ -1945,11 +1958,18 @@ const Analysis: React.FC<Props> = ({
19451958 }
19461959 />
19471960 </ div >
1948- < div className = "relative bottom-0 h-48 max-h-48 flex-1 overflow-auto overflow-y-hidden" >
1961+ < div
1962+ className = { `relative bottom-0 overflow-auto overflow-y-hidden ${
1963+ isTabletUsingMobileStyleLayout
1964+ ? 'h-12 max-h-12 flex-none'
1965+ : 'h-48 max-h-48 flex-1'
1966+ } `}
1967+ >
19491968 < MovesContainer
19501969 game = { analyzedGame }
19511970 termination = { analyzedGame . termination }
19521971 showAnnotations = { true }
1972+ forceMobileLayout = { useMobileStyleAnalysisLayout }
19531973 disableKeyboardNavigation = {
19541974 controller . gameAnalysis . progress . isAnalyzing ||
19551975 controller . learnFromMistakes . state . isActive
@@ -2185,7 +2205,11 @@ const Analysis: React.FC<Props> = ({
21852205 ) : null }
21862206 </ AnimatePresence >
21872207 < TreeControllerContext . Provider value = { controller } >
2188- { analyzedGame && < div > { isMobile ? mobileLayout : desktopLayout } </ div > }
2208+ { analyzedGame && (
2209+ < div >
2210+ { useMobileStyleAnalysisLayout ? mobileLayout : desktopLayout }
2211+ </ div >
2212+ ) }
21892213 </ TreeControllerContext . Provider >
21902214 < AnimatePresence >
21912215 { showCustomModal && (
0 commit comments