From d02024c5045368d615b1c535436154b9d6062a08 Mon Sep 17 00:00:00 2001 From: mashal-m Date: Tue, 11 Oct 2022 16:43:52 +0500 Subject: [PATCH 1/3] refactor: migrate off paragon modal deprecated component --- .../author-library/LibraryAuthoringPage.jsx | 62 +++--- .../library-access/UserAccessWidget.jsx | 201 ++++++++++-------- 2 files changed, 148 insertions(+), 115 deletions(-) diff --git a/src/library-authoring/author-library/LibraryAuthoringPage.jsx b/src/library-authoring/author-library/LibraryAuthoringPage.jsx index 458c366f..982b4455 100644 --- a/src/library-authoring/author-library/LibraryAuthoringPage.jsx +++ b/src/library-authoring/author-library/LibraryAuthoringPage.jsx @@ -7,11 +7,12 @@ import { Button, Card, Navbar, - Modal, Dropdown, SearchField, Form, Pagination, + ModalDialog, + ActionRow, } from '@edx/paragon'; import { v4 as uuid4 } from 'uuid'; import { faPlus, faSync } from '@fortawesome/free-solid-svg-icons'; @@ -79,7 +80,7 @@ export const BlockPreviewBase = ({ {block.display_name} - { library.allow_lti && ( + {library.allow_lti && ( <> - setShowDeleteModal(false)} - body={( + > + + + + {intl.formatMessage(messages['library.detail.block.delete.modal.title'])} + + +

{intl.formatMessage(messages['library.detail.block.delete.modal.body'])}

- )} - buttons={[ - , - ]} - /> +
+ + + + Close + + + + + {showPreviews && ( @@ -274,7 +284,7 @@ const ButtonTogglesBase = ({ ); @@ -425,16 +435,16 @@ export const LibraryAuthoringPageBase = ({ : null} {library.type !== LIBRARY_TYPES.COMPLEX && ( - + )} {library.type === LIBRARY_TYPES.COMPLEX && ( diff --git a/src/library-authoring/library-access/UserAccessWidget.jsx b/src/library-authoring/library-access/UserAccessWidget.jsx index c391e40e..5b80d136 100644 --- a/src/library-authoring/library-access/UserAccessWidget.jsx +++ b/src/library-authoring/library-access/UserAccessWidget.jsx @@ -2,8 +2,9 @@ Component for displaying and modifying a user's access level for a library. */ import { + ActionRow, Badge, - Button, Card, Col, Modal, Row, + Button, Card, Col, ModalDialog, Row, } from '@edx/paragon'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faTrash } from '@fortawesome/free-solid-svg-icons'; @@ -40,99 +41,121 @@ export const UserAccessWidget = ({ {isAdmin && ( - - - {(user.access_level === LIBRARY_ACCESS.ADMIN) && adminLocked && ( - - {intl.formatMessage(messages['library.access.info.admin_unlock'])} - - )} - {user.access_level === LIBRARY_ACCESS.ADMIN && multipleAdmins && ( - - - setShowDeprivModal(false)} - body={( -
-

- {intl.formatMessage( - messages['library.access.modal.remove_admin.body'], - { library: library.title, email: user.email }, - )} -

-
- )} - buttons={[ - + setShowDeprivModal(false)} > - {intl.formatMessage(commonMessages['library.common.forms.button.yes'])} - , - ]} - /> - - )} - {user.access_level === LIBRARY_ACCESS.READ && ( - - - - )} - {user.access_level === LIBRARY_ACCESS.AUTHOR && ( - <> - - , + + + + + )} + {user.access_level === LIBRARY_ACCESS.READ && ( + + - - + + + + + + )} + {(!((user.access_level === LIBRARY_ACCESS.ADMIN) && adminLocked)) && ( + + + setShowRemoveModal(false)} + > + + + + {intl.formatMessage(messages['library.access.modal.remove.title'])} + + + +
+

+ {intl.formatMessage( + messages['library.access.modal.remove.body'], + { library: library.title, email: user.email }, + )} +

+
+
+ + + + Close + + , + + +
- - )} - {(!((user.access_level === LIBRARY_ACCESS.ADMIN) && adminLocked)) && ( - - - setShowRemoveModal(false)} - body={( -
-

- {intl.formatMessage( - messages['library.access.modal.remove.body'], - { library: library.title, email: user.email }, - )} -

-
- )} - buttons={[ - , - ]} - /> - - )} -
- + )} +
+ )}
From f07907a229c5a53d005fd4f63f5af2a61305a9ea Mon Sep 17 00:00:00 2001 From: mashal-m Date: Tue, 18 Oct 2022 11:09:40 +0500 Subject: [PATCH 2/3] refactor: remooved div and p tag --- .../author-library/LibraryAuthoringPage.jsx | 6 +---- .../library-access/UserAccessWidget.jsx | 24 +++++++------------ 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/library-authoring/author-library/LibraryAuthoringPage.jsx b/src/library-authoring/author-library/LibraryAuthoringPage.jsx index 982b4455..006d3ed3 100644 --- a/src/library-authoring/author-library/LibraryAuthoringPage.jsx +++ b/src/library-authoring/author-library/LibraryAuthoringPage.jsx @@ -115,11 +115,7 @@ export const BlockPreviewBase = ({ -
-

- {intl.formatMessage(messages['library.detail.block.delete.modal.body'])} -

-
+ {intl.formatMessage(messages['library.detail.block.delete.modal.body'])}
diff --git a/src/library-authoring/library-access/UserAccessWidget.jsx b/src/library-authoring/library-access/UserAccessWidget.jsx index 5b80d136..8e961cab 100644 --- a/src/library-authoring/library-access/UserAccessWidget.jsx +++ b/src/library-authoring/library-access/UserAccessWidget.jsx @@ -64,14 +64,10 @@ export const UserAccessWidget = ({ -
-

- {intl.formatMessage( - messages['library.access.modal.remove_admin.body'], - { library: library.title, email: user.email }, - )} -

-
+ {intl.formatMessage( + messages['library.access.modal.remove_admin.body'], + { library: library.title, email: user.email }, + )}
@@ -132,14 +128,10 @@ export const UserAccessWidget = ({ -
-

- {intl.formatMessage( - messages['library.access.modal.remove.body'], - { library: library.title, email: user.email }, - )} -

-
+ {intl.formatMessage( + messages['library.access.modal.remove.body'], + { library: library.title, email: user.email }, + )}
From d0a1891ae4c485369b3ee9413d56c2b356cf9570 Mon Sep 17 00:00:00 2001 From: mashal-m Date: Tue, 18 Oct 2022 11:36:06 +0500 Subject: [PATCH 3/3] refactor: removed div and p tag --- src/library-authoring/author-library/LibraryAuthoringPage.jsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/library-authoring/author-library/LibraryAuthoringPage.jsx b/src/library-authoring/author-library/LibraryAuthoringPage.jsx index 006d3ed3..50cbbe6e 100644 --- a/src/library-authoring/author-library/LibraryAuthoringPage.jsx +++ b/src/library-authoring/author-library/LibraryAuthoringPage.jsx @@ -108,7 +108,6 @@ export const BlockPreviewBase = ({ isOpen={showDeleteModal} onClose={() => setShowDeleteModal(false)} > - {intl.formatMessage(messages['library.detail.block.delete.modal.title'])}