"use client"; import { useTranslation } from "react-i18next"; import type { WorkflowStepProgress, WorkflowStepProgressStatus, } from "@/hooks/domains/kanban/use-workflow-step-progress"; const EMPTY_AGENT_LABELS_BY_PROFILE_ID: Readonly> = {}; export function StepProgressDetails({ progress, agentProfileId, agentLabelsByProfileId = EMPTY_AGENT_LABELS_BY_PROFILE_ID, testId, }: { progress: WorkflowStepProgress; agentProfileId?: string; agentLabelsByProfileId?: Readonly>; testId?: string; }) { const { t } = useTranslation(); if (progress.status === "idle") return null; const agentLabel = progress.agentLabel ?? (agentProfileId ? agentLabelsByProfileId[agentProfileId] : undefined); return (
{t(workflowStepProgressTranslationKey(progress.status))} {agentLabel && {agentLabel}}
); } export function workflowStepProgressTranslationKey(status: WorkflowStepProgressStatus) { switch (status) { case "moving": return "task:workflowStepProgressMoving"; case "preparing": return "task:workflowStepProgressPreparing"; case "starting": return "task:workflowStepProgressStarting"; case "cancelling": return "task:workflowStepProgressCancelling"; case "running": return "task:workflowStepProgressRunning"; case "waiting": return "task:workflowStepProgressWaiting"; case "idle_agent": return "task:workflowStepProgressIdle"; case "not_started": return "task:workflowStepProgressNotStarted"; case "completed": return "task:workflowStepProgressCompleted"; case "failed": return "task:workflowStepProgressFailed"; case "cancelled": return "task:workflowStepProgressCancelled"; case "idle": return "task:workflowStepProgressNotStarted"; } }