refactor(task-list): enhance task rendering and editing functionality in TaskRow and TaskListV2Table
- Updated TaskListV2Table to pass isFirstInGroup prop to renderTask for improved task grouping logic. - Enhanced TaskRow to support inline editing of task names with a new input field and associated state management. - Implemented click outside detection to save task name changes when editing is complete. - Improved layout and styling for better user experience during task editing and display.
This commit is contained in:
@@ -457,7 +457,7 @@ const TaskListV2Section: React.FC = () => {
|
||||
);
|
||||
|
||||
const renderTask = useCallback(
|
||||
(taskIndex: number) => {
|
||||
(taskIndex: number, isFirstInGroup: boolean = false) => {
|
||||
const item = virtuosoItems[taskIndex];
|
||||
|
||||
if (!item || !urlProjectId) return null;
|
||||
@@ -480,6 +480,7 @@ const TaskListV2Section: React.FC = () => {
|
||||
taskId={item.id}
|
||||
projectId={urlProjectId}
|
||||
visibleColumns={visibleColumns}
|
||||
isFirstInGroup={isFirstInGroup}
|
||||
updateTaskCustomColumnValue={updateTaskCustomColumnValue}
|
||||
/>
|
||||
);
|
||||
@@ -647,9 +648,12 @@ const TaskListV2Section: React.FC = () => {
|
||||
virtuosoGroups.slice(0, groupIndex).reduce((sum, g) => sum + g.count, 0) +
|
||||
taskIndex;
|
||||
|
||||
// Check if this is the first actual task in the group (not AddTaskRow)
|
||||
const isFirstTaskInGroup = taskIndex === 0 && !('isAddTaskRow' in task);
|
||||
|
||||
return (
|
||||
<div key={task.id || `add-task-${group.id}-${taskIndex}`}>
|
||||
{renderTask(globalTaskIndex)}
|
||||
{renderTask(globalTaskIndex, isFirstTaskInGroup)}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user