r/reactjs • • 17d ago

Show /r/reactjs Made a textarea you can scrub back in time, deleted words come back in colour

https://detentui.com/

So undo always bugged me, it's all or nothing. I wanted to just drag back through a note and watch it unwrite itself, and actually see the stuff I deleted on the way.

Demo (drag the pill under the text): Rewind

Took me way longer than I thought lol.

The main thing is it doesn't save snapshots. Every character sits on a kind of tape with when it was typed and when it got deleted, so when you scrub to some point it just checks which characters were alive at that moment. Stays fast even if you've been typing for ages.

The deleted ones show up in a different colour right where they were. First version brought them back letter by letter and it looked really bad, so now letters that died together come back together as one word.

The faded old text is a small WebGL shader that breaks it into dots, plain opacity looked too flat. It also respects reduced motion.

Code (MIT): Code

If you're on shadcn it's `npx shadcn add https://detentui.com/r/rewind`

Would love to know what feels off, still tweaking it.

4 Upvotes

2 comments sorted by

3

u/Honey-Entire 17d ago

AI-generated commercial activity. Pretty ballsy OP. But since you asked, the UX is atrocious and gimmicky at best. The WebGL shader is more distracting than anything and it makes the experience feel rough and unpolished. I'm not even going to comment on the source code for Rewind because I'm 99% sure this is just ragebait. I've never seen so many bad technical decisions in a single component...

1

u/musHeaer 16d ago

the whole character tape thing sounds like a memory nightmare waiting to happen on longer texts too.