From f24536c1159a44852a9b0ff4dc37125d8dbf89e6 Mon Sep 17 00:00:00 2001 From: falko100 Date: Mon, 22 Jul 2024 14:22:10 +0200 Subject: [PATCH] Add Confirmation Modal for Deletion Action and Map All Action Bar Entries (#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. --- .../record-action-bar/hooks/useRecordActionBar.tsx | 1 - .../ui/navigation/shared/components/NavigationModal.tsx | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/twenty-front/src/modules/object-record/record-action-bar/hooks/useRecordActionBar.tsx b/packages/twenty-front/src/modules/object-record/record-action-bar/hooks/useRecordActionBar.tsx index 490467dae757..9765a085f5af 100644 --- a/packages/twenty-front/src/modules/object-record/record-action-bar/hooks/useRecordActionBar.tsx +++ b/packages/twenty-front/src/modules/object-record/record-action-bar/hooks/useRecordActionBar.tsx @@ -136,7 +136,6 @@ export const useRecordActionBar = ({ accent: 'danger', onClick: () => { setIsDeleteRecordsModalOpen(true); - handleDeleteClick(); }, ConfirmationModal: ( { return (
- {actionBarEntries[0]?.ConfirmationModal ?? null} + {actionBarEntries.map((actionBarEntry, index) => + actionBarEntry.ConfirmationModal ? ( +
{actionBarEntry.ConfirmationModal}
+ ) : null, + )}
); };