1- import React , { useState , useMemo , useEffect } from 'react'
1+ import React , { useState , useMemo , useEffect , useContext } from 'react'
22import Image from 'next/image'
3- import { AnimatePresence , motion } from 'framer-motion'
3+ import { motion } from 'framer-motion'
44import Chessground from '@react-chess/chessground'
55import {
66 Opening ,
@@ -11,6 +11,7 @@ import {
1111import { ModalContainer } from '../Misc/ModalContainer'
1212import { useTour } from 'src/contexts'
1313import { tourConfigs } from 'src/config/tours'
14+ import { WindowSizeContext } from 'src/contexts/WindowSizeContext'
1415
1516const MAIA_VERSIONS = [
1617 { id : 'maia_kdd_1100' , name : 'Maia 1100' } ,
@@ -37,40 +38,47 @@ const TabNavigation: React.FC<{
3738 activeTab : MobileTab
3839 setActiveTab : ( tab : MobileTab ) => void
3940 selectionsCount : number
40- } > = ( { activeTab, setActiveTab, selectionsCount } ) => (
41- < div className = "flex w-full border-b border-white/10 md:hidden" >
42- < button
43- onClick = { ( ) => setActiveTab ( 'browse' ) }
44- className = { `flex-1 py-3 text-sm font-medium transition-colors ${
45- activeTab === 'browse'
46- ? 'border-b-2 border-human-4 text-primary'
47- : 'text-secondary hover:text-primary'
48- } `}
49- >
50- Browse
51- </ button >
52- < button
53- onClick = { ( ) => setActiveTab ( 'preview' ) }
54- className = { `flex-1 py-3 text-sm font-medium transition-colors ${
55- activeTab === 'preview'
56- ? 'border-b-2 border-human-4 text-primary'
57- : 'text-secondary hover:text-primary'
58- } `}
59- >
60- Preview
61- </ button >
62- < button
63- onClick = { ( ) => setActiveTab ( 'selected' ) }
64- className = { `flex-1 py-3 text-sm font-medium transition-colors ${
65- activeTab === 'selected'
66- ? 'border-b-2 border-human-4 text-primary'
67- : 'text-secondary hover:text-primary'
68- } `}
69- >
70- Selected ({ selectionsCount } )
71- </ button >
72- </ div >
73- )
41+ } > = ( { activeTab, setActiveTab, selectionsCount } ) => {
42+ const { isMobile } = useContext ( WindowSizeContext )
43+
44+ return (
45+ < div className = "flex w-full border-b border-white/10 md:hidden" >
46+ < button
47+ { ...( isMobile ? { id : 'opening-drill-browse' } : { } ) }
48+ onClick = { ( ) => setActiveTab ( 'browse' ) }
49+ className = { `flex-1 py-3 text-sm font-medium transition-colors ${
50+ activeTab === 'browse'
51+ ? 'border-b-2 border-human-4 text-primary'
52+ : 'text-secondary hover:text-primary'
53+ } `}
54+ >
55+ Browse
56+ </ button >
57+ < button
58+ { ...( isMobile ? { id : 'opening-drill-preview' } : { } ) }
59+ onClick = { ( ) => setActiveTab ( 'preview' ) }
60+ className = { `flex-1 py-3 text-sm font-medium transition-colors ${
61+ activeTab === 'preview'
62+ ? 'border-b-2 border-human-4 text-primary'
63+ : 'text-secondary hover:text-primary'
64+ } `}
65+ >
66+ Preview
67+ </ button >
68+ < button
69+ { ...( isMobile ? { id : 'opening-drill-selected' } : { } ) }
70+ onClick = { ( ) => setActiveTab ( 'selected' ) }
71+ className = { `flex-1 py-3 text-sm font-medium transition-colors ${
72+ activeTab === 'selected'
73+ ? 'border-b-2 border-human-4 text-primary'
74+ : 'text-secondary hover:text-primary'
75+ } `}
76+ >
77+ Selected ({ selectionsCount } )
78+ </ button >
79+ </ div >
80+ )
81+ }
7482
7583// Left Panel - Opening Selection - moved outside main component
7684const BrowsePanel : React . FC < {
0 commit comments