/** * DiffPreviewPanel * * Shows file edit proposals as side-by-side text diffs. * Each edit has Accept/Reject buttons. */ import React from 'react'; import { FaCheck, FaTimes } from 'react-icons/fa'; import styles from './CodeEditor.module.css'; export interface FileEditProposal { id: string; fileId: string; fileName: string; oldContent: string | null; newContent: string; status: 'pending' | 'accepted' | 'rejected'; } interface DiffPreviewPanelProps { edits: FileEditProposal[]; onAccept: (editId: string) => void; onReject: (editId: string) => void; } export const DiffPreviewPanel: React.FC = ({ edits, onAccept, onReject }) => { const pendingEdits = edits.filter(e => e.status === 'pending'); const resolvedEdits = edits.filter(e => e.status !== 'pending'); return (

Changes ({pendingEdits.length} pending)

{edits.length === 0 ? (
No changes proposed yet
) : ( <> {pendingEdits.map((edit) => ( ))} {resolvedEdits.map((edit) => ( ))} )}
); }; const DiffCard: React.FC<{ edit: FileEditProposal; onAccept: (id: string) => void; onReject: (id: string) => void; }> = ({ edit, onAccept, onReject }) => { const isPending = edit.status === 'pending'; return (
{edit.fileName} {edit.status}
{edit.oldContent && (
Old
{edit.oldContent}
)}
New
{edit.newContent}
{isPending && (
)}
); };