guardian / typerighter

Even if you’re the right typer, couldn’t hurt to use Typerighter!
Apache License 2.0
276 stars 12 forks source link

Discard rule changes modal #411

Closed samanthagottlieb closed 1 year ago

samanthagottlieb commented 1 year ago

What does this change?

This adds a Revert modal that allows the user to review their unpublished changes before discarding them.

Previously, when a live rule has unpublished changes, a Discard unpublished changes button would appear in the 'Rule Status' bar - button added here. Clicking this would immediately revert the draft rule to its previous state, before the changes were made. However, the user might not be sure which unpublished changes they are discarding. The Revert modal will show a before and after diff to the user on clicking the Discard unpublished changes button, allowing them to review before confirming discard.

How to test

To test this as a user:

This can also be tested by running the client app tests with npm run test.

Images

Before

After

samanthagottlieb commented 1 year ago

Tested locally, works great. Feels really good to see what's going to happen.

One general non-blocking comment – I was a bit confused to see that the left hand side column represented what would happen if I clicked revert, and the right hand side was what currently existed. It's the other way around in the 'publish' modal, I suspect b/c for left to right readers we associated time moving from left to right (left: what currently is, right: what will happen.)

Might be overthinking it, wonder if lhs as 'before revert' and rhs as 'after revert' would be clearer ↔️ 🤔

Yes I had wondered the same, and was on the fence about which way round was better. But that's a good point about moving from left to right - I've changed them around and made the modal text a bit more descriptive about what's going on.

It now looks like this (have also added more changes compared to the screenshot in original PR description): Screenshot 2023-08-22 at 14 59 26