• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

prabhuignoto / react-chrono / #99

08 Dec 2025 06:00PM UTC coverage: 64.754% (-25.9%) from 90.669%
#99

push

prabhuignoto
Update test command in coveralls workflow to align with Bun's command structure

2231 of 2661 branches covered (83.84%)

Branch coverage included in aggregate %.

14146 of 22630 relevant lines covered (62.51%)

15.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

71.79
/src/hooks/useSlideshowProgress.ts
1
import { useCallback, useEffect, useState, useRef } from 'react';
1✔
2

3
interface UseSlideshowProgressProps {
4
  /** Whether the slideshow is currently running */
5
  slideShowRunning: boolean;
6
  /** Current active timeline item index */
7
  activeTimelineItem: number;
8
}
9

10
interface SlideshowProgressState {
11
  /** Whether the slideshow progress is paused */
12
  isPaused: boolean;
13
  /** Pause the slideshow progress */
14
  pauseProgress: () => void;
15
  /** Resume the slideshow progress */
16
  resumeProgress: () => void;
17
}
18

19
/**
20
 * Custom hook to manage overall slideshow progress state
21
 * Optimized for performance with better timeout management
22
 */
23
export const useSlideshowProgress = ({
1✔
24
  slideShowRunning,
30✔
25
  activeTimelineItem,
30✔
26
}: UseSlideshowProgressProps): SlideshowProgressState => {
30✔
27
  const [isPaused, setIsPaused] = useState(false);
30✔
28
  const lastActiveItem = useRef(activeTimelineItem);
30✔
29

30
  // Clean up when slideshow stops
31
  useEffect(() => {
30✔
32
    if (!slideShowRunning) {
24✔
33
      setIsPaused(false);
24✔
34
    }
24✔
35
  }, [slideShowRunning]);
30✔
36

37
  // Reset pause state when active item changes (optimized)
38
  useEffect(() => {
30✔
39
    if (slideShowRunning && lastActiveItem.current !== activeTimelineItem) {
24!
40
      lastActiveItem.current = activeTimelineItem;
×
41
      if (isPaused) setIsPaused(false);
×
42
    }
×
43
  }, [activeTimelineItem, slideShowRunning, isPaused]);
30✔
44

45
  // Pause the progress
46
  const pauseProgress = useCallback(() => {
30✔
47
    if (slideShowRunning && !isPaused) {
×
48
      setIsPaused(true);
×
49
    }
×
50
  }, [slideShowRunning, isPaused]);
30✔
51

52
  // Resume the progress
53
  const resumeProgress = useCallback(() => {
30✔
54
    if (slideShowRunning && isPaused) {
×
55
      setIsPaused(false);
×
56
    }
×
57
  }, [slideShowRunning, isPaused]);
30✔
58

59
  return {
30✔
60
    isPaused,
30✔
61
    pauseProgress,
30✔
62
    resumeProgress,
30✔
63
  };
30✔
64
};
30✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc