diff --git a/src/components/KanbanBoard.tsx b/src/components/KanbanBoard.tsx index 2e2b2c0..eeee363 100644 --- a/src/components/KanbanBoard.tsx +++ b/src/components/KanbanBoard.tsx @@ -449,6 +449,8 @@ const [rightWidth, setRightWidth] = useState(402); const [editingWipValue, setEditingWipValue] = useState(''); const [errorMessage, setErrorMessage] = useState(null); const [workingByTask, setWorkingByTask] = useState>({}); + const [askingNaviByTask, setAskingNaviByTask] = useState>({}); + const [sentToNaviByTask, setSentToNaviByTask] = useState>({}); const [doneConfirm, setDoneConfirm] = useState<{ taskId: number; fromStatus: string; incomplete: number } | null>(null); const [prdEditor, setPrdEditor] = useState<{ taskId: number; title: string; content: string; version: number } | null>(null); @@ -720,6 +722,34 @@ const [rightWidth, setRightWidth] = useState(402); if (next !== null && !historyByTask[taskId]) await loadHistory(taskId); }; + const askNavi = async (task: Task, e: React.MouseEvent) => { + e.stopPropagation(); + setAskingNaviByTask((prev) => ({ ...prev, [task.id]: true })); + setErrorMessage(null); + try { + const message = `Work on task: ${task.title} (ID: ${task.id})\n\nDescription: ${task.description || 'No description provided'}\n\nStatus: ${task.status}`; + const response = await fetch('/api/openclaw/chat/send', { + method: 'POST', + headers: { 'content-type': 'application/json' }, + body: JSON.stringify({ message }), + }); + if (!response.ok) throw new Error('Failed to send to Navi'); + setSentToNaviByTask((prev) => ({ ...prev, [task.id]: true })); + setTimeout(() => { + setSentToNaviByTask((prev) => { + if (!prev[task.id]) return prev; + const next = { ...prev }; + delete next[task.id]; + return next; + }); + }, 2000); + } catch (error) { + setErrorMessage(error instanceof Error ? error.message : 'Failed to send to Navi'); + } finally { + setAskingNaviByTask((prev) => ({ ...prev, [task.id]: false })); + } + }; + const confirmDoneMove = async (markDone: boolean) => { if (!doneConfirm) return; const { taskId, fromStatus } = doneConfirm; @@ -895,6 +925,22 @@ const [rightWidth, setRightWidth] = useState(402); {task.prdPath && ( )} + {task.status !== 'done' && ( + <> + + {sentToNaviByTask[task.id] && Sent to Navi} + + )} {task.prdVersion > 0 && (