From e84ab43b366f797a9ab68b5809e3f4c03b1e078d Mon Sep 17 00:00:00 2001 From: shancds Date: Thu, 3 Jul 2025 14:08:09 +0530 Subject: [PATCH] refactor(enhanced-kanban): clean up TaskCard component structure - Reformatted the TaskCard component for improved readability by adjusting indentation and spacing. - Ensured consistent styling and structure for the drop indicator and task card elements. - Maintained existing functionality while enhancing code clarity and maintainability. --- .../EnhancedKanbanBoardNativeDnD/TaskCard.tsx | 100 +++++++++--------- 1 file changed, 51 insertions(+), 49 deletions(-) diff --git a/worklenz-frontend/src/components/enhanced-kanban/EnhancedKanbanBoardNativeDnD/TaskCard.tsx b/worklenz-frontend/src/components/enhanced-kanban/EnhancedKanbanBoardNativeDnD/TaskCard.tsx index f70761c6..45c47d7d 100644 --- a/worklenz-frontend/src/components/enhanced-kanban/EnhancedKanbanBoardNativeDnD/TaskCard.tsx +++ b/worklenz-frontend/src/components/enhanced-kanban/EnhancedKanbanBoardNativeDnD/TaskCard.tsx @@ -4,59 +4,61 @@ import { RootState } from '@/app/store'; import { IProjectTask } from '@/types/project/projectTasksViewModel.types'; interface TaskCardProps { - task: IProjectTask; - onTaskDragStart: (e: React.DragEvent, taskId: string, groupId: string) => void; - onTaskDragOver: (e: React.DragEvent, groupId: string, taskIdx: number) => void; - onTaskDrop: (e: React.DragEvent, groupId: string, taskIdx: number) => void; - groupId: string; - isDropIndicator: boolean; - idx: number; + task: IProjectTask; + onTaskDragStart: (e: React.DragEvent, taskId: string, groupId: string) => void; + onTaskDragOver: (e: React.DragEvent, groupId: string, taskIdx: number) => void; + onTaskDrop: (e: React.DragEvent, groupId: string, taskIdx: number) => void; + groupId: string; + isDropIndicator: boolean; + idx: number; } -const TaskCard: React.FC = memo(({ - task, - onTaskDragStart, - onTaskDragOver, - onTaskDrop, - groupId, - isDropIndicator, - idx +const TaskCard: React.FC = memo(({ + task, + onTaskDragStart, + onTaskDragOver, + onTaskDrop, + groupId, + isDropIndicator, + idx }) => { - const themeMode = useSelector((state: RootState) => state.themeReducer.mode); - const background = themeMode === 'dark' ? '#23272f' : '#fff'; - const color = themeMode === 'dark' ? '#fff' : '#23272f'; + const themeMode = useSelector((state: RootState) => state.themeReducer.mode); + const background = themeMode === 'dark' ? '#23272f' : '#fff'; + const color = themeMode === 'dark' ? '#fff' : '#23272f'; - return ( - <> - {isDropIndicator && ( -
- )} -
onTaskDragStart(e, task.id!, groupId)} - onDragOver={e => onTaskDragOver(e, groupId, idx)} - onDrop={e => onTaskDrop(e, groupId, idx)} - style={{ background, color }} - > -
-
{task.name}
-
{task.task_key}
-
- {task.assignees?.map(a => a.name).join(', ')} -
-
-
- - ); + return ( + <> + {isDropIndicator && ( +
onTaskDragStart(e, task.id!, groupId)} + onDragOver={e => onTaskDragOver(e, groupId, idx)} + onDrop={e => onTaskDrop(e, groupId, idx)} + /> + )} +
onTaskDragStart(e, task.id!, groupId)} + onDragOver={e => onTaskDragOver(e, groupId, idx)} + onDrop={e => onTaskDrop(e, groupId, idx)} + style={{ background, color }} + > +
+
{task.name}
+
{task.task_key}
+
+ {task.assignees?.map(a => a.name).join(', ')} +
+
+
+ + ); }); TaskCard.displayName = 'TaskCard';