import React, { memo, useState } from "react" import CodeAccordian from "../common/CodeAccordian" interface FileDiff { path: string changeCount: number key: string content: string diffStats?: { added: number; removed: number } diffs?: Array<{ content: string startLine?: number }> } interface BatchDiffApprovalProps { files: FileDiff[] ts: number } export const BatchDiffApproval = memo(({ files = [], ts }: BatchDiffApprovalProps) => { const [expandedFiles, setExpandedFiles] = useState>({}) if (!files?.length) { return null } const handleToggleExpand = (filePath: string) => { setExpandedFiles((prev) => ({ ...prev, [filePath]: !prev[filePath], })) } return (
{files.map((file) => { // Use backend-provided unified diff only. Stats also provided by backend. const unified = file.content || "" return (
handleToggleExpand(file.path)} diffStats={file.diffStats ?? undefined} />
) })}
) }) BatchDiffApproval.displayName = "BatchDiffApproval"