From a0eaeb6712c9ad1fdfbb1a0b8432de3ec7a41988 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Fri, 20 Feb 2026 02:35:17 -0500 Subject: [PATCH] feat: Add turtle management features including rename, configuration, and GPS locate --- client/src/components/ControlPanel.jsx | 72 +++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/client/src/components/ControlPanel.jsx b/client/src/components/ControlPanel.jsx index c5caa80..bc105d5 100644 --- a/client/src/components/ControlPanel.jsx +++ b/client/src/components/ControlPanel.jsx @@ -79,6 +79,21 @@ function TurtleCard({ turtle, isSelected, onSelect }) { function TurtleDetails({ turtle }) { const sendCommand = useTurtleStore((state) => state.sendCommand); const setTurtleState = useTurtleStore((state) => state.setTurtleState); + const renameTurtle = useTurtleStore((state) => state.renameTurtle); + const equipLeft = useTurtleStore((state) => state.equipLeft); + const equipRight = useTurtleStore((state) => state.equipRight); + const sortInventory = useTurtleStore((state) => state.sortInventory); + const selectSlot = useTurtleStore((state) => state.selectSlot); + const dropItems = useTurtleStore((state) => state.dropItems); + const suckItems = useTurtleStore((state) => state.suckItems); + const connectToInventory = useTurtleStore((state) => state.connectToInventory); + const updateTurtleConfig = useTurtleStore((state) => state.updateTurtleConfig); + const exploreTurtle = useTurtleStore((state) => state.exploreTurtle); + const gpsLocateTurtle = useTurtleStore((state) => state.gpsLocateTurtle); + + const [renameValue, setRenameValue] = useState(''); + const [showConfig, setShowConfig] = useState(false); + const [configValues, setConfigValues] = useState({ maxDistance: 200, autoRefuel: true }); if (!turtle) { return ( @@ -96,11 +111,66 @@ function TurtleDetails({ turtle }) { setTurtleState(turtle.turtleID, stateName, data); }; + const handleRename = async () => { + if (renameValue.trim()) { + await renameTurtle(turtle.turtleID, renameValue.trim()); + setRenameValue(''); + } + }; + + const handleSlotClick = async (slotIndex) => { + await selectSlot(turtle.turtleID, slotIndex + 1); + }; + + const handleConfigSave = async () => { + await updateTurtleConfig(turtle.turtleID, configValues); + setShowConfig(false); + }; + const activeState = turtle.state || turtle.mode || 'idle'; + const displayName = turtle.label || `Turtle ${turtle.turtleID}`; return (
-

Turtle {turtle.turtleID} Control

+

{displayName} #{turtle.turtleID}

+ + {/* Rename + Config bar */} +
+ setRenameValue(e.target.value)} + onKeyDown={(e) => e.key === 'Enter' && handleRename()} + placeholder="Rename turtle..." + className="rename-input" + style={{ flex: 1, minWidth: '120px', padding: '4px 8px', borderRadius: '4px', border: '1px solid #4b5563', background: '#1f2937', color: '#fff' }} + /> + + + + +
+ + {/* Config Modal */} + {showConfig && ( +
+

⚙️ Configuration

+
+ + +
+ + +
+
+
+ )}

Status