From 5e4d78c6f5d434bbe6c0f144776556bc432f4bd1 Mon Sep 17 00:00:00 2001 From: chamikaJ Date: Mon, 2 Jun 2025 09:19:58 +0530 Subject: [PATCH] refactor(task-details-form): enhance progress input handling and improve assignee rendering - Added `InlineMember` type import for better type management. - Enhanced the `Avatars` component to handle multiple sources for assignee names, improving flexibility in data handling. --- .../shared/info-tab/task-details-form.tsx | 35 +++++++++++-------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/worklenz-frontend/src/components/task-drawer/shared/info-tab/task-details-form.tsx b/worklenz-frontend/src/components/task-drawer/shared/info-tab/task-details-form.tsx index a2dcaef1..23dac128 100644 --- a/worklenz-frontend/src/components/task-drawer/shared/info-tab/task-details-form.tsx +++ b/worklenz-frontend/src/components/task-drawer/shared/info-tab/task-details-form.tsx @@ -30,6 +30,7 @@ import TaskDrawerProgress from './details/task-drawer-progress/task-drawer-progr import { useAppSelector } from '@/hooks/useAppSelector'; import logger from '@/utils/errorLogger'; import TaskDrawerRecurringConfig from './details/task-drawer-recurring-config/task-drawer-recurring-config'; +import { InlineMember } from '@/types/teamMembers/inlineMember.types'; interface TaskDetailsFormProps { taskFormViewModel?: ITaskFormViewModel | null; @@ -45,29 +46,32 @@ const ConditionalProgressInput = ({ task, form }: ConditionalProgressInputProps) const { project } = useAppSelector(state => state.projectReducer); const hasSubTasks = task?.sub_tasks_count > 0; const isSubTask = !!task?.parent_task_id; - - // Add more aggressive logging and checks - logger.debug(`Task ${task.id} status: hasSubTasks=${hasSubTasks}, isSubTask=${isSubTask}, modes: time=${project?.use_time_progress}, manual=${project?.use_manual_progress}, weighted=${project?.use_weighted_progress}`); - + // STRICT RULE: Never show progress input for parent tasks with subtasks // This is the most important check and must be done first if (hasSubTasks) { logger.debug(`Task ${task.id} has ${task.sub_tasks_count} subtasks. Hiding progress input.`); return null; } - + // Only for tasks without subtasks, determine which input to show based on project mode if (project?.use_time_progress) { // In time-based mode, show progress input ONLY for tasks without subtasks - return ; + return ( + + ); } else if (project?.use_manual_progress) { // In manual mode, show progress input ONLY for tasks without subtasks - return ; + return ( + + ); } else if (project?.use_weighted_progress && isSubTask) { // In weighted mode, show weight input for subtasks - return ; + return ( + + ); } - + return null; }; @@ -148,7 +152,13 @@ const TaskDetailsForm = ({ taskFormViewModel = null }: TaskDetailsFormProps) => - + @@ -160,10 +170,7 @@ const TaskDetailsForm = ({ taskFormViewModel = null }: TaskDetailsFormProps) => {taskFormViewModel?.task && ( - + )}