diff --git a/frontend/src/editor/player.tsx b/frontend/src/editor/player.tsx index 5e1a43de..1d7a6097 100644 --- a/frontend/src/editor/player.tsx +++ b/frontend/src/editor/player.tsx @@ -23,7 +23,15 @@ const SKIP_SHORTCUT_SEC = 3; let lastTabPressTs = 0; -export function PlayerBar({ documentId, editor }: { documentId: string; editor: Editor }) { +export function PlayerBar({ + documentId, + editor, + onShowVideo, +}: { + documentId: string; + editor: Editor; + onShowVideo?: (show: boolean) => void; +}) { const { data } = useGetDocument( { document_id: documentId }, { @@ -61,6 +69,12 @@ export function PlayerBar({ documentId, editor }: { documentId: string; editor: videoPreview: hasVideo, }); + useEffect(() => { + if (onShowVideo) { + onShowVideo(hasVideo); + } + }, [hasVideo]); + // calculate the start of the current element to color it const [currentElementStartTime, setCurrentElementStartTime] = useState(0.0); diff --git a/frontend/src/editor/transcription_editor.tsx b/frontend/src/editor/transcription_editor.tsx index 46688bb6..c5becb43 100644 --- a/frontend/src/editor/transcription_editor.tsx +++ b/frontend/src/editor/transcription_editor.tsx @@ -224,12 +224,14 @@ export function TranscriptionEditor({ documentId, readOnly, initialValue, + onShowVideo, ...props }: { editor?: Editor; documentId: string; readOnly: boolean; initialValue?: Paragraph[]; + onShowVideo?: (show: boolean) => void; } & ComponentProps<'div'>) { const systemPrefersDark = useMediaQuery('(prefers-color-scheme: dark)'); // prevent ctrl+s @@ -312,7 +314,7 @@ export function TranscriptionEditor({ className={clsx('2xl:-ml-20')} /> - + diff --git a/frontend/src/pages/document.tsx b/frontend/src/pages/document.tsx index 9b6da10a..1ed18558 100644 --- a/frontend/src/pages/document.tsx +++ b/frontend/src/pages/document.tsx @@ -112,6 +112,7 @@ export function DocumentPage({ const [_location, navigate] = useLocation(); const debugMode = useDebugMode(); const { isLoggedIn } = useAuthData(); + const [videoVisible, setVideoVisible] = useState(false); const url = getDocumentWsUrl(documentId); @@ -188,6 +189,7 @@ export function DocumentPage({ + {/* Spacer to prevent video preview from hiding text */} + {videoVisible &&
} + {editor && debugMode && {}} );