import type { CaseSummary } from "@/api/cases"; import { AgentIdentity } from "@/components/AgentIdentity"; import { EntityRow } from "@/components/EntityRow"; import { useCaseHref } from "@/lib/router"; import { CaseStatus } from "./CaseStatus"; import { DEFAULT_CASE_COLUMNS, type CaseColumn } from "@/lib/case-list-view"; import { formatDateTime, relativeTime } from "@/lib/utils"; export function CaseListRow({ caseData, projectName, search = "", columns = DEFAULT_CASE_COLUMNS, }: { caseData: CaseSummary; projectName?: string; search?: string; columns?: readonly CaseColumn[]; }) { const caseHref = useCaseHref(); const task = caseData.workIssue; const show = new Set(columns); const showWork = show.has("phase") || show.has("assignee"); const assignee = task?.assigneeAgentId ? { id: task.assigneeAgentId, name: task.assigneeAgentName ?? "Agent" } : null; const work = task ? <> {show.has("phase") && caseData.phase ? {caseData.phase} : null} {show.has("assignee") && (assignee ? : Unassigned)} : {caseData.workIssueId ? "Task unavailable" : "No task linked"}; const subtitle = [show.has("identifier") ? caseData.identifier : null, show.has("type") ? caseData.caseType : null, show.has("project") ? projectName : null].filter(Boolean); return ( {index > 0 ? " ยท " : ""}{part}) : undefined} className="px-3 py-3" trailing={showWork || show.has("status") || show.has("updated") ? <> {showWork &&
{work}
} {show.has("status") &&
} {show.has("updated") && } : undefined} secondaryRow={showWork ?
{work}
: undefined} secondaryRowClassName="pl-0 lg:hidden" /> ); }