From 98a3c5ce0af17e316cf1e76969687cf02f437716 Mon Sep 17 00:00:00 2001 From: Alisher Musurmonov Date: Wed, 11 Oct 2023 12:26:56 +0500 Subject: [PATCH] UIU-2951: change disabled button style (#2568) * UIU-2951: change disabled button style * tests: fix failing test cases * UIU-2951: remove css styling and move the logic to stripes-components * refactor: hide disabled elements * refactor: hide button for shadow users --- .../RequestFeeFineBlockButtons.js | 5 ----- .../RequestFeeFineBlockButtons.test.js | 9 --------- src/views/UserDetail/UserDetail.js | 20 ++++++++++--------- 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/components/RequestFeeFineBlockButtons/RequestFeeFineBlockButtons.js b/src/components/RequestFeeFineBlockButtons/RequestFeeFineBlockButtons.js index 9afc8f339..3545ebbb4 100644 --- a/src/components/RequestFeeFineBlockButtons/RequestFeeFineBlockButtons.js +++ b/src/components/RequestFeeFineBlockButtons/RequestFeeFineBlockButtons.js @@ -17,7 +17,6 @@ class RequestFeeFineBlockButtons extends React.Component { onToggle: PropTypes.func, userId: PropTypes.string, location: PropTypes.object, - disabled: PropTypes.bool, }; render() { @@ -26,7 +25,6 @@ class RequestFeeFineBlockButtons extends React.Component { onToggle, userId, location, - disabled, } = this.props; const createRequestUrl = getRequestUrl(barcode, userId); @@ -38,7 +36,6 @@ class RequestFeeFineBlockButtons extends React.Component { data-test-actions-menu-create-request to={createRequestUrl} onClick={onToggle} - disabled={disabled} > @@ -51,7 +48,6 @@ class RequestFeeFineBlockButtons extends React.Component { data-test-actions-menu-create-feesfines to={{ pathname: `/users/${userId}/charge` }} onClick={onToggle} - disabled={disabled} > @@ -63,7 +59,6 @@ class RequestFeeFineBlockButtons extends React.Component { buttonStyle="dropdownItem" data-test-actions-menu-create-patronblocks id="create-patron-block" - disabled={disabled} to={{ pathname: `/users/${userId}/patronblocks/create`, search: location.search, diff --git a/src/components/RequestFeeFineBlockButtons/RequestFeeFineBlockButtons.test.js b/src/components/RequestFeeFineBlockButtons/RequestFeeFineBlockButtons.test.js index 6aa181a9f..05a2e4d31 100644 --- a/src/components/RequestFeeFineBlockButtons/RequestFeeFineBlockButtons.test.js +++ b/src/components/RequestFeeFineBlockButtons/RequestFeeFineBlockButtons.test.js @@ -44,15 +44,6 @@ describe('RequestFeeFineBlockButtons', () => { expect(screen.queryByText('ui-users.accounts.chargeManual')).toBeInTheDocument(); expect(screen.queryByText('ui-users.blocks.buttons.add')).toBeInTheDocument(); }); - - it('should createRequest button to be disabled', () => { - renderRequestFeeFineBlockButtons({ disabled: true }); - const buttonElements = screen.getAllByRole('button'); - - buttonElements.forEach((buttonElement) => { - expect(buttonElement).toBeDisabled(); - }); - }); }); describe('without ui-requests.all permission', () => { diff --git a/src/views/UserDetail/UserDetail.js b/src/views/UserDetail/UserDetail.js index dcca0d605..f5b70d4fa 100644 --- a/src/views/UserDetail/UserDetail.js +++ b/src/views/UserDetail/UserDetail.js @@ -446,14 +446,16 @@ class UserDetail extends React.Component { if (showActionMenu) { return ( <> - - - + {!isShadowUser && ( + + + + )} - + {!isShadowUser && }