Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions lma-ai-stack/source/ui/src/components/call-panel/CallPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* This file is licensed under the MIT License.
* See the LICENSE file in the project root for full license information.
*/
import React, { useEffect, useRef, useState } from 'react';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import {
Badge,
Box,
Expand Down Expand Up @@ -692,6 +692,15 @@ const CallInProgressTranscript = ({
}
};

const scrollTranscriptToBottom = useCallback(() => {
if (containerRef.current) {
containerRef.current.scrollTo({
top: containerRef.current.scrollHeight,
behavior: 'smooth',
});
}
}, []);

useEffect(() => {
setTurnByTurnSegments(getTurnByTurnSegments);
}, [callTranscriptPerCallId, item.recordingStatusLabel, targetLanguage, agentTranscript, translateOn, updateFlag]);
Expand All @@ -702,9 +711,9 @@ const CallInProgressTranscript = ({
item.recordingStatusLabel === IN_PROGRESS_STATUS
&& autoScroll
&& !userHasScrolled
&& bottomRef.current?.scrollIntoView
&& containerRef.current
) {
bottomRef.current.scrollIntoView({ behavior: 'smooth', block: 'start' });
scrollTranscriptToBottom();
}
}, [
turnByTurnSegments,
Expand All @@ -714,6 +723,7 @@ const CallInProgressTranscript = ({
targetLanguage,
agentTranscript,
translateOn,
scrollTranscriptToBottom,
]);

return (
Expand All @@ -722,6 +732,7 @@ const CallInProgressTranscript = ({
onScroll={handleScroll}
style={{
overflowY: 'auto',
height: collapseSentiment ? '34vh' : '68vh',
maxHeight: collapseSentiment ? '34vh' : '68vh',
paddingLeft: '10px',
paddingTop: '5px',
Expand All @@ -748,7 +759,7 @@ const CallInProgressTranscript = ({
<Button
onClick={() => {
setUserHasScrolled(false);
bottomRef.current?.scrollIntoView({ behavior: 'smooth' });
scrollTranscriptToBottom();
}}
variant="inline-link"
iconName="angle-down"
Expand Down