Skip to content

Add time tracker to measure actual time spent on task ⏱️ #531

Description

@anoopcodehack

Add time tracker to measure actual time spent on task ⏱️

File: client/src/components/Board/TaskCard.jsx

Pomodoro counts sessions but never tracks
ACTUAL time spent on each task 💀 fr!!

Fix: add timer to task card:
const [elapsed, setElapsed] = useState(0)
const [tracking, setTracking] = useState(false)
const intervalRef = useRef(null)

const toggleTimer = (e) => {
e.stopPropagation()
if (tracking) {
clearInterval(intervalRef.current)
} else {
intervalRef.current = setInterval(() => {
setElapsed(s => s + 1)
}, 1000)
}
setTracking(t => !t)
}

const formatTime = (s) => {
const h = Math.floor(s / 3600)
const m = Math.floor((s % 3600) / 60)
const sec = s % 60
return ${h}:${String(m).padStart(2,'0')}:${String(sec).padStart(2,'0')}
}

<button onClick={toggleTimer}
className={text-[10px] font-mono ${tracking ? 'text-green-400 animate-pulse' : 'text-[#555]'}}>
{tracking ? '⏸' : '▶'} {formatTime(elapsed)}

~20 lines! No backend needed 🎯
Super useful for freelancers!! 💰

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions