Browse Source

Fixed.

master
Stian Aune 5 years ago
parent
commit
b909f32d57
  1. 12
      my-bois/src/components/Bois.jsx
  2. 2
      my-bois/src/components/Contexts.jsx

12
my-bois/src/components/Bois.jsx

@ -41,6 +41,7 @@ export const CentreBoi = () => {
const { const {
state, program, setProgram, bike, setBike, bikes, programs, state, program, setProgram, bike, setBike, bikes, programs,
start, pause, stop, create, workoutStatus, start, pause, stop, create, workoutStatus,
hidden, setHidden,
} = useContext(StatusContext); } = useContext(StatusContext);
const [options, setOptions] = useState(null); const [options, setOptions] = useState(null);
const [current, setCurrent] = useState(0); const [current, setCurrent] = useState(0);
@ -112,6 +113,17 @@ export const CentreBoi = () => {
} }
}); });
useKey("H", () => showHide());
useKey("h", () => showHide());
function showHide() {
setHidden(!hidden);
}
if (hidden) {
return null;
}
if (state === "started" && workoutStatus !== null) { if (state === "started" && workoutStatus !== null) {
const {minutes, seconds, calories} = workoutStatus; const {minutes, seconds, calories} = workoutStatus;
const diff = calculateDiff(program, minutes, seconds, calories); const diff = calculateDiff(program, minutes, seconds, calories);

2
my-bois/src/components/Contexts.jsx

@ -37,6 +37,7 @@ export const StatusContextProvider = ({children}) => {
const [state, setState] = useState("offline"); const [state, setState] = useState("offline");
const {milestones, prevDiff, prevLongDiff, msDispatch} = useMilestones(); const {milestones, prevDiff, prevLongDiff, msDispatch} = useMilestones();
const [socket, setSocket] = useState(null); const [socket, setSocket] = useState(null);
const [hidden, setHidden] = useState(false);
useEffect(() => { useEffect(() => {
if (programs === null) { if (programs === null) {
@ -161,6 +162,7 @@ export const StatusContextProvider = ({children}) => {
setBike, setProgram, setBike, setProgram,
create, resume, start, pause, stop, create, resume, start, pause, stop,
programs, bikes, programs, bikes,
hidden, setHidden,
}}> }}>
{children} {children}
</StatusContext.Provider> </StatusContext.Provider>

Loading…
Cancel
Save