"use client"; import React from "react"; import { Bot, Power, PowerOff, AlertCircle, } from "lucide-react"; import { Badge } from "~/components/ui/badge"; import { Separator } from "~/components/ui/separator"; import { ScrollArea } from "~/components/ui/scroll-area"; import { Alert, AlertDescription } from "~/components/ui/alert"; import { Button } from "~/components/ui/button"; import { WebcamPanel } from "./WebcamPanel"; interface WizardMonitoringPanelProps { rosConnected: boolean; rosConnecting: boolean; rosError?: string; robotStatus: { connected: boolean; battery: number; position: { x: number; y: number; theta: number }; joints: Record; sensors: Record; lastUpdate: Date; }; connectRos: () => Promise; disconnectRos: () => void; executeRosAction: ( pluginName: string, actionId: string, parameters: Record, ) => Promise; readOnly?: boolean; } const WizardMonitoringPanel = function WizardMonitoringPanel({ rosConnected, rosConnecting, rosError, robotStatus, connectRos, disconnectRos, executeRosAction, readOnly = false, }: WizardMonitoringPanelProps) { return (
{/* Camera View - Always Visible */}
{/* Robot Controls - Scrollable */}
Robot Control
{/* Robot Status */}
Robot Status
{rosConnected ? ( ) : ( Offline )}
ROS Bridge
{rosConnecting ? "Connecting..." : rosConnected ? "Ready" : rosError ? "Failed" : "Offline"} {rosConnected && ( )} {rosConnecting && ( )}
{/* ROS Connection Controls */}
{!rosConnected ? ( ) : ( )}
{rosError && ( {rosError} )} {!rosConnected && !rosConnecting && (
Connect to ROS bridge for live robot monitoring and control.
)}
{/* Movement Controls */} {rosConnected && (
Movement
{/* Row 1: Turn Left, Forward, Turn Right */} {/* Row 2: Left, Stop, Right */} {/* Row 3: Empty, Back, Empty */}
)} {/* Quick Actions */} {rosConnected && (
Quick Actions
{/* TTS Input */}
{ if (e.key === "Enter" && e.currentTarget.value.trim() && !readOnly) { executeRosAction("nao6-ros2", "say_text", { text: e.currentTarget.value.trim(), }).catch(console.error); e.currentTarget.value = ""; } }} />
{/* Preset Actions */}
)}
); }; export { WizardMonitoringPanel };