feat: enhance Kanban components with swimlane context support

- Added `context` prop to `PrioritySwimlanesBoard`, `SwimlanesBoard`, and `DroppableColumn` to provide swimlane context for task creation.
- Updated `QuickAddTask` to pre-fill form data based on the swimlane context, improving user experience during task addition.
- Enhanced task handling in `SwimlanesBoard` to include context for tags, ensuring better organization and task management.
This commit is contained in:
Julien Froidefond
2025-09-15 11:53:47 +02:00
parent 07cd3bde3b
commit c627d1abd3
4 changed files with 58 additions and 22 deletions

View File

@@ -35,7 +35,8 @@ function DroppableColumn({
compactView,
onCreateTask,
showQuickAdd,
onToggleQuickAdd
onToggleQuickAdd,
swimlaneContext
}: {
status: TaskStatus;
tasks: Task[];
@@ -46,6 +47,10 @@ function DroppableColumn({
onCreateTask?: (data: CreateTaskData) => Promise<void>;
showQuickAdd?: boolean;
onToggleQuickAdd?: () => void;
swimlaneContext?: {
type: 'tag' | 'priority';
value: string;
};
}) {
const { setNodeRef } = useDroppable({
id: status,
@@ -76,6 +81,7 @@ function DroppableColumn({
status={status}
onSubmit={onCreateTask}
onCancel={onToggleQuickAdd || (() => {})}
swimlaneContext={swimlaneContext}
/>
) : (
<button
@@ -101,6 +107,10 @@ export interface SwimlaneData {
icon?: string;
color?: string;
tasks: Task[];
context?: {
type: 'tag' | 'priority';
value: string;
};
}
interface SwimlanesBaseProps {
@@ -293,6 +303,9 @@ export function SwimlanesBase({
const columnId = `${swimlane.key}-${status}`;
// Utiliser le contexte défini dans la swimlane
const swimlaneContext = swimlane.context;
return (
<DroppableColumn
key={columnId}
@@ -305,6 +318,7 @@ export function SwimlanesBase({
onCreateTask={onCreateTask ? (data) => handleQuickAdd(data, columnId) : undefined}
showQuickAdd={showQuickAdd[columnId] || false}
onToggleQuickAdd={() => toggleQuickAdd(columnId)}
swimlaneContext={swimlaneContext}
/>
);
})}