mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-01 23:13:15 +00:00
Clears ~83 pre-existing eslint errors in the UI: auto-fixable rules (array-type, import/order, sort-imports, type-only imports, redundant assertions/conditions) plus manual fixes for unnecessary conditions and banned @ts-nocheck directives. The 8 ported components excluded from tsconfig are now also ignored by eslint so type-aware linting no longer fails to parse them. Co-authored-by: open-swe[bot] <open-swe@users.noreply.github.com>
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { useState } from "react";
|
|
import { ChevronRight } from "lucide-react";
|
|
import type { ReactNode } from "react";
|
|
|
|
import { formatElapsed } from "@/lib/utils";
|
|
|
|
/**
|
|
* Collapses a finished agent turn's working steps (reasoning, tool calls,
|
|
* exploration, edits, …) behind a single "Worked for …" toggle so the
|
|
* transcript shows only the final reply by default.
|
|
*/
|
|
export function WorkSummary({
|
|
durationMs,
|
|
children,
|
|
}: {
|
|
durationMs: number | null;
|
|
children: ReactNode;
|
|
}) {
|
|
const [expanded, setExpanded] = useState(false);
|
|
const label =
|
|
durationMs && durationMs >= 1000 ? `Worked for ${formatElapsed(durationMs)}` : "Worked";
|
|
|
|
return (
|
|
<div className="my-1">
|
|
<button
|
|
type="button"
|
|
onClick={() => setExpanded((value) => !value)}
|
|
className="flex items-center gap-1 text-left transition-opacity hover:opacity-90"
|
|
aria-expanded={expanded}
|
|
>
|
|
<ChevronRight
|
|
className={`h-3 w-3 text-[color:var(--ui-text-dim)] shrink-0 transition-transform ${expanded ? "rotate-90" : ""}`}
|
|
aria-hidden
|
|
/>
|
|
<span className="text-xs text-[color:var(--ui-text-dim)]">{label}</span>
|
|
</button>
|
|
{expanded && (
|
|
<div className="mt-1 ml-1 space-y-2 border-l-2 border-[var(--ui-border)] pl-3">
|
|
{children}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|