import { useState } from "react"; import type { GitChangeStatus } from "#/api/open-hands.types"; import { FileDiffViewer } from "./file-diff-viewer"; export interface DiffChangeListItem { path: string; status: GitChangeStatus; } export interface DiffChangeListProps { changes: DiffChangeListItem[]; /** * When set, each row shows that commit's version of the file instead of * the working-tree diff. */ commit?: string; } /** * Single-open accordion of file diffs. Expanding one path collapses the * previously open one (same behavior as the Commits list). */ export function DiffChangeList({ changes, commit }: DiffChangeListProps) { const [expandedPath, setExpandedPath] = useState(null); return (
{changes.map((change) => ( setExpandedPath((prev) => prev === change.path ? null : change.path, ) } /> ))}
); }