Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When working time elapses, fun timer begins #10

Closed
Carsonwl opened this issue Oct 17, 2023 · 2 comments · Fixed by #11
Closed

When working time elapses, fun timer begins #10

Carsonwl opened this issue Oct 17, 2023 · 2 comments · Fixed by #11

Comments

@Carsonwl
Copy link
Owner

Pomodoro runs a timer for 25 minutes to focus. Then it runs a timer for 5 minutes for relaxation.

When our working time (timeValues.workTime) elapses, timer begins again with a new duration (timeValues.funTime).

@Carsonwl
Copy link
Owner Author

Found that this is an issue with the react-timer-hook:

amrlabib/react-timer-hook#70 #

@Carsonwl
Copy link
Owner Author

Fixed by adding a flipper boolean to the Timer component and a useEffect that causes the timer to rerender.

  useEffect(() => {
    const time = new Date();
    !timeValues.currWork ? time.setMinutes(time.getMinutes() + timeValues.workTime) : time.setMinutes(time.getMinutes() + timeValues.funTime);
    settimeValues({ ...timeValues, currWork: !timeValues.currWork });
    restart(time);
  }, [timerElapsed]);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant