Allow users to edit tasks by clicking on them across the app
Adds click functionality to task cards and calendar entries to trigger the task edit modal, mirroring the existing calendar view behavior. Propagates click events to prevent conflicts with drag-and-drop functionality and timer toggling. Replit-Commit-Author: Agent Replit-Commit-Session-Id: ceced2fc-aa46-458d-ba87-ddd4b7bb1518 Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/659922a9-0087-461c-90dd-6d9a58b81d4d/ceced2fc-aa46-458d-ba87-ddd4b7bb1518/qdzfbac
This commit is contained in:
+1
-1
@@ -162,7 +162,7 @@ function App() {
|
||||
<TasksWithCalendar
|
||||
tasks={tasks}
|
||||
onTaskUpdate={handleTaskUpdate}
|
||||
onTaskEdit={(task) => console.log('Edit task:', task.title)}
|
||||
onTaskEdit={handleTaskClick}
|
||||
onStartTimer={startTimer}
|
||||
onStopTimer={stopTimer}
|
||||
/>
|
||||
|
||||
@@ -74,7 +74,7 @@ export default function TaskCard({ task, onStartTimer, onStopTimer, onEdit, onDe
|
||||
|
||||
return (
|
||||
<Card
|
||||
className={`p-4 hover-elevate active-elevate-2 transition-all duration-200 relative ${
|
||||
className={`p-4 hover-elevate active-elevate-2 transition-all duration-200 relative cursor-pointer ${
|
||||
isDragging ? 'rotate-1 scale-105 shadow-lg' : ''
|
||||
}`}
|
||||
style={taskLabel ? {
|
||||
@@ -83,6 +83,10 @@ export default function TaskCard({ task, onStartTimer, onStopTimer, onEdit, onDe
|
||||
borderStyle: 'solid'
|
||||
} : {}}
|
||||
data-testid={`card-task-${task.id}`}
|
||||
onClick={() => {
|
||||
onEdit?.();
|
||||
console.log(`Task card clicked: ${task.title}`);
|
||||
}}
|
||||
>
|
||||
<div className="flex items-start justify-between gap-3">
|
||||
<div className="flex-1 min-w-0">
|
||||
@@ -253,7 +257,10 @@ export default function TaskCard({ task, onStartTimer, onStopTimer, onEdit, onDe
|
||||
<Button
|
||||
size="icon"
|
||||
variant={task.isTracking ? "default" : "outline"}
|
||||
onClick={handleToggleTimer}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleToggleTimer();
|
||||
}}
|
||||
data-testid={`button-timer-${task.id}`}
|
||||
className="w-6 h-6"
|
||||
>
|
||||
|
||||
@@ -385,7 +385,14 @@ export default function TasksWithCalendar({ tasks, onTaskUpdate, onTaskEdit, onS
|
||||
draggable
|
||||
onDragStart={(e) => handleDragStart(task.id, e)}
|
||||
onDragEnd={handleDragEnd}
|
||||
className={`cursor-move ${draggedTask === task.id ? 'opacity-50' : ''}`}
|
||||
onClick={(e) => {
|
||||
// Prevent click when dragging
|
||||
if (draggedTask === task.id) return;
|
||||
e.stopPropagation();
|
||||
onTaskEdit?.(task);
|
||||
console.log('Calendar task clicked:', task.title);
|
||||
}}
|
||||
className={`cursor-pointer hover-elevate ${draggedTask === task.id ? 'opacity-50' : ''}`}
|
||||
data-testid={`calendar-task-${task.id}`}
|
||||
>
|
||||
<Badge
|
||||
|
||||
Reference in New Issue
Block a user