diff --git a/app/src/components/terminal/SttButton.tsx b/app/src/components/terminal/SttButton.tsx index 4e83e02..3997cdc 100644 --- a/app/src/components/terminal/SttButton.tsx +++ b/app/src/components/terminal/SttButton.tsx @@ -1,14 +1,15 @@ import { useCallback, useEffect, useRef, useState } from "react"; -import { useSTT } from "../../hooks/useSTT"; +import type { SttState } from "../../hooks/useSTT"; import * as commands from "../../lib/tauri-commands"; interface Props { - sessionId: string; - sendInput: (sessionId: string, data: string) => Promise; + state: SttState; + error: string | null; + onToggle: () => Promise; + onCancel: () => Promise; } -export default function SttButton({ sessionId, sendInput }: Props) { - const { state, error, toggle, cancelRecording } = useSTT(sessionId, sendInput); +export default function SttButton({ state, error, onToggle, onCancel }: Props) { const [elapsed, setElapsed] = useState(0); const timerRef = useRef | null>(null); @@ -40,17 +41,17 @@ export default function SttButton({ sessionId, sendInput }: Props) { // Container start failed, toggle will still attempt transcription } } - await toggle(); - }, [state, toggle]); + await onToggle(); + }, [state, onToggle]); const handleContextMenu = useCallback( (e: React.MouseEvent) => { e.preventDefault(); if (state === "recording") { - cancelRecording(); + onCancel(); } }, - [state, cancelRecording], + [state, onCancel], ); const formatTime = (seconds: number) => { @@ -64,6 +65,7 @@ export default function SttButton({ sessionId, sendInput }: Props) { {/* STT mic button - bottom left */} - {sttEnabled && } + {sttEnabled && } {/* Jump to Current - bottom right, when scrolled up */} {!isAtBottom && (