|
@@ -30,7 +30,10 @@ const Timer = ({ training }: { training: ITraining }) => {
|
|
two: [13208, 13930 - 13208],
|
|
two: [13208, 13930 - 13208],
|
|
one: [14376, 14948 - 14376],
|
|
one: [14376, 14948 - 14376],
|
|
go: [18219, 18735 - 18219],
|
|
go: [18219, 18735 - 18219],
|
|
- rest: [18988, 19615 - 18988]
|
|
|
|
|
|
+ rest: [18988, 19615 - 18988],
|
|
|
|
+ ninety: [24418, 25540 - 24418],
|
|
|
|
+ sixty: [25791, 26831 - 25791],
|
|
|
|
+ thirty: [27027, 28250 - 27027]
|
|
}
|
|
}
|
|
})
|
|
})
|
|
);
|
|
);
|
|
@@ -54,20 +57,23 @@ const Timer = ({ training }: { training: ITraining }) => {
|
|
//console.log("aaa", time, currentExercise);
|
|
//console.log("aaa", time, currentExercise);
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
|
+ if (time > state.totalTime) stopTimer();
|
|
const countdown = currentExercise
|
|
const countdown = currentExercise
|
|
? currentExercise.duration + currentExercise.offset - timer.intTime + 1
|
|
? currentExercise.duration + currentExercise.offset - timer.intTime + 1
|
|
: 0;
|
|
: 0;
|
|
- if (timer.running && rosie.current) {
|
|
|
|
- if (countdown === 5) rosie.current.play("five");
|
|
|
|
|
|
+ if (timer.running && rosie.current && !rosie.current.playing()) {
|
|
|
|
+ if (exerciseTime < 1) {
|
|
|
|
+ if (currentExercise && currentExercise.exercise !== "Rest")
|
|
|
|
+ rosie.current.play("go");
|
|
|
|
+ else rosie.current.play("rest");
|
|
|
|
+ } else if (countdown === 90) rosie.current.play("ninety");
|
|
|
|
+ else if (countdown === 60) rosie.current.play("sixty");
|
|
|
|
+ else if (countdown === 30) rosie.current.play("thirty");
|
|
|
|
+ else if (countdown === 5) rosie.current.play("five");
|
|
else if (countdown === 4) rosie.current.play("four");
|
|
else if (countdown === 4) rosie.current.play("four");
|
|
else if (countdown === 3) rosie.current.play("three");
|
|
else if (countdown === 3) rosie.current.play("three");
|
|
else if (countdown === 2) rosie.current.play("two");
|
|
else if (countdown === 2) rosie.current.play("two");
|
|
else if (countdown === 1) rosie.current.play("one");
|
|
else if (countdown === 1) rosie.current.play("one");
|
|
- if (exerciseTime < 1) {
|
|
|
|
- if (currentExercise && currentExercise.exercise === "Rest")
|
|
|
|
- rosie.current.play("rest");
|
|
|
|
- else rosie.current.play("go");
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
}, [time, timer.running]);
|
|
}, [time, timer.running]);
|
|
|
|
|
|
@@ -101,6 +107,10 @@ const Timer = ({ training }: { training: ITraining }) => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ const videoSrc =
|
|
|
|
+ currentExercise && currentExercise.video
|
|
|
|
+ ? currentExercise.video
|
|
|
|
+ : "/media/Pexels_Videos_2786540.mp4";
|
|
//console.log("current state:", currentExercise, state);
|
|
//console.log("current state:", currentExercise, state);
|
|
|
|
|
|
return (
|
|
return (
|
|
@@ -108,13 +118,20 @@ const Timer = ({ training }: { training: ITraining }) => {
|
|
<div>
|
|
<div>
|
|
{/*<label htmlFor="rest">Rest</label>
|
|
{/*<label htmlFor="rest">Rest</label>
|
|
<input type="number" min="25" max="60" step="5" defaultValue="25" />*/}
|
|
<input type="number" min="25" max="60" step="5" defaultValue="25" />*/}
|
|
- <button onClick={back}>back</button>
|
|
|
|
|
|
+ <button onClick={back} disabled={timer.running}>
|
|
|
|
+ back
|
|
|
|
+ </button>
|
|
<button onClick={timer.running ? stopTimer : startTimer}>
|
|
<button onClick={timer.running ? stopTimer : startTimer}>
|
|
{timer.running ? "stop" : "start"}
|
|
{timer.running ? "stop" : "start"}
|
|
</button>
|
|
</button>
|
|
- <button onClick={forward}>forward</button>
|
|
|
|
|
|
+ <button onClick={forward} disabled={timer.running}>
|
|
|
|
+ forward
|
|
|
|
+ </button>
|
|
</div>
|
|
</div>
|
|
<div className="content">
|
|
<div className="content">
|
|
|
|
+ <h1>
|
|
|
|
+ {(currentExercise && currentExercise.toplevelBlock) || "Torture"}
|
|
|
|
+ </h1>
|
|
<Countdown
|
|
<Countdown
|
|
seconds={
|
|
seconds={
|
|
currentExercise ? currentExercise.duration - exerciseTime : 0
|
|
currentExercise ? currentExercise.duration - exerciseTime : 0
|
|
@@ -134,11 +151,7 @@ const Timer = ({ training }: { training: ITraining }) => {
|
|
{nextExercise ? nextExercise.exercise : "😎"}
|
|
{nextExercise ? nextExercise.exercise : "😎"}
|
|
</div>
|
|
</div>
|
|
<VideoPlayer
|
|
<VideoPlayer
|
|
- src={
|
|
|
|
- currentExercise && currentExercise.video
|
|
|
|
- ? currentExercise.video
|
|
|
|
- : ""
|
|
|
|
- }
|
|
|
|
|
|
+ src={videoSrc}
|
|
getVideoHandle={(videoHandle: VideoJsPlayer) =>
|
|
getVideoHandle={(videoHandle: VideoJsPlayer) =>
|
|
(video.current = videoHandle)
|
|
(video.current = videoHandle)
|
|
}
|
|
}
|
|
@@ -171,6 +184,9 @@ const Timer = ({ training }: { training: ITraining }) => {
|
|
grid-auto-flow: dense;
|
|
grid-auto-flow: dense;
|
|
grid-template-columns: 1fr auto;
|
|
grid-template-columns: 1fr auto;
|
|
}
|
|
}
|
|
|
|
+ .content h1 {
|
|
|
|
+ grid-column: 1/3;
|
|
|
|
+ }
|
|
.header,
|
|
.header,
|
|
.exercise {
|
|
.exercise {
|
|
grid-column: 1/2;
|
|
grid-column: 1/2;
|