From 5aa1fb2d1b63e6f3e2972e6f257900cafcf97fe1 Mon Sep 17 00:00:00 2001 From: inmake Date: Wed, 20 Mar 2024 13:02:08 +0500 Subject: [PATCH] upd --- src/components/Histories.tsx | 105 +++++++++++++++++++++++------------ 1 file changed, 68 insertions(+), 37 deletions(-) diff --git a/src/components/Histories.tsx b/src/components/Histories.tsx index 1f9e050..34ebd40 100644 --- a/src/components/Histories.tsx +++ b/src/components/Histories.tsx @@ -17,7 +17,9 @@ const Histories = () => { const handlers = useSwipeable({ onSwipedLeft: handleOnRightMove, onSwipedRight: handleOnLeftMove, + trackMouse: true, }); + const [selectedVideo, setSelectedVideo] = useState(1); useLayoutEffect(() => { const screenWidth = window.screen.width; @@ -49,9 +51,7 @@ const Histories = () => { video.current.pause(); } }); - }, [currentOffset, videoRefs]); - useEffect(() => { for (let i = 0; i < videoRefs.length; i++) { const video = videoRefs[i]; if (video.current && i === -currentOffset) { @@ -72,10 +72,10 @@ const Histories = () => { const interval = setInterval(() => { if (!currentVideoRef || !currentVideoRef.current) return; - const progress = Math.round( + const progress = (100 / currentVideoRef.current.duration) * - currentVideoRef.current.currentTime - ); + currentVideoRef.current.currentTime; + setVideoProgress(progress); if (progress === 100) { clearInterval(interval); @@ -132,55 +132,86 @@ const Histories = () => { -
-
+
+
-
-
-
-
-
-
- {currentOffset === -2 && ( -
+