From 9aac47409997ba2f7efbebeec394b590020fc589 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Wed, 18 Jan 2023 09:31:25 -0500 Subject: [PATCH] make sure it can handle Call ID on the URL --- frontend/src/Call/CallPlayer.js | 19 +++++++++++-------- frontend/src/Call/Calls.js | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/frontend/src/Call/CallPlayer.js b/frontend/src/Call/CallPlayer.js index ee2865f..1c87395 100644 --- a/frontend/src/Call/CallPlayer.js +++ b/frontend/src/Call/CallPlayer.js @@ -34,6 +34,9 @@ const socket = io(process.env.REACT_APP_BACKEND_SERVER); function CallPlayer(props) { const { shortName } = useParams(); + const loadCallId = props.loadCallId; + const callsData = props.callsData; + const { ref: loadOlderRef, inView: loadOlderInView } = useInView({ /* Optional options */ threshold: 0.5 @@ -42,21 +45,21 @@ function CallPlayer(props) { /* Optional options */ threshold: 0.5 }); + const { data: groupsData, isSuccess: isGroupsSuccess } = useGetGroupsQuery(shortName); const { data: talkgroupsData, isSuccess: isTalkgroupsSuccess } = useGetTalkgroupsQuery(shortName); - const callsData = props.callsData; + const [autoPlay, setAutoPlay] = useState(true); const [currentCall, setCurrentCall] = useState(false); const [isPlaying, setIsPlaying] = useState(false); - const [loadCallId, setLoadCallId] = useState(false); + const filterType = useSelector((state) => state.callPlayer.filterType); const filterGroupId = useSelector((state) => state.callPlayer.filterGroupId); const filterTalkgroups = useSelector((state) => state.callPlayer.filterTalkgroups); - const filterStarred = useSelector((state) => state.callPlayer.filterStarred); - const filterDate = useSelector((state) => state.callPlayer.filterDate); - const live = useSelector((state) => state.callPlayer.live); + + const navigate = useNavigate(); @@ -121,15 +124,15 @@ function CallPlayer(props) { dispatch(getOlderCalls({})); } }, [loadOlderInView]); -/* + useEffect(() => { - if ( loadCallId && callsData) { + if ( loadCallId && callsData && !currentCall) { const call = callsData.entities[loadCallId]; if (call) { setCurrentCall(call); } } - }, [callsData])*/ + }, [loadCallId, callsData]) useLayoutEffect( () => { const scrollAmount = parseInt(positionRef.current.clientHeight) - parseInt(pageYOffset.current); diff --git a/frontend/src/Call/Calls.js b/frontend/src/Call/Calls.js index 8996748..790550e 100644 --- a/frontend/src/Call/Calls.js +++ b/frontend/src/Call/Calls.js @@ -398,7 +398,7 @@ function Calls(props) { - + );