|
@ -1,4 +1,4 @@ |
|
|
import React, {useContext, useEffect, useState} from 'react'; |
|
|
|
|
|
|
|
|
import React, {useCallback, useContext, useEffect, useState} from 'react'; |
|
|
|
|
|
|
|
|
import "./Bois.css"; |
|
|
import "./Bois.css"; |
|
|
import {StatusContext} from "./Contexts"; |
|
|
import {StatusContext} from "./Contexts"; |
|
@ -17,7 +17,7 @@ const Boi = ({type, children}) => { |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
export const LeftBoi = () => { |
|
|
export const LeftBoi = () => { |
|
|
const {prevLongDiff, workout, workoutStatus, program, hidden} = useContext(StatusContext); |
|
|
|
|
|
|
|
|
const {prevDiff, prevLongDiff, workout, workoutStatus, program, hidden} = useContext(StatusContext); |
|
|
if (workoutStatus === null || workout === null || program === null || hidden) { |
|
|
if (workoutStatus === null || workout === null || program === null || hidden) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
@ -30,7 +30,7 @@ export const LeftBoi = () => { |
|
|
return ( |
|
|
return ( |
|
|
<Boi type="left"> |
|
|
<Boi type="left"> |
|
|
<Timer minutes={minutes} seconds={seconds} cooldownMin={cooldownMin}/> |
|
|
<Timer minutes={minutes} seconds={seconds} cooldownMin={cooldownMin}/> |
|
|
<CalorieScore calories={calories} diff={diff} prevDiff={prevLongDiff}/> |
|
|
|
|
|
|
|
|
<CalorieScore calories={calories} diff={diff} prevDiff={prevLongDiff} stonks={prevDiff}/> |
|
|
<RpmScore rpm={rpm}/> |
|
|
<RpmScore rpm={rpm}/> |
|
|
<CpmScore cpm={cpm}/> |
|
|
<CpmScore cpm={cpm}/> |
|
|
<LevelScore level={level}/> |
|
|
<LevelScore level={level}/> |
|
@ -110,15 +110,22 @@ export const CentreBoi = () => { |
|
|
return false; |
|
|
return false; |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
useKey("Escape", () => { |
|
|
|
|
|
|
|
|
const showHide = useCallback(() => { |
|
|
|
|
|
setHidden(!hidden); |
|
|
|
|
|
}, [setHidden, hidden]); |
|
|
|
|
|
|
|
|
|
|
|
const stopRun = useCallback(() => { |
|
|
if (state === "connected") { |
|
|
if (state === "connected") { |
|
|
stop(); |
|
|
stop(); |
|
|
|
|
|
setHidden(false); |
|
|
|
|
|
|
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
|
|
|
}, [state, stop, setHidden]); |
|
|
|
|
|
|
|
|
|
|
|
useKey("Escape", stopRun); |
|
|
|
|
|
|
|
|
useKey(["H", "h"], () => showHide()); |
|
|
|
|
|
|
|
|
useKey(["H", "h", "/"], showHide); |
|
|
|
|
|
|
|
|
useKey("*", () => { |
|
|
useKey("*", () => { |
|
|
if (state === "started" || state === "connected") { |
|
|
if (state === "started" || state === "connected") { |
|
@ -126,10 +133,6 @@ export const CentreBoi = () => { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
function showHide() { |
|
|
|
|
|
setHidden(!hidden); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (hidden) { |
|
|
if (hidden) { |
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|