From 27ce296b54e9893c147f819a5ac8b01984014ce8 Mon Sep 17 00:00:00 2001 From: Prakhar Porwal <49529937+prakharporwal@users.noreply.github.com> Date: Fri, 12 Nov 2021 03:33:28 +0530 Subject: [PATCH] [GH-1655] Card Delete : added Confirmation Dialog (#1684) * Made confirmationDialogBox from existing dialog component * Used ConfirmationDialogBox to raise warning before deletion of card property * fixes as ci checks did not pass * fixes to pass ci tests * Flash Message now visible (changed its z-index) * Confirmation Dialog shows the property name. * fixes for eslint test failure * fixes for eslint test fail * fixes for eslint test failure * fix for eslint test failure * fixed a wrong subtext string * fixed eslint issues in scss * i18n en.json for localisation updated * `en.json;`-wrong file generated by `npm run i18n-extract ` command removed * On Property Type or Name Change raises warning * On Property Type or Name Change raises Confirmation dialog Confirmation dialog box generalized for use * The affected num of cards calculation added. * If prop value not filled change after confirmation * fixes after ci eslint failure * fixes after ci eslint failure * In cardDetailProperty test considered dialog box confirmation * Added test for confirmationDialogBox * npm run fix and fixed test failure * snapshot files updated : `npm run updatesnapshot` * ran i18n-extract script * Added memo to Confirm dialog component * reverted the addition of React.memo() as the feature breaks * added confirmation for card delete * default export of Confirmation Dialog Component * improved cardDialog test considering dialog box opening * Added memo and useCallback for cnfrm dialog component * eslint formating * eslint formatting * added confirm dialog for kanban and dialog card . * updated snapshot . cardDetailProperty test failing * updated snapshot * Merge branch 'prop-update-warning-1140' into card-delete-warning-1655 * eslint formatting * Merge branch 'prop-update-warning-1140' into card-delete-warning-1655 * removed unwanted comments * imported library for failing test * Updating card modal scss * Addressed @sbishel comments * fixed duplicate width in css * updated comment in kanbanCard * fixed failing snapshot test * updated kanbanCard unit test * npm run fix * removed useState hook for confirmDialogProps * removed useState hook from cardDialog and kanbanCard for confirmDialogProps. * npm run fix * removed duplicate declaration Co-authored-by: Prakhar <> Co-authored-by: prakharporwal Co-authored-by: Scott Bishel Co-authored-by: Asaad Mahmood --- webapp/i18n/en.json | 10 +- .../__snapshots__/cardDialog.test.tsx.snap | 409 ++++++++++++++++++ .../confirmationDialogBox.test.tsx.snap | 137 ++++++ .../components/calculations/calculations.ts | 1 + .../cardDetailProperties.test.tsx.snap | 248 +++++++++++ .../cardDetail/cardDetailProperties.test.tsx | 179 +++++--- .../cardDetail/cardDetailProperties.tsx | 117 +++-- webapp/src/components/cardDialog.test.tsx | 50 +++ webapp/src/components/cardDialog.tsx | 65 ++- .../src/components/confirmationDialogBox.scss | 34 +- .../components/confirmationDialogBox.test.tsx | 93 ++++ .../src/components/confirmationDialogBox.tsx | 49 ++- .../src/components/kanban/kanbanCard.test.tsx | 13 +- webapp/src/components/kanban/kanbanCard.tsx | 97 +++-- webapp/src/widgets/buttons/button.scss | 3 +- 15 files changed, 1338 insertions(+), 167 deletions(-) create mode 100644 webapp/src/components/__snapshots__/confirmationDialogBox.test.tsx.snap create mode 100644 webapp/src/components/confirmationDialogBox.test.tsx diff --git a/webapp/i18n/en.json b/webapp/i18n/en.json index 8411b0e69..72a82c3ae 100644 --- a/webapp/i18n/en.json +++ b/webapp/i18n/en.json @@ -51,9 +51,16 @@ "CardDetail.addCardText": "add card text", "CardDetail.moveContent": "move card content", "CardDetail.new-comment-placeholder": "Add a comment...", - "CardDetailProperty.confirm-delete": "Confirm Delete Property", + "CardDetailProperty.confirm-delete-heading": "Confirm Delete Property", "CardDetailProperty.confirm-delete-subtext": "Are you sure you want to delete the property \"{propertyName}\"? Deleting it will delete the property from all cards in this board.", + "CardDetailProperty.confirm-property-name-change-subtext": "Are you sure you want to change property \"{propertyName}\" {customText}? This will affect value(s) across {numOfCards} card(s) in this board, and can result in data loss.", + "CardDetailProperty.confirm-property-type-change": "Confirm Property Type Change!", + "CardDetailProperty.delete-action-button": "Delete", + "CardDetailProperty.property-change-action-button": "Change Property", + "CardDetailProperty.property-changed": "Changed property successfully!", "CardDetailProperty.property-deleted": "Deleted {propertyName} Successfully!", + "CardDetailProperty.property-name-change-subtext": "type from \"{oldPropType}\" to \"{newPropType}\"", + "CardDetailProperty.property-type-change-subtext": "name to \"{newPropName}\"", "CardDialog.copiedLink": "Copied!", "CardDialog.copyLink": "Copy link", "CardDialog.editing-template": "You're editing a template.", @@ -62,6 +69,7 @@ "Comment.delete": "Delete", "CommentsList.send": "Send", "ConfirmationDialog.cancel-action": "Cancel", + "ConfirmationDialog.confirm-action": "Confirm", "ConfirmationDialog.delete-action": "Delete", "ContentBlock.Delete": "Delete", "ContentBlock.DeleteAction": "delete", diff --git a/webapp/src/components/__snapshots__/cardDialog.test.tsx.snap b/webapp/src/components/__snapshots__/cardDialog.test.tsx.snap index 18f72c003..de5404f94 100644 --- a/webapp/src/components/__snapshots__/cardDialog.test.tsx.snap +++ b/webapp/src/components/__snapshots__/cardDialog.test.tsx.snap @@ -592,6 +592,415 @@ exports[`components/cardDialog return cardDialog menu content 1`] = ` `; +exports[`components/cardDialog return cardDialog menu content and cancel delete confirmation do nothing 1`] = ` +
+
+
+
+
+ + +
+
+
+ +
+
+ +
+ +
+
+
+
+ +
+
+
+
+
+ " + /> +
+
+