From 7bb25a0e8588b1a545cc5bda9d819b4ebc0aa690 Mon Sep 17 00:00:00 2001 From: Francisco Pessano Date: Mon, 24 Jan 2022 09:44:17 -0300 Subject: [PATCH] Check if I can fix Netlify's deploy bug --- .../MainPomodoroTimer.jsx | 78 +++++++++---------- 1 file changed, 38 insertions(+), 40 deletions(-) diff --git a/src/components/Main Pomodoro Childrens/MainPomodoroTimer.jsx b/src/components/Main Pomodoro Childrens/MainPomodoroTimer.jsx index 6b5e444..c900314 100644 --- a/src/components/Main Pomodoro Childrens/MainPomodoroTimer.jsx +++ b/src/components/Main Pomodoro Childrens/MainPomodoroTimer.jsx @@ -181,19 +181,20 @@ const MainPomodoroTimer = (props) => { } if (minutes === 0 && seconds === 0) { - setTimerActivity(false) - - playAudio('work') - - if (notificationPermission) { - - new Notification('Pomodoro ended'); - } - - if (restCounter !== 3){ + setTimeout( () => { + + setTimerActivity(false) + + playAudio('work') + + if (notificationPermission) { + + new Notification('Pomodoro ended'); + } + + if (restCounter !== 3){ - setTimeout( () => { setPomodoroCounter('Pomodoros') setRestCounter((restCounter + 1)) @@ -201,35 +202,31 @@ const MainPomodoroTimer = (props) => { setBreak(1, 0) setWeAreInBreakTime(true) - }, 1000) + + } - } - - if (restCounter === 3) { - - setTimeout( () => { + if (restCounter === 3) { + setPomodoroCounter('Pomodoros') setRestCounter((restCounter + 1)) setBreak(0, 1) - setWeAreInBreakTime(true) + setWeAreInBreakTime(true) + } + + if (!alreadyCountingEnd) { + const time = getAndFormatCurrentTime(props.KonamiCodeActive) - }, 1000) - } + props.setEndTime(time) + setAlreadyCountingEnd(true) + + props.setLetsUpload(true) - if (!alreadyCountingEnd) { - const time = getAndFormatCurrentTime(props.KonamiCodeActive) - - props.setEndTime(time) - setAlreadyCountingEnd(true) - - props.setLetsUpload(true) - - document.title = randomText('rest') - } + document.title = randomText('rest') + } + }, 1000) } - if (minutes >= 0 || seconds > 0) { idTimeOut = startTimer() @@ -241,16 +238,17 @@ const MainPomodoroTimer = (props) => { getFavicon().href = './img/rest favicon.ico' if (minutes === 0 && seconds === 0) { - setTimerActivity(false) - - playAudio('rest') - - if (notificationPermission) { - - new Notification('Rest ended'); - } - + setTimeout( () => { + + setTimerActivity(false) + + playAudio('rest') + + if (notificationPermission) { + + new Notification('Rest ended'); + } if (restCounter === 4) { setPomodoroCounter('Long Rest')