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