Skip to content

Commit c34b94c

Browse files
authored
Merge pull request #269 from shancds/test/row-kanban-board-v1.2.0
Test/row kanban board v1.2.0
2 parents 55a0028 + 8304407 commit c34b94c

File tree

7 files changed

+62
-367
lines changed

7 files changed

+62
-367
lines changed

worklenz-frontend/src/components/enhanced-kanban/EnhancedKanbanBoardNativeDnD/EnhancedKanbanBoardNativeDnD.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { useAuthService } from '@/hooks/useAuth';
1919
import { statusApiService } from '@/api/taskAttributes/status/status.api.service';
2020
import alertService from '@/services/alerts/alertService';
2121
import logger from '@/utils/errorLogger';
22-
import Skeleton from 'antd/es/skeleton/Skeleton';
2322
import { checkTaskDependencyStatus } from '@/utils/check-task-dependency-status';
2423
import { useTaskSocketHandlers } from '@/hooks/useTaskSocketHandlers';
2524

@@ -148,11 +147,11 @@ const EnhancedKanbanBoardNativeDnD: React.FC<{ projectId: string }> = ({ project
148147
const targetGroup = taskGroups.find(g => g.id === targetGroupId);
149148
if (!sourceGroup || !targetGroup) return;
150149

151-
152150
const taskIdx = sourceGroup.tasks.findIndex(t => t.id === draggedTaskId);
153151
if (taskIdx === -1) return;
154152

155153
const movedTask = sourceGroup.tasks[taskIdx];
154+
let didStatusChange = false;
156155
if (groupBy === 'status' && movedTask.id) {
157156
if (sourceGroup.id !== targetGroup.id) {
158157
const canContinue = await checkTaskDependencyStatus(movedTask.id, targetGroupId);
@@ -163,6 +162,7 @@ const EnhancedKanbanBoardNativeDnD: React.FC<{ projectId: string }> = ({ project
163162
);
164163
return;
165164
}
165+
didStatusChange = true;
166166
}
167167
}
168168
let insertIdx = hoveredTaskIdx;
@@ -259,6 +259,18 @@ const EnhancedKanbanBoardNativeDnD: React.FC<{ projectId: string }> = ({ project
259259
team_id: teamId,
260260
});
261261

262+
// Emit progress update if status changed
263+
if (didStatusChange) {
264+
socket.emit(
265+
SocketEvents.TASK_STATUS_CHANGE.toString(),
266+
JSON.stringify({
267+
task_id: movedTask.id,
268+
status_id: targetGroupId,
269+
parent_task: movedTask.parent_task_id || null,
270+
team_id: teamId,
271+
})
272+
);
273+
}
262274
}
263275

264276
setDraggedTaskId(null);

worklenz-frontend/src/components/enhanced-kanban/EnhancedKanbanBoardNativeDnD/TaskCard.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { SocketEvents } from '@/shared/socket-events';
1515
import { getUserSession } from '@/utils/session-helper';
1616
import { themeWiseColor } from '@/utils/themeWiseColor';
1717
import { toggleTaskExpansion, fetchBoardSubTasks } from '@/features/enhanced-kanban/enhanced-kanban.slice';
18+
import TaskProgressCircle from './TaskProgressCircle';
1819

1920
// Simple Portal component
2021
const Portal: React.FC<{ children: React.ReactNode }> = ({ children }) => {
@@ -69,7 +70,6 @@ const TaskCard: React.FC<TaskCardProps> = memo(({
6970
const d = selectedDate || new Date();
7071
return new Date(d.getFullYear(), d.getMonth(), 1);
7172
});
72-
const [showSubtasks, setShowSubtasks] = useState(false);
7373

7474
useEffect(() => {
7575
setSelectedDate(task.end_date ? new Date(task.end_date) : null);
@@ -202,7 +202,11 @@ const TaskCard: React.FC<TaskCardProps> = memo(({
202202

203203
return (
204204
<>
205-
<div className="enhanced-kanban-task-card" style={{ background, color, display: 'block' }} >
205+
<div className="enhanced-kanban-task-card" style={{ background, color, display: 'block', position: 'relative' }} >
206+
{/* Progress circle at top right */}
207+
<div style={{ position: 'absolute', top: 6, right: 6, zIndex: 2 }}>
208+
<TaskProgressCircle task={task} size={20} />
209+
</div>
206210
<div
207211
draggable
208212
onDragStart={e => onTaskDragStart(e, task.id!, groupId)}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { IProjectTask } from "@/types/project/projectTasksViewModel.types";
2+
3+
// Add a simple circular progress component
4+
const TaskProgressCircle: React.FC<{ task: IProjectTask; size?: number }> = ({ task, size = 28 }) => {
5+
const progress = typeof task.complete_ratio === 'number'
6+
? task.complete_ratio
7+
: (typeof task.progress === 'number' ? task.progress : 0);
8+
const strokeWidth = 1.5;
9+
const radius = (size - strokeWidth) / 2;
10+
const circumference = 2 * Math.PI * radius;
11+
const offset = circumference - (progress / 100) * circumference;
12+
return (
13+
<svg width={size} height={size} style={{ display: 'block' }}>
14+
15+
<circle
16+
cx={size / 2}
17+
cy={size / 2}
18+
r={radius}
19+
stroke="#3b82f6"
20+
strokeWidth={strokeWidth}
21+
fill="none"
22+
strokeDasharray={circumference}
23+
strokeDashoffset={offset}
24+
strokeLinecap="round"
25+
style={{ transition: 'stroke-dashoffset 0.3s' }}
26+
/>
27+
{task.complete_ratio && <text
28+
x="50%"
29+
y="50%"
30+
textAnchor="middle"
31+
dominantBaseline="central"
32+
fontSize={size * 0.38}
33+
fill="#3b82f6"
34+
fontWeight="bold"
35+
>
36+
{Math.round(progress)}
37+
</text>}
38+
</svg>
39+
);
40+
};
41+
42+
export default TaskProgressCircle;

worklenz-frontend/src/components/enhanced-kanban/PerformanceMonitor.css

Lines changed: 0 additions & 101 deletions
This file was deleted.

worklenz-frontend/src/components/enhanced-kanban/PerformanceMonitor.tsx

Lines changed: 0 additions & 108 deletions
This file was deleted.

worklenz-frontend/src/components/enhanced-kanban/VirtualizedTaskList.css

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)