feat: add workflow sorting with drag-and-drop reordering (#520)

This commit is contained in:
Carlos Florêncio
2026-04-01 23:58:43 +01:00
committed by GitHub
parent beb42acc29
commit 1c6506911e
29 changed files with 749 additions and 109 deletions
@@ -1,6 +1,6 @@
"use client";
import { memo } from "react";
import { memo, useCallback, useState } from "react";
import Link from "next/link";
import type { AgentProfileOption } from "@/lib/state/slices";
import type { WorkflowSnapshotData } from "@/lib/state/slices/kanban/types";
@@ -237,13 +237,24 @@ export const WorkflowSection = memo(function WorkflowSection({
effectiveWorkflowId,
onWorkflowChange,
}: WorkflowSectionProps) {
const [lastUsedWorkflowId, setLastUsedWorkflowId] = useState<string | null>(null);
const handleWorkflowChange = useCallback(
(workflowId: string) => {
setLastUsedWorkflowId(workflowId);
onWorkflowChange(workflowId);
},
[onWorkflowChange],
);
if (!isCreateMode || workflows.length <= 1 || isTaskStarted) return null;
return (
<WorkflowSelectorRow
workflows={workflows}
snapshots={snapshots}
selectedWorkflowId={effectiveWorkflowId ?? null}
onWorkflowChange={onWorkflowChange}
onWorkflowChange={handleWorkflowChange}
lastUsedWorkflowId={lastUsedWorkflowId}
/>
);
});