From 89bd3867a980993e28652d46cfc82e37a7db96d4 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Fri, 15 Mar 2024 20:26:13 -0500 Subject: [PATCH] Make all motion segments clickable (#10488) --- web/src/components/timeline/MotionSegment.tsx | 26 +++---------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/web/src/components/timeline/MotionSegment.tsx b/web/src/components/timeline/MotionSegment.tsx index 0ebcffd68..b06d655fb 100644 --- a/web/src/components/timeline/MotionSegment.tsx +++ b/web/src/components/timeline/MotionSegment.tsx @@ -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 (