From ab77b5ed48f336f19847da3194bd2c0da0efac7c Mon Sep 17 00:00:00 2001 From: Francisco Pessano Date: Fri, 24 Sep 2021 22:04:05 -0300 Subject: [PATCH] Added logic for verify that half of the pomodoro is been maked before count it --- src/components/MainPomodoroTimer.jsx | 35 +++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/components/MainPomodoroTimer.jsx b/src/components/MainPomodoroTimer.jsx index fe3dea6..91e9e86 100644 --- a/src/components/MainPomodoroTimer.jsx +++ b/src/components/MainPomodoroTimer.jsx @@ -33,12 +33,17 @@ const MainPomodoroTimer = (props) => { } } ) + + return { + minutes, seconds, breakTime + } + } if (props.style === 'Regular'){ - const minutes = 0 - const seconds = 5 + const minutes = 3 + const seconds = 0 setMinutes(minutes) setSeconds(seconds) @@ -56,6 +61,10 @@ const MainPomodoroTimer = (props) => { } ) + return { + minutes, seconds, breakTime + } + } if (props.style === 'Creative work') { @@ -77,6 +86,11 @@ const MainPomodoroTimer = (props) => { } } ) + + return { + minutes, seconds, breakTime + } + } if (props.style === 'Last minute delivery') { @@ -98,6 +112,11 @@ const MainPomodoroTimer = (props) => { } } ) + + return { + minutes, seconds, breakTime + } + } } @@ -247,9 +266,15 @@ const MainPomodoroTimer = (props) => { } else if (props.timerOn === false && timerActivity === true){ + if (!weAreInBreakTime) { - setPomodoroCounter('Pomodoros') - setRestCounter((restCounter + 1)) + + if (minutes < ( setTimeStyle().minutes / 2) ) { + setPomodoroCounter('Pomodoros') + setRestCounter((restCounter + 1)) + + } + } @@ -272,8 +297,6 @@ const MainPomodoroTimer = (props) => { setWeAreInBreakTime(false) } - setTimeStyle() - setTimerActivity(false) }