@@ -2,17 +2,18 @@ import { Todo, TaskStatus, Timeslot } from '../types';
22import { useEffect , useState } from 'react' ;
33import { Button } from './ui/button' ;
44import { cn , statusButtonClasses , statusBadgeClasses } from '../lib/utils' ;
5- import { Check , Circle , CircleDashed , SkipForward , Clock } from 'lucide-react' ;
5+ import { Check , Circle , CircleDashed , SkipForward , Clock , RotateCcw } from 'lucide-react' ;
66import { Badge } from './ui/badge' ;
77import { TimeslotChip } from './TimeslotChip' ;
88
99interface TodoItemProps {
1010 todo : Todo ;
1111 onStatusChange : ( id : number , status : TaskStatus ) => void ;
1212 timeslot ?: Timeslot ;
13+ onResetTimer ?: ( id : number ) => void ;
1314}
1415
15- export function TodoItem ( { todo, onStatusChange, timeslot } : TodoItemProps ) {
16+ export function TodoItem ( { todo, onStatusChange, timeslot, onResetTimer } : TodoItemProps ) {
1617 const handleStatusChange = ( newStatus : TaskStatus ) => {
1718 // Optimistic update delegated to parent
1819 onStatusChange ( todo . id , newStatus ) ;
@@ -165,6 +166,19 @@ export function TodoItem({ todo, onStatusChange, timeslot }: TodoItemProps) {
165166 </ Button >
166167 ) ;
167168 } ) }
169+ { onResetTimer && ( displaySeconds > 0 || todo . status === 'in-progress' ) && (
170+ < Button
171+ type = "button"
172+ variant = "outline"
173+ size = "sm"
174+ className = "flex items-center gap-1.5 border"
175+ onClick = { ( ) => onResetTimer ( todo . id ) }
176+ aria-label = "Reset in-progress timer"
177+ >
178+ < RotateCcw className = "w-4 h-4 sm:mr-2 shrink-0" />
179+ < span className = "hidden sm:inline" > Reset timer</ span >
180+ </ Button >
181+ ) }
168182 { /* Realtime timer moved next to title to match Recommended page styling */ }
169183 </ div >
170184
0 commit comments