mirror of
https://github.com/FranP-code/Pomodoro-Timer-with-Clockify-integration.git
synced 2025-10-12 23:52:30 +00:00
The times passed in the pomodoro work cicle now are registered in Clockify (apparently)
This commit is contained in:
@@ -20,8 +20,6 @@ const MainPomodoroTimer = (props) => {
|
|||||||
const [alreadyCountingStart, setAlreadyCountingStart] = useState(false) /* TOO MUCH FUCKING STATES https://pbs.twimg.com/media/EoM2rXuW8AMRxZh?format=png&name=large*/
|
const [alreadyCountingStart, setAlreadyCountingStart] = useState(false) /* TOO MUCH FUCKING STATES https://pbs.twimg.com/media/EoM2rXuW8AMRxZh?format=png&name=large*/
|
||||||
const [alreadyCountingEnd, setAlreadyCountingEnd] = useState(false)
|
const [alreadyCountingEnd, setAlreadyCountingEnd] = useState(false)
|
||||||
|
|
||||||
const [startTime, setStartTime] = useState('')
|
|
||||||
|
|
||||||
const setTimeStyle = () => {
|
const setTimeStyle = () => {
|
||||||
|
|
||||||
if (props.style === 'Can I play, Daddy?') {
|
if (props.style === 'Can I play, Daddy?') {
|
||||||
@@ -227,7 +225,8 @@ const MainPomodoroTimer = (props) => {
|
|||||||
if (!weAreInBreakTime) {
|
if (!weAreInBreakTime) {
|
||||||
|
|
||||||
if (!alreadyCountingStart) {
|
if (!alreadyCountingStart) {
|
||||||
getAndFormatCurrentTime()
|
const time = getAndFormatCurrentTime()
|
||||||
|
props.setStartTime(time)
|
||||||
|
|
||||||
setAlreadyCountingStart(true)
|
setAlreadyCountingStart(true)
|
||||||
}
|
}
|
||||||
@@ -262,9 +261,12 @@ const MainPomodoroTimer = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!alreadyCountingEnd) {
|
if (!alreadyCountingEnd) {
|
||||||
getAndFormatCurrentTime()
|
const time = getAndFormatCurrentTime()
|
||||||
|
|
||||||
|
props.setEndTime(time)
|
||||||
setAlreadyCountingEnd(true)
|
setAlreadyCountingEnd(true)
|
||||||
|
|
||||||
|
props.setLetsUpload(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -322,9 +324,12 @@ const MainPomodoroTimer = (props) => {
|
|||||||
setRestCounter((restCounter + 1))
|
setRestCounter((restCounter + 1))
|
||||||
|
|
||||||
if (!alreadyCountingEnd) {
|
if (!alreadyCountingEnd) {
|
||||||
getAndFormatCurrentTime()
|
const time = getAndFormatCurrentTime()
|
||||||
|
|
||||||
|
props.setEndTime(time)
|
||||||
setAlreadyCountingEnd(true)
|
setAlreadyCountingEnd(true)
|
||||||
|
|
||||||
|
props.setLetsUpload(true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -353,8 +358,11 @@ const MainPomodoroTimer = (props) => {
|
|||||||
setTimerActivity(false)
|
setTimerActivity(false)
|
||||||
setTimeStyle()
|
setTimeStyle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setAlreadyCountingStart(false)
|
||||||
|
setAlreadyCountingEnd(false)
|
||||||
}
|
}
|
||||||
}, [props.timerOn, minutes, seconds, breakTime, setMinutes, setSeconds, getAndFormatCurrentTime, setAlreadyCountingEnd, setAlreadyCountingStart, alreadyCountingEnd, alreadyCountingStart]
|
}, [props.timerOn, minutes, seconds, breakTime, setMinutes, setSeconds, getAndFormatCurrentTime, setAlreadyCountingEnd, setAlreadyCountingStart, alreadyCountingEnd, alreadyCountingStart, props.setEndTime, props.endTime]
|
||||||
)
|
)
|
||||||
|
|
||||||
const formatMinutes = () => {
|
const formatMinutes = () => {
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import React, {useState} from 'react'
|
|||||||
import MainPomodoroTimer from './Main Pomodoro Childrens/MainPomodoroTimer'
|
import MainPomodoroTimer from './Main Pomodoro Childrens/MainPomodoroTimer'
|
||||||
import PomodoroCounter from './Main Pomodoro Childrens/PomodoroCounter'
|
import PomodoroCounter from './Main Pomodoro Childrens/PomodoroCounter'
|
||||||
import StyleSelector from './Main Pomodoro Childrens/StyleSelector'
|
import StyleSelector from './Main Pomodoro Childrens/StyleSelector'
|
||||||
|
import uploadToClockifyTimer from './Clockify/uploadToClockifyTimer'
|
||||||
|
import react from 'react'
|
||||||
|
|
||||||
|
|
||||||
const MainPomodoro = (props) => {
|
const MainPomodoro = (props) => {
|
||||||
@@ -16,12 +17,35 @@ const MainPomodoro = (props) => {
|
|||||||
const [rests, setRests] = useState(0)
|
const [rests, setRests] = useState(0)
|
||||||
const [longRests, setLongRests] = useState(0)
|
const [longRests, setLongRests] = useState(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
const [startTime, setStartTime] = useState('')
|
||||||
|
const [endTime, setEndTime] = useState('')
|
||||||
|
|
||||||
|
const [letsUpload, setLetsUpload] = useState(false)
|
||||||
|
|
||||||
|
|
||||||
const showStyles = () => {
|
const showStyles = () => {
|
||||||
console.log('Styles Deployed')
|
console.log('Styles Deployed')
|
||||||
|
|
||||||
setDisplayHidden(!displayHidden)
|
setDisplayHidden(!displayHidden)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
React.useEffect( () => {
|
||||||
|
if (letsUpload) {
|
||||||
|
|
||||||
|
uploadToClockifyTimer( props.workspaceID, props.projectID, startTime, endTime, props.apiKey)
|
||||||
|
|
||||||
|
setLetsUpload(false)
|
||||||
|
|
||||||
|
setStartTime('')
|
||||||
|
setEndTime('')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="main-pomodoro">
|
<div className="main-pomodoro">
|
||||||
@@ -50,6 +74,20 @@ const MainPomodoro = (props) => {
|
|||||||
setProjectID={props.setProjectID}
|
setProjectID={props.setProjectID}
|
||||||
|
|
||||||
apiKey={props.apiKey}
|
apiKey={props.apiKey}
|
||||||
|
|
||||||
|
/*alreadyCountingStart={alreadyCountingStart}
|
||||||
|
setAlreadyCountingStart={setAlreadyCountingStart}
|
||||||
|
|
||||||
|
alreadyCountingEnd={alreadyCountingEnd}
|
||||||
|
setAlreadyCountingEnd={setAlreadyCountingEnd}*/
|
||||||
|
|
||||||
|
startTime={startTime}
|
||||||
|
setStartTime={setStartTime}
|
||||||
|
|
||||||
|
endtime={endTime}
|
||||||
|
setEndTime={setEndTime}
|
||||||
|
|
||||||
|
setLetsUpload={setLetsUpload}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user