mirror of
https://github.com/FranP-code/Pomodoro-Timer-with-Clockify-integration.git
synced 2025-10-12 23:52:30 +00:00
Fixed bug that dont allow the change of the times of the pomodoro timer
This commit is contained in:
@@ -2,8 +2,8 @@ import React, {useState} from 'react'
|
|||||||
|
|
||||||
const MainPomodoroTimer = (props) => {
|
const MainPomodoroTimer = (props) => {
|
||||||
|
|
||||||
const [minutes, setMinutes] = useState('61')
|
const [minutes, setMinutes] = useState('25')
|
||||||
const [seconds, setSeconds] = useState('60')
|
const [seconds, setSeconds] = useState('0')
|
||||||
|
|
||||||
const [breakTime, setBreakTime] = useState(undefined)
|
const [breakTime, setBreakTime] = useState(undefined)
|
||||||
const [weAreInBreakTime, setWeAreInBreakTime] = useState(false)
|
const [weAreInBreakTime, setWeAreInBreakTime] = useState(false)
|
||||||
@@ -12,6 +12,8 @@ const MainPomodoroTimer = (props) => {
|
|||||||
|
|
||||||
const [timerActivity, setTimerActivity] = useState(false)
|
const [timerActivity, setTimerActivity] = useState(false)
|
||||||
|
|
||||||
|
const [actualStyle, setActualStyle] = useState('Regular')
|
||||||
|
|
||||||
const setTimeStyle = () => {
|
const setTimeStyle = () => {
|
||||||
|
|
||||||
if (props.style === 'Can I play, Daddy?') {
|
if (props.style === 'Can I play, Daddy?') {
|
||||||
@@ -34,6 +36,8 @@ const MainPomodoroTimer = (props) => {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
setActualStyle(props.style)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
minutes, seconds, breakTime
|
minutes, seconds, breakTime
|
||||||
}
|
}
|
||||||
@@ -42,7 +46,7 @@ const MainPomodoroTimer = (props) => {
|
|||||||
|
|
||||||
if (props.style === 'Regular'){
|
if (props.style === 'Regular'){
|
||||||
|
|
||||||
const minutes = 3
|
const minutes = 25
|
||||||
const seconds = 0
|
const seconds = 0
|
||||||
|
|
||||||
setMinutes(minutes)
|
setMinutes(minutes)
|
||||||
@@ -51,16 +55,18 @@ const MainPomodoroTimer = (props) => {
|
|||||||
setBreakTime(
|
setBreakTime(
|
||||||
{
|
{
|
||||||
normal: {
|
normal: {
|
||||||
minutes: 0,
|
minutes: 5,
|
||||||
seconds: 15
|
seconds: 0
|
||||||
},
|
},
|
||||||
extended: {
|
extended: {
|
||||||
minutes: 0,
|
minutes: 15,
|
||||||
seconds: 20
|
seconds: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
setActualStyle(props.style)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
minutes, seconds, breakTime
|
minutes, seconds, breakTime
|
||||||
}
|
}
|
||||||
@@ -87,6 +93,8 @@ const MainPomodoroTimer = (props) => {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
setActualStyle(props.style)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
minutes, seconds, breakTime
|
minutes, seconds, breakTime
|
||||||
}
|
}
|
||||||
@@ -113,6 +121,8 @@ const MainPomodoroTimer = (props) => {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
setActualStyle(props.style)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
minutes, seconds, breakTime
|
minutes, seconds, breakTime
|
||||||
}
|
}
|
||||||
@@ -121,9 +131,12 @@ const MainPomodoroTimer = (props) => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
React.useEffect (
|
React.useEffect (() => {
|
||||||
setTimeStyle, []
|
if (actualStyle !== props.style) {
|
||||||
)
|
setTimeStyle()
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const startTimer = (velocity = 1) => {
|
const startTimer = (velocity = 1) => {
|
||||||
return setTimeout(() => {
|
return setTimeout(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user