mirror of
https://github.com/block/buzz.git
synced 2026-12-01 05:32:24 +00:00
Signed-off-by: Taylor Ho <taylorkmho@gmail.com> Co-authored-by: npub1223z34hd7vtwc6qj4s7flsxkj644nlre2nthu7lrrmkumhu3xddsrx9r6w <52a228d6edf316ec6812ac3c9fc0d696ab59fc7954d77e7be31eedcddf91335b@sprout-oss.stage.blox.sqprod.co>
30 lines
694 B
TypeScript
30 lines
694 B
TypeScript
import type {
|
|
FileEditDiff,
|
|
FileEditDiffLine,
|
|
} from "./agentSessionFileEditDiff";
|
|
import { FileContentBlock, type FileContentLine } from "./FileContentBlock";
|
|
|
|
export function hasFileEditLineDiff(diff: FileEditDiff) {
|
|
return diff.lines.some(
|
|
(line) => line.kind === "add" || line.kind === "remove",
|
|
);
|
|
}
|
|
|
|
export function FileEditDiffBlock({ diff }: { diff: FileEditDiff }) {
|
|
return (
|
|
<FileContentBlock
|
|
lines={diff.lines
|
|
.filter((line) => line.kind !== "meta")
|
|
.map(toFileContentLine)}
|
|
path={diff.path}
|
|
/>
|
|
);
|
|
}
|
|
|
|
function toFileContentLine(line: FileEditDiffLine): FileContentLine {
|
|
return {
|
|
kind: line.kind,
|
|
text: line.text,
|
|
};
|
|
}
|