Skip to content

Commit 9559be5

Browse files
fix: transcription animation not working ml-357 (#377)
* fix(frontend): no animation if inactive tab ml-357 * fix(frontend): refactor auto scroll add style ml-357 * fix(frontend): change meeting status render ml-357
1 parent 4fa397f commit 9559be5

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

apps/frontend/src/libs/components/transcription-panel/transcription-panel.module.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@
5353
border-radius: var(--border-radius-lg);
5454
}
5555

56+
.transcription-bottom-spacer {
57+
scroll-margin-bottom: 46px;
58+
}
59+
5660
@media (width <=1024px) {
5761
.meeting-details__transcription-panel {
5862
grid-row: 1;

apps/frontend/src/libs/components/transcription-panel/transcription-panel.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const TranscriptionPanel: React.FC = () => {
2626
({ meetingDetails }) => meetingDetails.meeting,
2727
);
2828
const containerReference = useAutoScroll<HTMLDivElement>(
29-
meeting?.status === MeetingStatus.STARTED ? [typedText] : [],
29+
!!meeting && meeting.status !== MeetingStatus.ENDED ? [typedText] : [],
3030
);
3131
useFetchTranscriptions();
3232

@@ -57,10 +57,10 @@ const TranscriptionPanel: React.FC = () => {
5757
{dataStatus === DataStatus.PENDING && <Loader hasOverlay isLoading />}
5858

5959
{transcriptions.items.length > EMPTY_TRANSCRIPT_CHUNKS ? (
60-
<div className={styles["transcription-area"]} ref={containerReference}>
60+
<div className={styles["transcription-area"]}>
6161
<p className={styles["transcription-text"]}>
6262
{staticTranscript}
63-
{meeting?.status === MeetingStatus.STARTED && (
63+
{meeting?.status !== MeetingStatus.ENDED && (
6464
<LiveTranscription isTyping={isTyping} typedText={typedText} />
6565
)}
6666
</p>
@@ -70,6 +70,10 @@ const TranscriptionPanel: React.FC = () => {
7070
<p>No transcriptions</p>
7171
</div>
7272
)}
73+
<div
74+
className={styles["transcription-bottom-spacer"]}
75+
ref={containerReference}
76+
/>
7377
</div>
7478
);
7579
};
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const TYPING_SPEED = 40;
1+
const TYPING_SPEED = 20;
22

33
export { TYPING_SPEED };

apps/frontend/src/libs/hooks/use-auto-scroll/use-auto-scroll.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,16 @@ import { useEffect, useRef } from "~/libs/hooks/hooks.js";
55
const useAutoScroll = <T extends HTMLElement>(
66
dependencies: unknown[] = [],
77
): RefObject<null | T> => {
8+
const SMOOTH = "smooth";
9+
const END = "end";
810
const reference = useRef<T>(null);
911

1012
useEffect(() => {
1113
if (reference.current) {
12-
reference.current.scrollTop = reference.current.scrollHeight;
14+
reference.current.scrollIntoView({
15+
behavior: SMOOTH,
16+
block: END,
17+
});
1318
}
1419
}, dependencies);
1520

apps/frontend/src/libs/hooks/use-typing-queue/use-typing-queue.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ const useTypingQueue = (typingSpeed = TYPING_SPEED): UseTypingQueueReturn => {
6868
return;
6969
}
7070

71+
if (document.hidden) {
72+
dispatch(transcriptionActions.addTranscription(chunk));
73+
74+
return;
75+
}
76+
7177
dispatch(transcriptionActions.addTranscription(chunk));
7278
queueReference.current.push(chunk);
7379
processQueue();

0 commit comments

Comments
 (0)