refactor: rename position handlers to startPoint and endPoint for clarity; update toggle UI logic to use localStorage
This commit is contained in:
parent
1cca51e652
commit
c2dc898d53
|
@ -45,11 +45,11 @@ const VehicleMechanics: React.FC = () => {
|
|||
setSimulationPaths(updatedPaths);
|
||||
}, [selectedActionSphere?.point?.uuid, simulationPaths, setSimulationPaths]);
|
||||
|
||||
const handleStartPositionChange = React.useCallback((position: string) => {
|
||||
const handleStartPointChange = React.useCallback((position: string) => {
|
||||
handleActionUpdate({ start: position });
|
||||
}, [handleActionUpdate]);
|
||||
|
||||
const handleEndPositionChange = React.useCallback((position: string) => {
|
||||
const handleEndPointChange = React.useCallback((position: string) => {
|
||||
handleActionUpdate({ end: position });
|
||||
}, [handleActionUpdate]);
|
||||
|
||||
|
@ -94,16 +94,16 @@ const VehicleMechanics: React.FC = () => {
|
|||
<>
|
||||
<EyeDropInput
|
||||
key={`start-${selectedPoint.uuid}`}
|
||||
label="Start Position"
|
||||
label="Start Point"
|
||||
value={selectedPoint.actions.start}
|
||||
onChange={handleStartPositionChange}
|
||||
onChange={handleStartPointChange}
|
||||
/>
|
||||
|
||||
<EyeDropInput
|
||||
key={`end-${selectedPoint.uuid}`}
|
||||
label="End Position"
|
||||
label="End Point"
|
||||
value={selectedPoint.actions.end}
|
||||
onChange={handleEndPositionChange}
|
||||
onChange={handleEndPointChange}
|
||||
/>
|
||||
|
||||
<InputWithDropDown
|
||||
|
|
|
@ -18,7 +18,7 @@ const ModuleToggle: React.FC = () => {
|
|||
className={`module-list ${activeModule === "builder" && "active"}`}
|
||||
onClick={() => {
|
||||
setActiveModule("builder");
|
||||
setToggleUI(true);
|
||||
setToggleUI(localStorage.getItem('navBarUi') ? localStorage.getItem('navBarUi') === 'true' : true)
|
||||
}}
|
||||
>
|
||||
<div className="icon">
|
||||
|
@ -30,7 +30,7 @@ const ModuleToggle: React.FC = () => {
|
|||
className={`module-list ${activeModule === "simulation" && "active"}`}
|
||||
onClick={() => {
|
||||
setActiveModule("simulation");
|
||||
setToggleUI(true);
|
||||
setToggleUI(localStorage.getItem('navBarUi') ? localStorage.getItem('navBarUi') === 'true' : true)
|
||||
}}
|
||||
>
|
||||
<div className="icon">
|
||||
|
@ -39,12 +39,11 @@ const ModuleToggle: React.FC = () => {
|
|||
<div className="module">Simulation</div>
|
||||
</div>
|
||||
<div
|
||||
className={`module-list ${
|
||||
activeModule === "visualization" && "active"
|
||||
className={`module-list ${activeModule === "visualization" && "active"
|
||||
}`}
|
||||
onClick={() => {
|
||||
setActiveModule("visualization");
|
||||
setToggleUI(true);
|
||||
setToggleUI(localStorage.getItem('navBarUi') ? localStorage.getItem('navBarUi') === 'true' : true)
|
||||
}}
|
||||
>
|
||||
<div className="icon">
|
||||
|
|
|
@ -62,11 +62,7 @@ const Tools: React.FC = () => {
|
|||
|
||||
// Reset activeTool whenever activeModule changes
|
||||
useEffect(() => {
|
||||
const storedNavBar: any = localStorage.getItem("navBarUi");
|
||||
if (storedNavBar) {
|
||||
const parsedNavBar = JSON.parse(storedNavBar);
|
||||
setToggleUI(parsedNavBar);
|
||||
}
|
||||
setToggleUI(localStorage.getItem('navBarUi') ? localStorage.getItem('navBarUi') === 'true' : true)
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -228,8 +224,7 @@ const Tools: React.FC = () => {
|
|||
)}
|
||||
{activeSubTool == "delete" && (
|
||||
<div
|
||||
className={`tool-button ${
|
||||
activeTool === "delete" ? "active" : ""
|
||||
className={`tool-button ${activeTool === "delete" ? "active" : ""
|
||||
}`}
|
||||
onClick={() => {
|
||||
setActiveTool("delete");
|
||||
|
@ -349,8 +344,7 @@ const Tools: React.FC = () => {
|
|||
<div className="split"></div>
|
||||
<div className="draw-tools">
|
||||
<div
|
||||
className={`tool-button ${
|
||||
activeTool === "measure" ? "active" : ""
|
||||
className={`tool-button ${activeTool === "measure" ? "active" : ""
|
||||
}`}
|
||||
onClick={() => {
|
||||
setActiveTool("measure");
|
||||
|
@ -410,8 +404,7 @@ const Tools: React.FC = () => {
|
|||
</div>
|
||||
{toggleThreeD && (
|
||||
<div
|
||||
className={`tool-button ${
|
||||
activeTool === "play" ? "active" : ""
|
||||
className={`tool-button ${activeTool === "play" ? "active" : ""
|
||||
}`}
|
||||
onClick={() => {
|
||||
setIsPlaying(!isPlaying);
|
||||
|
|
Loading…
Reference in New Issue