File size: 1,223 Bytes
50fe3c9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | import { cn } from "@/lib/utils";
import type { AiDiffTab, Tab } from "@/modules/tabs";
import { AiDiffPane } from "./AiDiffPane";
type Props = {
tabs: Tab[];
activeId: number;
onAccept: (approvalId: string) => void;
onReject: (approvalId: string) => void;
};
export function AiDiffStack({ tabs, activeId, onAccept, onReject }: Props) {
const diffs = tabs.filter((t): t is AiDiffTab => t.kind === "ai-diff");
if (diffs.length === 0) return null;
return (
<div className="relative h-full w-full">
{diffs.map((t) => {
const visible = t.id === activeId;
return (
<div
key={t.id}
className={cn(
"absolute inset-0",
!visible && "invisible pointer-events-none",
)}
aria-hidden={!visible}
>
<AiDiffPane
path={t.path}
originalContent={t.originalContent}
proposedContent={t.proposedContent}
status={t.status}
isNewFile={t.isNewFile}
onAccept={() => onAccept(t.approvalId)}
onReject={() => onReject(t.approvalId)}
/>
</div>
);
})}
</div>
);
}
|