import React, { useEffect, useRef, useState } from 'react'; import { Aside } from '@custom/shared/components/Aside'; import Button from '@custom/shared/components/Button'; import { useCallState } from '@custom/shared/contexts/CallProvider'; import { useParticipants } from '@custom/shared/contexts/ParticipantsProvider'; import { useUIState } from '@custom/shared/contexts/UIStateProvider'; import { useTranscription } from '../contexts/TranscriptionProvider'; export const TRANSCRIPTION_ASIDE = 'transcription'; export const TranscriptionAside = () => { const { callObject } = useCallState(); const { showAside, setShowAside } = useUIState(); const { transcriptionHistory } = useTranscription(); const [isTranscribing, setIsTranscribing] = useState(false); const { isOwner } = useParticipants(); const msgWindowRef = useRef(); useEffect(() => { if (msgWindowRef.current) { msgWindowRef.current.scrollTop = msgWindowRef.current.scrollHeight; } }, [transcriptionHistory?.length]); if (!showAside || showAside !== TRANSCRIPTION_ASIDE) { return null; } async function startTranscription() { setIsTranscribing(true); await callObject.startTranscription(); } async function stopTranscription() { setIsTranscribing(false); await callObject.stopTranscription(); } return ( ); }; export default TranscriptionAside;