@@ -122,6 +122,7 @@ const Connection: React.FC<ConnectionProps> = ({
122122 const [ deviceReady , setDeviceReady ] = useState ( false ) ;
123123 const sampingrateref = useRef < number > ( 0 ) ;
124124 const [ open , setOpen ] = useState ( false ) ;
125+ const [ isPauseSate , setIsPauseState ] = useState ( false ) ;
125126
126127 // UI Themes & Modes
127128 const { theme } = useTheme ( ) ; // Current theme of the app
@@ -170,9 +171,10 @@ const Connection: React.FC<ConnectionProps> = ({
170171 onPauseChange ( newPauseState ) ; // Notify parent about the change
171172 SetCurrentSnapshot ( 0 ) ;
172173 setLeftArrowClickCount ( 0 ) ;
173-
174+ setIsPauseState ( ! newPauseState ) ; // <-- Fix: use the new state
174175 } ;
175176
177+
176178 const enabledClicks = ( snapShotRef . current ?. filter ( Boolean ) . length ?? 0 ) - 1 ;
177179
178180 // Enable/Disable left arrow button
@@ -1186,7 +1188,7 @@ const Connection: React.FC<ConnectionProps> = ({
11861188 recordingStartTimeRef . current = Date . now ( ) ;
11871189 setRecordingElapsedTime ( Date . now ( ) ) ;
11881190 setIsRecordButtonDisabled ( true ) ;
1189- setIsDisplay ( false ) ;
1191+
11901192 const filename = `ChordsWeb-${ now . getFullYear ( ) } ${ String ( now . getMonth ( ) + 1 ) . padStart ( 2 , '0' ) } ${ String ( now . getDate ( ) ) . padStart ( 2 , '0' ) } -` +
11911193 `${ String ( now . getHours ( ) ) . padStart ( 2 , '0' ) } ${ String ( now . getMinutes ( ) ) . padStart ( 2 , '0' ) } ${ String ( now . getSeconds ( ) ) . padStart ( 2 , '0' ) } .csv` ;
11921194
@@ -1368,7 +1370,7 @@ const Connection: React.FC<ConnectionProps> = ({
13681370 ) }
13691371 </ Button >
13701372 ) }
1371- { ! isDeviceConnected && (
1373+ { ! isDeviceConnected && (
13721374 < Button
13731375 className = "py-2 px-4 rounded-xl font-semibold"
13741376 onClick = { ( ) => {
@@ -1399,7 +1401,7 @@ const Connection: React.FC<ConnectionProps> = ({
13991401 < TooltipProvider >
14001402 < Tooltip >
14011403 < TooltipTrigger asChild >
1402- < Button className = "rounded-xl rounded-l-none rounded-r-none" onClick = { togglePause } >
1404+ < Button className = "rounded-xl rounded-l-none rounded-r-none" onClick = { togglePause } disabled = { isRecordingRef . current } >
14031405 { isDisplay ? (
14041406 < Pause className = "h-5 w-5" />
14051407 ) : (
@@ -1432,7 +1434,7 @@ const Connection: React.FC<ConnectionProps> = ({
14321434 < Button
14331435 className = "rounded-xl"
14341436 onClick = { handleRecord }
1435- disabled = { ! isDisplay }
1437+ disabled = { isPauseSate }
14361438 >
14371439 { isRecordingRef . current ? (
14381440 < CircleStop />
@@ -1529,7 +1531,7 @@ const Connection: React.FC<ConnectionProps> = ({
15291531 < PopoverTrigger asChild >
15301532 < Button
15311533 className = "flex items-center justify-center px-3 py-2 select-none min-w-12 whitespace-nowrap rounded-xl"
1532- disabled = { ! isDisplay }
1534+ disabled = { isPauseSate }
15331535 >
15341536 Filter
15351537 </ Button >
@@ -1822,19 +1824,19 @@ const Connection: React.FC<ConnectionProps> = ({
18221824 { isDeviceConnected && ! FFTDeviceConnected && (
18231825 < Popover >
18241826 < PopoverTrigger asChild >
1825- < Button className = "flex items-center justify-center select-none whitespace-nowrap rounded-lg" >
1827+ < Button className = "flex items-center justify-center select-none whitespace-nowrap rounded-lg" >
18261828 < Settings size = { 16 } />
18271829 </ Button >
18281830 </ PopoverTrigger >
18291831 < PopoverContent className = "w-[30rem] p-4 rounded-md shadow-md text-sm" >
18301832 < TooltipProvider >
18311833 < div className = { `space-y-6 ${ ! isDisplay ? "flex justify-center" : "" } ` } >
18321834 { /* Channel Selection */ }
1833- { isDisplay && (
1835+ { isDisplay && ! isRecordingRef . current && (
18341836 < div className = "flex items-center justify-center rounded-lg " >
18351837 < div className = "w-full" >
18361838 { /* Channels Count & Select All Button */ }
1837- < div className = "flex items-center justify-between " >
1839+ < div className = "flex items-center justify-between " >
18381840 < h3 className = "text-xs font-semibold text-gray-500" >
18391841 < span className = "font-bold text-gray-600" > Channels Count:</ span > { selectedChannels . length }
18401842 </ h3 >
0 commit comments