diff --git a/.replit b/.replit index 854ae92..61099cd 100644 --- a/.replit +++ b/.replit @@ -14,10 +14,6 @@ run = ["npm", "run", "start"] localPort = 5000 externalPort = 80 -[[ports]] -localPort = 33729 -externalPort = 3001 - [[ports]] localPort = 35345 externalPort = 3002 diff --git a/client/src/components/ProjectTemplate.tsx b/client/src/components/ProjectTemplate.tsx index c2163dd..e10195a 100644 --- a/client/src/components/ProjectTemplate.tsx +++ b/client/src/components/ProjectTemplate.tsx @@ -273,9 +273,14 @@ export default function ProjectTemplate({ const handleSaveTask = () => { if (editingTaskIndex !== null) { + const currentTask = projectTasks[editingTaskIndex]; const updatedTasks = [...projectTasks]; + + // Check if this is a new task (temporary ID) or existing task + const isNewTask = currentTask.id.startsWith('temp-'); + updatedTasks[editingTaskIndex] = { - id: projectTasks[editingTaskIndex].id, + id: isNewTask ? Date.now().toString() : currentTask.id, title: taskForm.title || 'New Task', description: taskForm.description || '', priority: taskForm.priority || 'medium', @@ -283,6 +288,7 @@ export default function ProjectTemplate({ estimatedHours: taskForm.estimatedHours || 0, labelId: taskForm.labelId }; + setProjectTasks(updatedTasks); } @@ -296,14 +302,41 @@ export default function ProjectTemplate({ }; const handleCancelTaskEdit = () => { + // If we're editing a task that has a temporary ID (new task), remove it from the list + if (editingTaskIndex !== null) { + const currentTask = projectTasks[editingTaskIndex]; + if (currentTask.id.startsWith('temp-')) { + const updatedTasks = projectTasks.filter((_, index) => index !== editingTaskIndex); + setProjectTasks(updatedTasks); + } + } + setTaskForm({}); setIsEditingTask(false); setEditingTaskIndex(null); }; const handleStartNewTask = () => { - setTaskForm({}); - setEditingTaskIndex(null); + // Create a temporary new task and add it to the list in edit mode + const tempTask: ProjectTask = { + id: 'temp-' + Date.now(), + title: '', + description: '', + priority: 'medium', + status: 'todo', + estimatedHours: 0 + }; + + const newTasks = [...projectTasks, tempTask]; + setProjectTasks(newTasks); + setEditingTaskIndex(newTasks.length - 1); + setTaskForm({ + title: '', + description: '', + priority: 'medium', + status: 'todo', + estimatedHours: 0 + }); setIsEditingTask(true); }; @@ -962,49 +995,149 @@ export default function ProjectTemplate({ - {/* Task List */} + {/* Task List with Inline Editing */}
{projectTasks.map((task, index) => ( - -
-
-

{task.title}

- {task.description && ( -

{task.description}

- )} -
- - {task.priority} - - - {task.status} - - {task.estimatedHours ? ( - - {task.estimatedHours}h - - ) : null} + + {editingTaskIndex === index ? ( + // Inline Edit Mode +
+
+
+ + setTaskForm({...taskForm, title: e.target.value})} + placeholder="Enter task title" + className="text-sm" + data-testid={`input-inline-task-title-${index}`} + /> +
+ +
+ + setTaskForm({...taskForm, description: e.target.value})} + placeholder="Enter task description" + className="text-sm" + data-testid={`input-inline-task-description-${index}`} + /> +
+ +
+ + +
+ +
+ + +
+ +
+ + setTaskForm({...taskForm, estimatedHours: Number(e.target.value)})} + placeholder="0" + min="0" + className="text-sm max-w-32" + data-testid={`input-inline-task-hours-${index}`} + /> +
+
+ +
+ +
-
- - + ) : ( + // Display Mode +
+
+

{task.title}

+ {task.description && ( +

{task.description}

+ )} +
+ + {task.priority} + + + {task.status} + + {task.estimatedHours ? ( + + {task.estimatedHours}h + + ) : null} +
+
+
+ + +
-
+ )}
))} @@ -1015,106 +1148,6 @@ export default function ProjectTemplate({ )}
- {/* Task Form */} - {isEditingTask && ( - -
-

- {editingTaskIndex !== null ? 'Edit Task' : 'New Task'} -

- -
-
- - setTaskForm({...taskForm, title: e.target.value})} - placeholder="Enter task title" - data-testid="input-task-title-edit" - /> -
- -
- - setTaskForm({...taskForm, description: e.target.value})} - placeholder="Enter task description" - data-testid="input-task-description-edit" - /> -
- -
- - -
- -
- - -
- -
- - setTaskForm({...taskForm, estimatedHours: Number(e.target.value)})} - placeholder="0" - min="0" - data-testid="input-task-hours-edit" - /> -
-
- -
- - -
-
-
- )}
)}