import { useState, useEffect, useCallback } from "react"; import type { Project, ProjectWithTasks, Task } from "../lib/types"; import { fetchProjects, fetchProject, createProject, updateProject, updateTask, } from "../lib/api"; // ─── Status/priority helpers ─── const statusColors: Record = { active: "bg-green-100 text-green-700", queued: "bg-blue-100 text-blue-700", blocked: "bg-red-100 text-red-700", completed: "bg-gray-100 text-gray-500", cancelled: "bg-gray-100 text-gray-400", }; function StatusBadge({ status }: { status: string }) { return ( {status} ); } // ─── Create Project Modal ─── function CreateProjectModal({ onClose, onCreated, }: { onClose: () => void; onCreated: (p: Project) => void; }) { const [name, setName] = useState(""); const [description, setDescription] = useState(""); const [context, setContext] = useState(""); const [repos, setRepos] = useState(""); const [saving, setSaving] = useState(false); const handleSave = async () => { if (!name.trim()) return; setSaving(true); try { const repoList = repos .split("\n") .map((r) => r.trim()) .filter(Boolean); const project = await createProject({ name: name.trim(), description: description.trim() || undefined, context: context.trim() || undefined, repos: repoList.length ? repoList : undefined, }); onCreated(project); } catch (e) { console.error(e); } finally { setSaving(false); } }; return (

New Project

setName(e.target.value)} className="w-full border border-gray-200 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-amber-200" placeholder="e.g. Hammer Dashboard" />