"use client"; import { useState } from "react"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; import { Input } from "@/components/ui/input"; import { Select } from "@/components/ui/select"; import { Textarea } from "@/components/ui/textarea"; import type { FleetAgent, TaskPriority, TaskRecord, TaskStatus } from "@/lib/types"; const COLUMNS: TaskStatus[] = ["Backlog", "Todo", "In Progress", "Review", "Done"]; const PRIORITIES: TaskPriority[] = ["Low", "Medium", "High", "Critical"]; export function TasksClient({ initialTasks, agents, }: { initialTasks: TaskRecord[]; agents: FleetAgent[]; }) { const [tasks, setTasks] = useState(initialTasks); const [formState, setFormState] = useState({ title: "", description: "", assignee: "", priority: "Medium" as TaskPriority, tags: "", }); async function refreshTasks() { const response = await fetch("/api/tasks"); const nextTasks = (await response.json()) as TaskRecord[]; setTasks(nextTasks); } async function createTask(event: React.FormEvent) { event.preventDefault(); await fetch("/api/tasks", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ title: formState.title, description: formState.description, assignee: formState.assignee, priority: formState.priority, tags: formState.tags .split(",") .map((tag) => tag.trim()) .filter(Boolean), }), }); setFormState({ title: "", description: "", assignee: "", priority: "Medium", tags: "", }); await refreshTasks(); } async function moveToDone(taskId: number) { await fetch(`/api/tasks/${taskId}`, { method: "PATCH", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ status: "Done" }), }); await refreshTasks(); } return (
Unified Task Intake Assign work to OpenClaw swarm agents or ZeroClaw host runtimes from a single board.
setFormState((current) => ({ ...current, title: event.target.value }))} /> setFormState((current) => ({ ...current, tags: event.target.value }))} />