From c78b37e2d6dc2759fa2a10bb942796ac94004641 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Fri, 10 Feb 2023 10:52:35 +0100 Subject: [PATCH] fix(ui): fix notes/clickmap autoplay --- frontend/app/components/Session/WebPlayer.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/frontend/app/components/Session/WebPlayer.tsx b/frontend/app/components/Session/WebPlayer.tsx index 298fb1b77..4c4f58668 100644 --- a/frontend/app/components/Session/WebPlayer.tsx +++ b/frontend/app/components/Session/WebPlayer.tsx @@ -48,9 +48,9 @@ function WebPlayer(props: any) { notesStore.fetchSessionNotes(session.sessionId).then((r) => { const note = props.query.get('note'); if (note) { - WebPlayerInst.pause(); setNoteItem(notesStore.getNoteById(parseInt(note, 10), r)); setShowNote(true); + WebPlayerInst.pause(); } }) @@ -69,10 +69,13 @@ function WebPlayer(props: any) { const isPlayerReady = contextValue.store?.get().ready React.useEffect(() => { - if (activeTab !== 'Click Map') { + if (showNoteModal) { + contextValue.player.pause() + } + if (activeTab !== 'Click Map' && !showNoteModal && isPlayerReady) { contextValue.player && contextValue.player.play() } - }, [insights, isPlayerReady, jumpTimestamp]) + }, [activeTab, isPlayerReady, showNoteModal]) // LAYOUT (TODO: local layout state - useContext or something..) useEffect( @@ -85,7 +88,7 @@ function WebPlayer(props: any) { const onNoteClose = () => { setShowNote(false); - contextValue.player.togglePlay(); + contextValue.player.play(); }; if (!contextValue.player || !session) return null;