Skip to content

Commit f1e3603

Browse files
committed
TrackCaption: ?hide_partial
1 parent 5292d1c commit f1e3603

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ui/src/MainCaptionPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ const MainCaptionContent: React.FC<{ captions: CaptionMessage[] }> = ({
114114
key={`${caption.sequence_id}-${caption.source}`}
115115
fontWeight={caption.is_partial ? 600 : 400}
116116
color={i === 0 && !caption.is_partial ? "#707070" : "inherit"}
117+
marginRight={"1.5rem"}
117118
>
118119
{caption.transcript}{" "}
119120
</Text>

ui/src/TrackCaption.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useCallback, useMemo } from "react";
2+
import { useSearchParams } from "react-router-dom";
23

34
import { Box, Skeleton, Text } from "@chakra-ui/react";
45

@@ -44,8 +45,14 @@ export const TrackCaption: React.FC<Props> = ({ track }) => {
4445
export const TrackCaptionInner: React.FC<{
4546
track: TrackSlug;
4647
captions: CaptionMessage[];
47-
}> = ({ captions }) => {
48+
}> = ({ captions: origCaptions }) => {
4849
const box = React.useRef<HTMLDivElement>(null);
50+
const [searchParams] = useSearchParams();
51+
const hidePartial = !!searchParams.get("hide_partial");
52+
53+
const captions = hidePartial
54+
? origCaptions.filter((v) => !v.is_partial)
55+
: origCaptions;
4956

5057
const lastcaption =
5158
captions.length > 0 ? captions[captions.length - 1] : undefined;

0 commit comments

Comments
 (0)