diff --git a/client/src/components/ControlPanel.jsx b/client/src/components/ControlPanel.jsx index 51ad803..1a0e8f4 100644 --- a/client/src/components/ControlPanel.jsx +++ b/client/src/components/ControlPanel.jsx @@ -3,7 +3,7 @@ import { useTurtleStore } from '../store/turtleStore'; import './ControlPanel.css'; function TurtleCard({ turtle, isSelected, onSelect }) { - const mode = turtle.mode || 'unknown'; + const activeState = turtle.state || turtle.mode || 'idle'; const fuel = turtle.fuel === 'unlimited' ? '∞' : (turtle.fuel || '?'); const inventoryCount = turtle.inventory?.length || 0; @@ -11,8 +11,14 @@ function TurtleCard({ turtle, isSelected, onSelect }) { mining: '#4ade80', exploring: '#60a5fa', returning: '#f59e0b', + goHome: '#f59e0b', idle: '#9ca3af', manual: '#a78bfa', + refueling: '#ef4444', + farming: '#22c55e', + dumpInventory: '#a855f7', + dumping: '#a855f7', + moving: '#06b6d4', unknown: '#6b7280' }; @@ -20,12 +26,12 @@ function TurtleCard({ turtle, isSelected, onSelect }) {

Turtle {turtle.turtleID}

- - {mode} + + {activeState}
@@ -67,6 +73,7 @@ function TurtleCard({ turtle, isSelected, onSelect }) { function TurtleDetails({ turtle }) { const sendCommand = useTurtleStore((state) => state.sendCommand); + const setTurtleState = useTurtleStore((state) => state.setTurtleState); if (!turtle) { return ( @@ -80,6 +87,12 @@ function TurtleDetails({ turtle }) { sendCommand(turtle.turtleID, command, param); }; + const handleStateChange = (stateName, data = {}) => { + setTurtleState(turtle.turtleID, stateName, data); + }; + + const activeState = turtle.state || turtle.mode || 'idle'; + return (

Turtle {turtle.turtleID} Control

@@ -88,9 +101,15 @@ function TurtleDetails({ turtle }) {

Status

- Mode: - {turtle.mode || 'unknown'} + State: + {activeState}
+ {turtle.stateDescription && ( +
+ Activity: + {turtle.stateDescription} +
+ )}
Fuel: @@ -119,7 +138,77 @@ function TurtleDetails({ turtle }) {
-

Commands

+

State Machine

+
+ + + + + + + + +
+
+ +
+

Legacy Commands