Skip to content

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

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!! 💰

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions