import React from "react"; import { Mic, Volume2, Sparkles, CheckCircle2, AlertCircle } from "lucide-react"; import { VoiceState } from "../types/voice"; interface VoiceOrbProps { state: VoiceState; audioLevel: number; isSpeechDetected?: boolean; onClick: () => void; } export const VoiceOrb: React.FC = ({ state, audioLevel, onClick, }) => { const getOrbVisuals = () => { switch (state) { case "listening": return { gradient: "radial-gradient(circle, #f43f5e 0%, #be123c 100%)", glow: "rgba(244, 63, 94, 0.6)", icon: , statusText: "Listening to you...", subText: "Speak naturally, AI will respond automatically", color: "#f43f5e", }; case "ai_speaking": return { gradient: "radial-gradient(circle, #06b6d4 0%, #2563eb 100%)", glow: "rgba(6, 182, 212, 0.7)", icon: , statusText: "Assistant Speaking...", subText: "Mic activates automatically when speech ends", color: "#06b6d4", }; case "processing": return { gradient: "radial-gradient(circle, #8b5cf6 0%, #6d28d9 100%)", glow: "rgba(139, 92, 246, 0.7)", icon: , statusText: "Thinking...", subText: "Analyzing symptoms & clinical details", color: "#8b5cf6", }; case "confirmation": return { gradient: "radial-gradient(circle, #10b981 0%, #047857 100%)", glow: "rgba(16, 185, 129, 0.6)", icon: , statusText: "Intake Complete", subText: "Review your summary below to confirm", color: "#10b981", }; case "completed": return { gradient: "radial-gradient(circle, #10b981 0%, #065f46 100%)", glow: "rgba(16, 185, 129, 0.5)", icon: , statusText: "Saved to Hospital Record", subText: "Transferred to OPD Consultation Queue", color: "#10b981", }; case "error": return { gradient: "radial-gradient(circle, #ef4444 0%, #991b1b 100%)", glow: "rgba(239, 68, 68, 0.6)", icon: , statusText: "Tap to Reconnect", subText: "Reconnecting voice intake channel", color: "#ef4444", }; default: return { gradient: "radial-gradient(circle, #06b6d4 0%, #3b82f6 100%)", glow: "rgba(6, 182, 212, 0.4)", icon: , statusText: "Hands-Free Voice Active", subText: "Speak naturally to start conversation", color: "#06b6d4", }; } }; const visuals = getOrbVisuals(); const scaleByAudio = state === "listening" ? 1 + Math.min(0.22, (audioLevel / 220)) : state === "ai_speaking" ? 1.05 : 1; return (
{/* Orb Outer Container */}
{/* Multi-layered dynamic aura glow */}
{/* Dynamic Sound Ripple Aura */} {(state === "listening" || state === "ai_speaking") && ( <>
)} {/* Clean, Modern Floating Voice Sphere */}
{/* State Text & Feedback */}

{visuals.statusText}

{visuals.subText}

); };