Make all motion segments clickable (#10488)

This commit is contained in:
Josh Hawkins 2024-03-15 20:26:13 -05:00 committed by GitHub
parent c14f3c3902
commit 89bd3867a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,7 +39,7 @@ export function MotionSegment({
shouldShowRoundedCorners,
} = useEventSegmentUtils(segmentDuration, events, severityType);
const { getMotionSegmentValue, interpolateMotionAudioData, getMotionStart } =
const { getMotionSegmentValue, interpolateMotionAudioData } =
useMotionSegmentUtils(segmentDuration, motion_events);
const { alignStartDateToTimeline, alignEndDateToTimeline } = useEventUtils(
@ -66,15 +66,6 @@ export function MotionSegment({
[shouldShowRoundedCorners, segmentTime],
);
const startTimestamp = useMemo(() => {
const eventStart = getMotionStart(segmentTime);
if (eventStart) {
return alignStartDateToTimeline(eventStart);
}
// we know that these deps are correct
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [getMotionStart, segmentTime]);
const timestamp = useMemo(() => new Date(segmentTime * 1000), [segmentTime]);
const segmentKey = useMemo(() => segmentTime, [segmentTime]);
@ -179,19 +170,10 @@ export function MotionSegment({
};
const segmentClick = useCallback(() => {
if (
startTimestamp &&
setHandlebarTime &&
(firstHalfSegmentWidth > 1 || secondHalfSegmentWidth > 1)
) {
setHandlebarTime(startTimestamp);
if (setHandlebarTime) {
setHandlebarTime(segmentTime);
}
}, [
startTimestamp,
setHandlebarTime,
firstHalfSegmentWidth,
secondHalfSegmentWidth,
]);
}, [segmentTime, setHandlebarTime]);
return (
<div