import React from 'react'; import { Edit3, X, Check } from 'lucide-react'; function DiffRow({ label, original, modified }) { const changed = JSON.stringify(original) !== JSON.stringify(modified); return (
{label}
Before
            {original == null ? '(none)' : (typeof original === 'object' ? JSON.stringify(original, null, 2) : String(original))}
          
After
            {modified == null ? '(none)' : (typeof modified === 'object' ? JSON.stringify(modified, null, 2) : String(modified))}
          
); } export default function ModifyDiffModal({ original, changes, onConfirm, onCancel }) { const modified = { ...original, body: changes.body !== undefined ? { ...(original.body || {}), ...changes.body } : original.body, query_params: changes.query_params !== undefined ? { ...(original.query_params || {}), ...changes.query_params } : original.query_params, headers: changes.headers !== undefined ? { ...(original.headers || {}), ...changes.headers } : original.headers, path_params: changes.path_params !== undefined ? { ...(original.path_params || {}), ...changes.path_params } : original.path_params, ...Object.fromEntries(Object.entries(changes).filter(([k]) => !['body', 'query_params', 'headers', 'path_params'].includes(k))), }; return (
Review AI Modifications Step {original.step}: {original.endpoint}

The AI proposed the following changes. Review the diff below before executing.

{['body', 'query_params', 'headers', 'path_params'].map(key => (changes[key] !== undefined || original[key]) ? ( ) : null )} {Object.entries(changes) .filter(([k]) => !['body', 'query_params', 'headers', 'path_params'].includes(k)) .map(([k, v]) => ( ))}
); }