From d1b64ddd78d8b8dc3eca76038a75071ab2a575d9 Mon Sep 17 00:00:00 2001
From: Arne Rief <riearn@proton.me>
Date: Mon, 22 Dec 2025 12:56:20 +0100
Subject: Sidebar split into smaller components

---
 frontend/src/pages/Dashboard.tsx | 74 ++--------------------------------------
 1 file changed, 2 insertions(+), 72 deletions(-)

(limited to 'frontend/src/pages/Dashboard.tsx')

diff --git a/frontend/src/pages/Dashboard.tsx b/frontend/src/pages/Dashboard.tsx
index b8dd2c4..088fee2 100644
--- a/frontend/src/pages/Dashboard.tsx
+++ b/frontend/src/pages/Dashboard.tsx
@@ -14,7 +14,6 @@ import type { Robot, RobotsResponse } from "../types/robot";
 function Dashboard() {
     const [errorMessage, setErrorMessage] = useState<string>("");
     const [isLoading, setIsLoading] = useState<boolean>(true);
-    const [isSimulationActive, setIsSimulationActive] = useState(false);
     const [robots, setRobots] = useState<Robot[]>([]);
 
     const navigate = useNavigate();
@@ -29,72 +28,6 @@ function Dashboard() {
         navigate("/login", { replace: true });
     }
 
-    async function handleStartAllRobots() {
-        setIsSimulationActive(true);
-
-        try {
-            const response = await fetch(`${API_URL}/robots/move`, {
-                method: "POST",
-                headers: {
-                    Authorization: `Bearer ${token}`,
-                    "Content-Type": "application/json",
-                },
-            });
-
-            if (!response.ok) {
-                const errorData: ErrorResponse = await response.json();
-                throw new Error(
-                    errorData.message || "Failed to set all robots moving."
-                );
-            }
-
-            console.log("All robots set moving.");
-        } catch (error) {
-            console.error("Error starting robots:", error);
-
-            if (error instanceof Error) {
-                setErrorMessage(error.message);
-            } else {
-                setErrorMessage("An unexpected error occurred.");
-            }
-
-            setIsSimulationActive(false);
-        }
-    }
-
-    async function handleStopAllRobots() {
-        setIsSimulationActive(false);
-
-        try {
-            const response = await fetch(`${API_URL}/robots/stop`, {
-                method: "POST",
-                headers: {
-                    Authorization: `Bearer ${token}`,
-                    "Content-Type": "application/json",
-                },
-            });
-
-            if (!response.ok) {
-                const errorData: ErrorResponse = await response.json();
-                throw new Error(
-                    errorData.message || "Failed to set all robots idle."
-                );
-            }
-
-            console.log("All robots set idle.");
-        } catch (error) {
-            console.error("Error stopping robots:", error);
-
-            if (error instanceof Error) {
-                setErrorMessage(error.message);
-            } else {
-                setErrorMessage("An unexpected error occurred.");
-            }
-
-            setIsSimulationActive(true);
-        }
-    }
-
     // Request robot data from backend on component mount
     useEffect(() => {
 	// Additional safety check to protect this page from unauthorized access
@@ -162,13 +95,10 @@ function Dashboard() {
             <Header user={user} logout={handleLogout} />
             <CityMap robots={robots} />
             <Sidebar
-                activeSimulation={isSimulationActive}
                 errorMessage={errorMessage}
-                setErrorMessage={setErrorMessage}
-                token={token}
                 robots={robots}
-                onStartAllRobots={handleStartAllRobots}
-                onStopAllRobots={handleStopAllRobots}
+                token={token}
+                setErrorMessage={setErrorMessage}
             />
         </div>
     );
-- 
cgit v1.2.3

