Show loading icon on buttons during edit project API requests #4693
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This adds the loading indicators and disabled button look to the action buttons on the "Edit Project" page. Access this page by navigating from
Manage > Select a project > Edit Project > Actions
Resolves #4462
Implementation Details
I closely referred to the code written in the PR here which was very helpful as advised by @willemarcel, and used the
useAsync
hook to initiate the API calls. Once this was done for 1 button, the others were straightforward to implement.I also did a minor renaming of some local functions within the Modal components so that the naming follows those
useAsync
functions inactionSidebars.js
.Type of change
How Has This Been Tested?
Get access to edit projects in the staging environment from a member of the HOTOSM team
Run
yarn start
in the./frontend
folderValidate that all button interactions are expected:
Run
yarn test
in the./frontend
folder. There were no unit tests for this file, so I tested each button individually instead after implementation.Here is a reference screenshot of one of the new enhanced buttons: