Skip to content

Commit 5ed1ffb

Browse files
committed
feat: Refactor TaskTimerButton for improved hover functionality and click handling
1 parent d959d12 commit 5ed1ffb

File tree

1 file changed

+20
-32
lines changed

1 file changed

+20
-32
lines changed

ui/src/components/task/TaskTimerButton.tsx

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -54,42 +54,30 @@ export const TaskTimerButton = ({
5454
}
5555

5656
return (
57-
<div
58-
className="relative"
57+
<Button
58+
size="icon"
59+
variant="outline"
60+
className="h-8 w-8 hover:bg-opacity-10"
61+
style={{
62+
color: categoryColor,
63+
borderColor: categoryColor,
64+
backgroundColor: `${categoryColor}20`,
65+
}}
66+
disabled={!onRepeatTask}
67+
onClick={(e) => {
68+
if (onRepeatTask) {
69+
e.stopPropagation();
70+
onRepeatTask(task);
71+
}
72+
}}
5973
onMouseEnter={() => setIsHovered(true)}
6074
onMouseLeave={() => setIsHovered(false)}
6175
>
62-
<Button
63-
size="icon"
64-
variant="outline"
65-
className="h-8 w-8"
66-
style={{
67-
color: categoryColor,
68-
borderColor: categoryColor,
69-
backgroundColor: `${categoryColor}20`,
70-
}}
71-
disabled
72-
>
76+
{isHovered && onRepeatTask ? (
77+
<RotateCcw className="h-4 w-4" />
78+
) : (
7379
<CheckCircle2 className="h-4 w-4" />
74-
</Button>
75-
76-
{isHovered && onRepeatTask && (
77-
<Button
78-
size="icon"
79-
variant="outline"
80-
className="absolute -top-2 -right-2 h-6 w-6 bg-white shadow-md hover:bg-gray-50"
81-
onClick={(e) => {
82-
e.stopPropagation();
83-
onRepeatTask(task);
84-
}}
85-
style={{
86-
color: categoryColor,
87-
borderColor: categoryColor,
88-
}}
89-
>
90-
<RotateCcw className="h-3 w-3" />
91-
</Button>
9280
)}
93-
</div>
81+
</Button>
9482
);
9583
};

0 commit comments

Comments
 (0)