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 (