import { useVoxtral } from "./VoxtralContext"; import { THEME } from "../constants"; import { AppGridBackground, ErrorMessageBox, MicrophoneIcon, VoiceMeter, } from "./SharedUI"; export const RunningPage = () => { const { status, transcript, startRecording, stopRecording, resetSession, error, } = useVoxtral(); const isRecording = status === "recording"; const transcriptText = transcript.trimStart(); const hasTranscript = transcriptText.length > 0; const statusConfig = error ? { bg: `${THEME.errorRed}0D`, border: THEME.errorRed, dot: THEME.errorRed, label: "SYSTEM ERROR", } : isRecording ? { bg: `${THEME.mistralOrange}0D`, border: THEME.mistralOrange, dot: THEME.mistralOrange, label: "LIVE TRANSCRIPTION", } : { bg: "transparent", border: THEME.beigeDark, dot: "#9CA3AF", label: "STANDBY", }; const controlLabel = isRecording ? "Stop" : "Start"; const helperText = error ? "Resolve the error and start again." : isRecording ? "Listening live. Tap stop when you're done." : "Tap the microphone to begin."; return (

Voxtral Realtime

Real-time transcription

{isRecording && ( )} {statusConfig.label}
{error && ( )}
{!isRecording && !transcriptText ? (

Start transcription

{helperText}

Ready when you are

) : ( <>
Transcript
{transcriptText ? "Live output" : "Waiting for speech"}
{transcriptText ? (

{transcriptText} {isRecording && ( )}

) : (

Listening for speech...

Local processing ยท realtime stream

)}
)}
{(isRecording || hasTranscript) && (
{!isRecording && hasTranscript && ( )} {isRecording && ( )}
)}
{isRecording ? "stream: live" : "stream: ready"} {isRecording ? "mic: active" : "mic: idle"}
); };