Suggested Edit Diff

A word-level inline diff of an AI rewrite, with accept and reject the same size on the same row.

The report was written by the team and it shows that revenue went up a lotrose 24% last year.

1 suggestion · 3 deletions, 1 insertion

Build an inline diff for an AI-suggested edit. Structure: a text block rendered from an array of parts (each marked same / deleted / inserted), an Accept and a Keep-mine button, and a summary line. Diff at WORD level, not paragraph level. Replacing the whole block hides which three words actually changed, and that is the only thing the reviewer needs to decide about. Deletions KEEP THEIR WORDS: struck through, tinted red, still in the sentence. A model that shows only its result is asking the user to proofread it from memory. Insertions are tinted green. Both answers are the SAME SIZE on the SAME ROW. A suggestion with only an Accept button is not a suggestion. Label the second one "Keep mine" rather than "Reject" - it names what the user ends up with instead of what they are doing to the model, and it makes declining the neutral act it should be. Resolution is a LAYOUT animation: give each part a `layout` prop, and on accept drop the deleted parts so the sentence closes up (spring, stiffness ~420, damping ~34). The reader should watch the text become what it will be, rather than being replaced by it. Rejecting drops the insertions the same way. State the counts before the decision - "1 suggestion, 2 deletions, 1 insertion" - so the size of the change is known without counting highlights. DERIVE those numbers by filtering the parts array; do not type them into the string. A count written by hand sits right next to the thing it describes and goes stale the first time anyone edits the sample text, which is the single easiest defect to ship in a component like this. Pluralise from the same numbers. Offer an undo after either choice. Accessibility: the summary line is aria-live="polite". Under prefers-reduced-motion, switch states without the layout animation. Colors as tokens: paper card, semantic red for deletions, semantic green for insertions and the accepted border. Build the component, not this demo of it. - Ambient motion that IS the component may loop: a drifting background, a marquee, a spinner while something is genuinely loading. - Do not add any timer, interval, loop or script that performs a person's action by itself. No auto-hover, no auto-click, no cycling through states, no pretend submitting, no replaying the interaction on a schedule. - Every state that answers a person waits for a real event from that person. - Placeholder copy and sample content are welcome. Simulated behaviour is not.

Rate it
0
0

We'd like to measure how the site gets used, with Google Analytics. It sets cookies. Everything the site needs to work runs either way. How we handle data