Skip to content

Commit

Permalink
Add Confirmation Modal for Deletion Action and Map All Action Bar Ent…
Browse files Browse the repository at this point in the history
…ries (#6357)

This pull request addresses an issue where the delete button, placed
closely to the export button, could lead to accidental deletions without
confirmation. The problem was that the confirmation modal for the delete
action, being the second action, was not displayed. The code was updated
to map all action bar entries and display their respective confirmation
modals correctly.

### Changes Made:
- Updated the rendering of action bar entries to ensure all confirmation
modals are shown.
Changed from displaying only the first action bar entry's confirmation
modal to mapping through all entries and displaying each modal if it
exists.
- Removed the delete from the onClick because it is present in the
onConfirmClick.
  • Loading branch information
falko100 authored Jul 22, 2024
1 parent 14fcd5f commit f24536c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ export const useRecordActionBar = ({
accent: 'danger',
onClick: () => {
setIsDeleteRecordsModalOpen(true);
handleDeleteClick();
},
ConfirmationModal: (
<ConfirmationModal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ const SharedNavigationModal = ({
}: SharedNavigationModalProps) => {
return (
<div data-select-disable className={customClassName}>
{actionBarEntries[0]?.ConfirmationModal ?? null}
{actionBarEntries.map((actionBarEntry, index) =>
actionBarEntry.ConfirmationModal ? (
<div key={index}>{actionBarEntry.ConfirmationModal}</div>
) : null,
)}
</div>
);
};
Expand Down

0 comments on commit f24536c

Please sign in to comment.