import React, { useState } from 'react'; import styles from './MonitoringPage.module.css'; /** * HELPER: Unified sender function * In a real app, you might move this to a /services or /hooks folder */ const sendUserInterrupt = async (type: string, context: string) => { try { const response = await fetch("http://localhost:8000/button_pressed", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ type, context }), }); if (!response.ok) throw new Error("Backend response error"); console.log(`Interrupt Sent - Type: ${type}, Context: ${context}`); } catch (err) { console.error(`Failed to send interrupt:`, err); } }; // --- GESTURE COMPONENT --- export const GestureControls: React.FC = () => { const [selectedGesture, setSelectedGesture] = useState("animations/Stand/BodyTalk/Speaking/BodyTalk_1"); const gestures = [ { label: "Body Talk 1", value: "animations/Stand/BodyTalk/Speaking/BodyTalk_1" }, { label: "Thinking 8", value: "animations/Stand/Gestures/Thinking_8" }, { label: "Thinking 1", value: "animations/Stand/Gestures/Thinking_1" }, { label: "Happy", value: "animations/Stand/Emotions/Positive/Happy_1" }, ]; return (

Gestures

); }; // --- PRESET SPEECH COMPONENT --- export const SpeechPresets: React.FC = () => { const phrases = [ { label: "Hello, I'm Pepper", text: "Hello, I'm Pepper" }, { label: "Repeat please", text: "Could you repeat that please" }, { label: "About yourself", text: "Tell me something about yourself" }, ]; return (

Speech Presets

); }; // --- DIRECT SPEECH (INPUT) COMPONENT --- export const DirectSpeechInput: React.FC = () => { const [text, setText] = useState(""); const handleSend = () => { if (!text.trim()) return; sendUserInterrupt("speech", text); setText(""); // Clear after sending }; return (

Direct Pepper Speech

setText(e.target.value)} placeholder="Type message..." onKeyDown={(e) => e.key === 'Enter' && handleSend()} />
); }; // --- interface for goals/triggers/norms/conditional norms --- interface StatusListProps { title: string; items: any[]; type: 'goal' | 'trigger' | 'norm'| 'cond_norm'; } // --- STATUS LIST COMPONENT --- export const StatusList: React.FC = ({ title, items, type }) => { return (

{title}

); };