"use client"; import { CheckCircle, Play, Pause, AlertTriangle, User, Clock, } from "lucide-react"; import { getAgentDisplayName } from "@/lib/agent-utils"; import { HelpTip } from "@/components/ui/help-tip"; export interface Activity { id: string; agent_id: string; action: string; task_id?: string; task_title?: string; timestamp: string; } interface ActivityItemProps { activity: Activity; } const actionIcons: Record = { completed: , started: , paused: , blocked: , claimed: , passed_qa: , failed_qa: , }; const actionLabels: Record = { completed: "completed", started: "started", paused: "paused", blocked: "blocked on", claimed: "claimed", passed_qa: "passed QA on", failed_qa: "failed QA on", }; function formatTime(timestamp: string): string { const date = new Date(timestamp); const now = new Date(); const diffMs = now.getTime() - date.getTime(); const diffMins = Math.floor(diffMs / (1000 * 60)); if (diffMins < 1) return "just now"; if (diffMins < 60) return `${diffMins}m ago`; const diffHours = Math.floor(diffMins / 60); if (diffHours < 24) return `${diffHours}h ago`; return date.toLocaleDateString("en-US", { month: "short", day: "numeric" }); } export function ActivityItem({ activity }: ActivityItemProps) { const action = activity.action || "unknown"; const icon = actionIcons[action] || ; const label = actionLabels[action] || action; return (
{icon}

{getAgentDisplayName(activity.agent_id)} {" "} {label} {activity.task_title && ( <> {" "} {activity.task_title} )}

{activity.timestamp ? formatTime(activity.timestamp) : "N/A"}
); }