import { Target } from "../ui/icons"; import type { CompanyMetrics, SectionId } from "@shared/types"; import { formatDuration, formatMoney, getAgentInitials } from "../../lib/formatters"; import { useT } from "../../i18n"; import { CompactMetric, RunProgressBar } from "./inbox-helpers"; import { Card, Eyebrow } from "../ui"; interface PerformanceProps { metrics: CompanyMetrics | null; onNavigate: (section: SectionId, entityId?: string) => void; } export function PerformanceView({ metrics, onNavigate }: PerformanceProps) { const t = useT(); if (!metrics) { return (
{t("perf.noMetrics")}
{t("perf.noMetricsDesc")}
); } return (
= 80 ? "success" : metrics.overallSuccessRate >= 50 ? "warn" : "danger"} />
{t("perf.runActivity30d")}
{t("perf.runsSucceeded").replace("{n}", String(metrics.successfulRuns))} {t("perf.runsFailed").replace("{n}", String(metrics.failedRuns))}
{t("perf.agentPerformance")}
{metrics.agentMetrics .sort((a, b) => b.tasksCompleted - a.tasksCompleted) .map((am) => ( onNavigate("agents", am.agentId)} > ))}
{t("perf.agent")} {t("perf.tasksDoneCol")} {t("perf.successPct")} {t("perf.runsCol")} {t("perf.avgDuration")} {t("perf.costCol")}
{getAgentInitials(am.agentName)}
{am.agentName}
{am.tasksCompleted} = 80 ? "text-success" : am.successRate >= 50 ? "text-warning" : "text-destructive" }`}> {am.successRate}% {am.runsTotal} {formatDuration(am.avgRunDurationSec)} {formatMoney(am.totalCostUsd)}
); }