import { CheckCircle } from "@phosphor-icons/react"; import type { AgentRecord, GoalRecord, ProjectRecord, WorkspaceRecord } from "@shared/types"; import { EmptyState, ListFrame, ListRow, StatusPill } from "../ui"; import { useT } from "../../i18n"; export function ProjectList({ projects, goals, agents, workspaces, selectedProjectId, onSelect, }: { projects: ProjectRecord[]; goals: GoalRecord[]; agents: AgentRecord[]; workspaces: WorkspaceRecord[]; selectedProjectId: string | null; onSelect: (projectId: string) => void; }) { const t = useT(); if (projects.length === 0) { return ; } return ( {projects.map((project) => { const isSelected = project.id === selectedProjectId; const wsCount = workspaces.filter((w) => w.projectId === project.id).length; return ( onSelect(project.id)} className={`cursor-pointer transition-colors duration-100 ${isSelected ? "bg-[color:var(--accent-soft)]" : "hover:bg-[color:var(--panel-soft)]"}`} >
{isSelected && ( )}
{project.name}
{project.description}
Goal: {goals.find((g) => g.id === project.goalId)?.title ?? "None"} Lead: {agents.find((a) => a.id === project.leadAgentId)?.name ?? "Unassigned"} {project.targetDate && Target: {project.targetDate}} {wsCount > 0 && ( {wsCount} workspace{wsCount !== 1 ? "s" : ""} )}
); })}
); }