Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Unit Tests for Refactored
TaskDetails
Subcomponents (#1245)
* refactor(TaskDetails): Modularize and optimize TaskDetails component for improved maintainability and performance - Broke down TaskDetails component into smaller, focused subcomponents: TaskHeader, TaskDescription, TaskDetailsSection, TaskParticipants, TaskDates, TaskDependencies, and TaskProgress. - Maintained consistent styling using existing CSS classes from task-details.module.scss. - Ensured all functionalities, including editing, API integration, and state management, remain intact. - Added performance optimizations using React best practices, such as useCallback and useMemo where applicable. - Handled loading and error states, as well as edge cases like empty data gracefully. * fix(TaskDetails): Correct data type issues and ensure proper conditional rendering - Resolved type issues, ensuring is correctly handled as a number. - Fixed conditional rendering to prevent the edit button from appearing for unauthorized users. - Ensured consistent date formatting using utility. - Improved type safety across the TaskDetails subcomponents to prevent future issues. - Maintained all functionality from previous refactor, including state management and API integration. * fix(task-details): Correct the position of status and link fields - Adjusted the position of the 'Status' and 'Link' fields within the TaskDetailsSection component to ensure they are displayed correctly. - Ensured that the 'Status' dropdown is only visible in edit mode and does not appear twice. - Verified that the layout matches the design specifications when switching between view and edit modes. * chore: remove unnecessary comments from the code * fix: restore original styling for TaskDates and TaskParticipants components - Reverted changes in the component structure that affected the layout and styling. - Ensured the CSS classes are applied correctly and match the pre-refactor styling. - Adjusted the JSX structure to maintain the original visual layout. * test: Add unit tests for TaskHeader component of refactored TaskDetails subcomponents * test: Add unit tests for TaskDescription component of refactored TaskDetails subcomponents * test: Add unit tests for TaskProgress component of refactored TaskDetails subcomponents * test: Add unit tests for TaskParticipants component of refactored TaskDetails subcomponents * test: Add unit tests for TaskDates component of refactored TaskDetails subcomponents * test: Add unit tests for TaskDetailsSection component of refactored TaskDetails subcomponents * test: Add unit tests for TaskDependencies component of refactored TaskDetails subcomponents * chore: remove react memo from every component as it was unnecessary * chore: remove react memo from every component as it was unnecessary * refactor: TaskDates component to conditionally render Details based on extension request status * refactor: switch to named exports for all of the sub-components * chore: remove any from TaskDetails component and replace them with appropiates type * chore * Delete src/components/taskDetails/TaskProgress.tsx * Delete src/components/taskDetails/TaskParticipants.tsx * Delete src/components/taskDetails/TaskHeader.tsx * Delete src/components/taskDetails/TaskDetailsSection.tsx * Delete src/components/taskDetails/TaskDescription.tsx * Delete src/components/taskDetails/TaskDependencies.tsx * Delete src/components/taskDetails/TaskDates.tsx * chore: removed default export from every sub-component as we are already using named export * chore: removed default export from every sub-component as we are already using named export * refactor: refactor test codes to use named export instead of default exports * refactor(TaskDetails): remove unnecessary TaskProgress and TaskDependencies components and directly use underlying components * chore: remove test code of taskdependency and taskprogress as i have already used them in underlying taskdetails component * chore: remove test code of taskdependency and taskprogress as i have already used them in underlying taskdetails component * refactor: refactor code to simplyfy code reading used is else instead of ternary operator * chore: remove extra Taskcontainer wrap that was impacting styling of update progress --------- Co-authored-by: Ashif Khan <54736284+ashifkhn@users.noreply.github.com> Co-authored-by: Amit Prakash <34869115+iamitprakash@users.noreply.github.com>
- Loading branch information