"use client" import { useState, useEffect } from "react" import { Button } from "@/components/ui/button" import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogFooter, DialogClose } from "@/components/ui/dialog" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group" import type { RobotConnection } from "@/types/robot" interface EditRobotDialogProps { robot: RobotConnection | null isOpen: boolean onOpenChange: (open: boolean) => void onSave: (updatedRobot: RobotConnection) => void } export function EditRobotDialog({ robot, isOpen, onOpenChange, onSave }: EditRobotDialogProps) { const [name, setName] = useState("") const [type, setType] = useState<"so100_follower" | "so100_leader">("so100_follower") useEffect(() => { if (robot) { setName(robot.name) setType(robot.robotType || "so100_follower") } }, [robot]) const handleSave = () => { if (robot) { onSave({ ...robot, name, robotType: type }) } } if (!robot) return null return ( Configure Robot
setName(e.target.value)} className="col-span-3 font-mono" />
setType(value as any)} className="col-span-3">
) }