diff --git a/src/components/Connection.tsx b/src/components/Connection.tsx index ecad6af..419b373 100644 --- a/src/components/Connection.tsx +++ b/src/components/Connection.tsx @@ -736,354 +736,349 @@ const Connection: React.FC = ({ }; return ( -
- {/* Left-aligned timer and separator */} -
- {isRecordingRef.current && ( -
-
- {formatTime(elapsedTime)} -
- -
- - - - - -
-
- Set End Time (minutes) -
-
- {[1, 10, 20, 30].map((time) => ( - - ))} +
+ {/* Left-aligned section */} +
+ {isRecordingRef.current && ( +
+
+ {formatTime(elapsedTime)} +
+ +
+ + + + + +
+
+ Set End Time (minutes) +
+
+ {[1, 10, 20, 30].map((time) => ( -
+ ))}
-
-
-
+
+ + e.key === "Enter" && handleCustomTimeSet() + } + onChange={handleCustomTimeChange} + className="w-20" + /> + +
+
+ +
- )}
-
- {/* Center-aligned buttons */} -
- {/* Connection button with tooltip */} + )} +
+ + {/* Center-aligned buttons */} +
+ {/* Connection button with tooltip */} + + + + + + +

{isConnected ? "Disconnect Device" : "Connect Device"}

+
+
+
+ {/* Autoscale/Bit selection */} + {isConnected && ( + + +
+ {/* Decrease Canvas Button */} + + + + + +

{Zoom === 1 ? "We can't shrinkage" : "Decrease Zoom"}

+
+
+ + + + {/* Toggle All Channels Button */} + + + + + +

{FullZoom ? "Remove Full Zoom" : "Full Zoom"}

+
+
+ + + + {/* Increase Canvas Button */} + + + + + +

+ {Zoom >= 10 ? "Maximum Zoom Reached" : "Increase Zoom"} +

+
+
+
+
+
+ )} + + {/* Display (Play/Pause) button with tooltip */} + {isConnected && ( - -

{isConnected ? "Disconnect Device" : "Connect Device"}

+

+ {isDisplay ? "Pause Data Display" : "Resume Data Display"} +

- {/* Autoscale/Bit selection */} - {isConnected && ( - - -
- {/* Decrease Canvas Button */} - - - - - -

{Zoom === 1 ? "We can't shrinkage" : "Decrease Zoom"}

-
-
+ )} - - - {/* Toggle All Channels Button */} - - - - - -

{FullZoom ? "Remove Full Zoom" : "Full Zoom"}

-
-
+ {/* Record button with tooltip */} + {isConnected && ( + + + + + + +

+ {!isRecordingRef.current + ? "Start Recording" + : "Stop Recording"} +

+
+
+
+ )} - + {/* Save/Delete data buttons with tooltip */} + {isConnected && ( + +
+ {hasData && datasets.length === 1 && ( + + + + + +

Save Data as CSV

+
+
+ )} - {/* Increase Canvas Button */} - - - - - -

- {Zoom >= 10 ? "Maximum Zoom Reached" : "Increase Zoom"} -

-
-
-
- -
- )} + - {/* Display (Play/Pause) button with tooltip */} - {isConnected && ( - - -

- {isDisplay ? "Pause Data Display" : "Resume Data Display"} -

+

Save Data as Zip

-
- )} - {/* Record button with tooltip */} - {isConnected && ( - -

- {!isRecordingRef.current - ? "Start Recording" - : "Stop Recording"} -

+

Delete All Data

-
- )} - - {/* Save/Delete data buttons with tooltip */} - {isConnected && ( - -
- {hasData && datasets.length === 1 && ( - - - - - -

Save Data as CSV

-
-
- )} +
+
+ )} + + {/* Canvas control buttons with tooltip */} + {isConnected && ( + + +
+ {/* Decrease Canvas Button */} + + + + + +

+ {canvasCount === 1 + ? "At Least One Canvas Required" + : "Decrease Channel"} +

+
+
+ {/* Toggle All Channels Button */} -

Save Data as Zip

+

+ {showAllChannels + ? "Hide All Channels" + : "Show All Channels"} +

+ + + {/* Increase Canvas Button */} -

Delete All Data

+

+ {canvasCount >= 6 + ? "Maximum Channels Reached" + : "Increase Channel"} +

-
- )} - - {/* Canvas control buttons with tooltip */} - {isConnected && ( - - -
- {/* Decrease Canvas Button */} - - - - - -

- {canvasCount === 1 - ? "At Least One Canvas Required" - : "Decrease Channel"} -

-
-
- - - - {/* Toggle All Channels Button */} - - - - - -

- {showAllChannels - ? "Hide All Channels" - : "Show All Channels"} -

-
-
- - - - {/* Increase Canvas Button */} - - - - - -

- {canvasCount >= 6 - ? "Maximum Channels Reached" - : "Increase Channel"} -

-
-
-
-
-
- )} -
-
- - + + + )}
+
); }; diff --git a/src/components/Steps.tsx b/src/components/Steps.tsx index 0dd5803..32e4f8c 100644 --- a/src/components/Steps.tsx +++ b/src/components/Steps.tsx @@ -1,4 +1,5 @@ -import * as React from "react"; +import React, { useState, useRef, useCallback, useEffect } from "react"; + import { Card, CardContent } from "./ui/card"; import { Carousel, @@ -106,12 +107,34 @@ const Steps: React.FC = () => { image: ImageLinks[5], }, ]; - const stepsHeightInVh = - window.innerHeight > 945 ? (91* window.innerHeight) / 100 : - window.innerHeight > 585 ? (85* window.innerHeight) / 100 : - window.innerHeight <= 483 ? (76* window.innerHeight) / 100 : - (75* window.innerHeight) / 100; + + // Function to calculate height + const calculateHeight = () => { + if (window.innerHeight > 945) return 90; + if (window.innerHeight > 585) return 88; + if (window.innerHeight <= 483) return 100; + return 80; // Default case + }; + const [stepsHeightInVh, setStepsHeightInVh] = useState(calculateHeight()); + + + useEffect(() => { + // Update height on window resize + const handleResize = () => { + setStepsHeightInVh(calculateHeight()); + }; + + // Set the initial height + setStepsHeightInVh(calculateHeight()); + + // Add event listener for window resize + window.addEventListener('resize', handleResize); + // Cleanup event listener on unmount + return () => { + window.removeEventListener('resize', handleResize); + }; + }, []); return (