From dc75548abade5379d07099d8ffb1fd7aacb45eee Mon Sep 17 00:00:00 2001
From: Yuval Adam <_@yuv.al>
Date: Fri, 14 Nov 2025 08:56:02 +0100
Subject: Fix slider bug

---
 src/components/Slider.tsx | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

(limited to 'src/components/Slider.tsx')

diff --git a/src/components/Slider.tsx b/src/components/Slider.tsx
index 22a8f8f..2d62b2c 100644
--- a/src/components/Slider.tsx
+++ b/src/components/Slider.tsx
@@ -5,13 +5,14 @@ interface SliderProps {
   playback?: string;
   slider: number;
   setSlider: React.Dispatch<React.SetStateAction<number>>;
+  imageCount: number;
 }
 
-export function Slider({ playback, slider, setSlider }: SliderProps) {
+export function Slider({ playback, slider, setSlider, imageCount }: SliderProps) {
   const sliderRef = useRef<HTMLDivElement>(null);
   const [isDragging, setIsDragging] = useState(false);
 
-  const max = playback ? PLAYBACK_SLOTS : 9;
+  const max = playback ? PLAYBACK_SLOTS : Math.max(0, imageCount - 1);
 
   const handleStart = useCallback((e: React.MouseEvent | React.TouchEvent) => {
     setIsDragging(true);
-- 
cgit v1.3.1

