smooth scroll land

This commit is contained in:
Luke Berndt
2023-01-26 07:36:04 -05:00
parent e8b81f77a1
commit 28ac40b3c7
2 changed files with 36 additions and 13 deletions

View File

@@ -5,7 +5,6 @@ import SupportModal from "./components/SupportModal";
import CallInfo from "./components/CallInfo";
import ListCalls from "./components/ListCalls";
import { useSelector, useDispatch } from 'react-redux'
import { getOlderCalls, getNewerCalls } from "../features/calls/callsSlice";
import { useGetTalkgroupsQuery } from '../features/api/apiSlice'
import { useInView } from 'react-intersection-observer';
import {
@@ -32,6 +31,8 @@ function CallPlayer(props) {
const { shortName } = useParams();
const selectCallId = props.selectCallId;
const callsData = props.callsData;
const handleNewer = props.handleNewer;
const handleOlder = props.handleOlder;
const { ref: loadOlderRef, inView: loadOlderInView } = useInView({
/* Optional options */
threshold: 0.5
@@ -92,15 +93,15 @@ function CallPlayer(props) {
}
useEffect(() => {
if (loadNewerInView && !live && callsData && (callsData.ids.length > 0)) {
dispatch(getNewerCalls({}));
if (loadNewerInView && callsData && (callsData.ids.length > 0)) {
handleNewer();
}
}, [loadNewerInView]);
useEffect(() => {
if (loadOlderInView && callsData && (callsData.ids.length > 0)) {
dispatch(getOlderCalls({}));
handleOlder();
}
}, [loadOlderInView]);