import { useTranslation } from 'react-i18next'; import { Mic, Square, Loader2 } from 'lucide-react'; import { PromptInputButton } from '../../../../shared/view/ui'; import type { VoiceInputState } from '../../hooks/useVoiceInput'; type Props = { state: VoiceInputState; onToggle: () => void; errorMsg?: string | null; }; // Push-to-talk mic button (presentational). Recording state and the stop-and-send action // are owned by the composer so the main Send button can drive them too. This button just // starts recording and, while recording, stops and drops the transcript into the input box. export default function VoiceInputButton({ state, onToggle, errorMsg }: Props) { const { t } = useTranslation('chat'); const icon = state === 'recording' ? ( ) : state === 'transcribing' ? ( ) : ( ); return ( {errorMsg && ( {errorMsg} )} void }) => { e.preventDefault(); onToggle(); }} > {icon} ); }