"use client"; import { useState } from "react"; import { useTasks } from "@blackroad/sdk"; interface Task { id: string; title: string; description: string; status: "available" | "claimed" | "completed" | "failed"; priority: "low" | "medium" | "high" | "critical"; agent?: string; posted_at: string; completed_at?: string; } const PRIORITY_COLOR: Record = { critical: "bg-red-900 text-red-300", high: "bg-orange-900 text-orange-300", medium: "bg-yellow-900 text-yellow-300", low: "bg-zinc-800 text-zinc-400", }; const COLUMNS: Array<{ key: Task["status"]; label: string; color: string }> = [ { key: "available", label: "Available", color: "border-blue-700" }, { key: "claimed", label: "In Progress", color: "border-yellow-600" }, { key: "completed", label: "Completed", color: "border-green-700" }, ]; export default function TasksPage() { const { tasks, loading, error, post, claim, complete } = useTasks(); const [showNew, setShowNew] = useState(false); const [form, setForm] = useState({ title: "", description: "", priority: "medium" }); const handlePost = async (e: React.FormEvent) => { e.preventDefault(); await post(form.title, form.description, form.priority as Task["priority"]); setForm({ title: "", description: "", priority: "medium" }); setShowNew(false); }; const byStatus = (status: Task["status"]) => tasks.filter((t: Task) => t.status === status); return (

Task Marketplace

{tasks.length} total tasks across all agents

{showNew && (

Post New Task

setForm({ ...form, title: e.target.value })} placeholder="Task title" required className="w-full bg-zinc-800 border border-zinc-700 rounded-lg px-3 py-2 text-sm text-white" />