import { ArrowSquareOut, ClockCounterClockwise, Robot, } from "@phosphor-icons/react"; import type { BrowserActionRecord } from "@shared/types"; import { timeAgo } from "../../lib/formatters"; import { actionTypeLabels } from "./social-config"; interface ActionHistoryProps { actions: BrowserActionRecord[]; agents: Array<{ id: string; name: string }>; onOpenPath: (path: string) => Promise; onCancelAction: (actionId: string) => Promise; onNavigate: (section: "tasks" | "approvals", entityId: string) => void; } export function ActionHistory({ actions, agents, onOpenPath, onCancelAction, onNavigate }: ActionHistoryProps) { if (actions.length === 0) { return (
No browser actions yet. Agents will create actions when working on social media tasks.
); } return (
{actions.slice(0, 30).map((action) => { const config = actionTypeLabels[action.actionType] ?? actionTypeLabels.custom_script; const Icon = config.icon; const agent = agents.find((a) => a.id === action.agentId); const isSuccess = action.status === "succeeded"; const isFailed = action.status === "failed"; const isRunning = action.status === "running"; return (
{config.label} {agent ? ( {agent.name} ) : null}
{action.resultSummary ? (
{action.resultSummary}
) : null} {action.errorMessage ? (
{action.errorMessage}
) : null}
{action.taskId ? ( ) : null} {action.approvalId ? ( ) : null} {action.screenshotPath ? ( ) : null} {["queued", "running", "approval_required"].includes(action.status) ? ( ) : null}
{timeAgo(action.createdAt)}
{action.status.replace("_", " ")}
); })}
); }