import { useEffect, useRef } from 'react';
import { Headphones, Loader2, Mic, Volume2, X } from 'lucide-react';
import { voiceDialogStatusLabel } from '../app-voice-utils.js';
export function VoiceDialogPanel({
open,
state,
error,
transcript,
assistantText,
handoffDraft,
onHandoffDraftChange,
onHandoffSubmit,
onHandoffContinue,
onHandoffCancel,
onStart,
onStop,
onClose
}) {
const closeButtonRef = useRef(null);
useEffect(() => {
if (open) {
closeButtonRef.current?.focus();
}
}, [open]);
if (!open) {
return null;
}
const listening = state === 'listening';
const confirmingHandoff = state === 'handoff';
const busy = ['transcribing', 'sending', 'waiting', 'speaking', 'summarizing'].includes(state);
const statusIcon = state === 'speaking'
?
{transcript}
: null} {assistantText ?{assistantText}
: null} {confirmingHandoff ? (