From ea1670f6e05d22c516d364072b7dde9bf3ebb5ae Mon Sep 17 00:00:00 2001
From: Yuval Adam <_@yuv.al>
Date: Thu, 1 Sep 2022 11:18:13 +0300
Subject: Extract playback slots to config

---
 src/Geshem.tsx | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

(limited to 'src/Geshem.tsx')

diff --git a/src/Geshem.tsx b/src/Geshem.tsx
index 5210622..6e88f19 100644
--- a/src/Geshem.tsx
+++ b/src/Geshem.tsx
@@ -5,7 +5,7 @@ import { Map } from "./Map";
 import { Slider } from "./Slider";
 import { DateTime } from "./Datetime";
 
-import { IMAGES_BASE_URL } from "./config";
+import { IMAGES_BASE_URL, PLAYBACK_HOURS, PLAYBACK_SLOTS } from "./config";
 
 import "./Geshem.css";
 import "rc-slider/assets/index.css";
@@ -25,6 +25,7 @@ interface GeshemProps {
   date?: string
 }
 
+
 export function Geshem({ date }: GeshemProps) {
   const [images, setImages] = useState<string[]>([]);
   const [playback] = useState(
@@ -32,7 +33,7 @@ export function Geshem({ date }: GeshemProps) {
     new URL(window.location.toString()).searchParams.get("history") ||
     undefined
   );
-  const [slider, setSlider] = useState(playback ? 143 : 9);
+  const [slider, setSlider] = useState(playback ? PLAYBACK_SLOTS : 9);
 
   useEffect(() => {
     const fetchImages = async () =>
@@ -43,7 +44,7 @@ export function Geshem({ date }: GeshemProps) {
 
     const buildPlayback = async () => {
       const date = playback;
-      const hours = Array.from(Array(24).keys()).map(
+      const hours = Array.from(Array(PLAYBACK_HOURS).keys()).map(
         h => `${String(h).padStart(2, "0")}`
       );
       const minutes = Array.from(Array(6).keys()).map(
-- 
cgit v1.3.1

