ushahidi / platform-client-mzima

Other
14 stars 99 forks source link

[USH-1609] Add a notification that unsaved changes to a survey will be lost #1456

Closed MMwandigha closed 1 week ago

MMwandigha commented 2 weeks ago

Adding confirmation modal for unsaved survey changes

Below are some of the changes that I have made;

How to test;

  1. Open Settings>Surveys>Add Survey and fill in the forms. Try to hit the cancel button and confirm if the popup appears and behaves accordingly.
  2. Similarly, select any survey, change any form values/fields, hit the cancel button and confirm if the popup appears and behaves accordingly.
linear[bot] commented 2 weeks ago

USH-1609 Add a notification that unsaved changes to a survey will be lost

MMwandigha commented 1 week ago

Works fine! But the discard-button isn't red as we discussed yesterday, wasn't it possible? Screenshot 2024-11-14 at 17 43 32

@Angamanga I noticed that the cancel button has the mat-dialog-close="false" setting, which means that it doesnt have to be defined explicitly in every modal/notification, therefore this cancel button appears in every modal by default. So I decided to utilize it instead.

I can set a condition to display the 'red' color if the button is destructive as shown in the latest commit, let me hear what you think

image image