From 9ac84eeaf183af3dcf52e00e55837dfbf2d1b6a5 Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Mon, 11 Nov 2024 19:00:48 +0100 Subject: [PATCH 1/2] [#205] Center the reject modal --- src/components/button/RejectButton.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/button/RejectButton.jsx b/src/components/button/RejectButton.jsx index 16a75f8c..b331b558 100644 --- a/src/components/button/RejectButton.jsx +++ b/src/components/button/RejectButton.jsx @@ -44,7 +44,7 @@ const RejectButton = ({ )} - + {i18n("reject-dialog-title")} From 6a4a1746e8f71ef68cf8c6c7cec6629fde03ccca Mon Sep 17 00:00:00 2001 From: Daniil Palagin Date: Tue, 12 Nov 2024 17:03:07 +0100 Subject: [PATCH 2/2] [#205] Fix modal display when isAllowedRejectReason is false --- src/actions/RecordsActions.js | 2 +- src/components/button/RejectButton.jsx | 59 +++++++++++----------- src/components/record/RecordController.jsx | 4 +- src/reducers/RecordsReducer.js | 2 +- 4 files changed, 34 insertions(+), 33 deletions(-) diff --git a/src/actions/RecordsActions.js b/src/actions/RecordsActions.js index 497a6c71..758b3f9e 100644 --- a/src/actions/RecordsActions.js +++ b/src/actions/RecordsActions.js @@ -196,7 +196,7 @@ export function loadAllowedRejectReason() { dispatch(loadAllowedRejectReasonSuccess(response.data)); }) .catch((error) => { - dispatch(loadAllowedRejectReasonError(error)); + dispatch(loadAllowedRejectReasonError(error.response.data)); }); }; } diff --git a/src/components/button/RejectButton.jsx b/src/components/button/RejectButton.jsx index b331b558..816659fd 100644 --- a/src/components/button/RejectButton.jsx +++ b/src/components/button/RejectButton.jsx @@ -12,7 +12,7 @@ const RejectButton = ({ variant = "danger", size = "sm", disabled = true, - onClick = () => {}, + onClick = (rejectReason) => {}, }) => { const { i18n } = useI18n(); const dispatch = useDispatch(); @@ -39,37 +39,38 @@ const RejectButton = ({ {children} ) : ( - )} - - - - {i18n("reject-dialog-title")} - - -
- - - -
-
- - - - -
+ {isAllowedRejectReason && ( + + + {i18n("reject-dialog-title")} + + +
+ + + +
+
+ + + + +
+ )} ); }; diff --git a/src/components/record/RecordController.jsx b/src/components/record/RecordController.jsx index ee10db3e..97fec719 100644 --- a/src/components/record/RecordController.jsx +++ b/src/components/record/RecordController.jsx @@ -138,9 +138,9 @@ class RecordController extends React.Component { }); }; - _onReject = (reason) => { + _onReject = (rejectionReason) => { this._handlePhaseChange(RECORD_PHASE.REJECTED, () => { - this._handleRejectReason(reason, () => { + this._handleRejectReason(rejectionReason, () => { this.props.updateRecord(this.state.record, this.props.currentUser); this._transitionToRecords(); }); diff --git a/src/reducers/RecordsReducer.js b/src/reducers/RecordsReducer.js index c53b8f9c..041fdb8b 100644 --- a/src/reducers/RecordsReducer.js +++ b/src/reducers/RecordsReducer.js @@ -74,7 +74,7 @@ export default function (state = initialState, action) { ...state, isAllowedRejectReason: { status: ACTION_STATUS.PENDING, - data: state.isAllowedRejectReason, + data: action.isAllowedRejectReason, error: "", }, };