From b6830b805bbe0fab43459546fbb65599f3ee8d4b Mon Sep 17 00:00:00 2001 From: Mateusz Kwasniewski Date: Wed, 16 Aug 2023 13:55:18 +0200 Subject: [PATCH] feat: review buttons makeover (#4513) --- .../ChangeRequestOverview.tsx | 9 +++++-- .../ReviewButton/ReviewButton.tsx | 26 ++++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/frontend/src/component/changeRequest/ChangeRequestOverview/ChangeRequestOverview.tsx b/frontend/src/component/changeRequest/ChangeRequestOverview/ChangeRequestOverview.tsx index 5f584ac168..dd739cda06 100644 --- a/frontend/src/component/changeRequest/ChangeRequestOverview/ChangeRequestOverview.tsx +++ b/frontend/src/component/changeRequest/ChangeRequestOverview/ChangeRequestOverview.tsx @@ -189,6 +189,9 @@ export const ChangeRequestOverview: FC = () => { const hasApprovedAlready = changeRequest.approvals.some( approval => approval.createdBy.id === user?.id ); + + const countOfChanges = changesCount(changeRequest); + return ( <> @@ -199,7 +202,7 @@ export const ChangeRequestOverview: FC = () => { - Requested Changes ({changesCount(changeRequest)}) + Requested Changes ({countOfChanges}) { } onApprove={onApprove} disabled={!allowChangeRequestActions} - /> + > + Review changes ({countOfChanges}) + } /> void; onApprove: () => void; -}> = ({ disabled, onReject, onApprove }) => { +}> = ({ disabled, onReject, onApprove, children }) => { const { uiConfig } = useUiConfig(); const { isAdmin } = useContext(AccessContext); const projectId = useRequiredPathParam('projectId'); @@ -48,6 +52,9 @@ export const ReviewButton: FC<{ setOpen(false); }; + const popperWidth = anchorRef.current + ? anchorRef.current.offsetWidth + : null; return ( @@ -67,11 +74,12 @@ export const ReviewButton: FC<{ projectId={projectId} environmentId={data?.environment} > - Review changes + {children} - Approve changes + + + + + Approve changes + - Reject changes + + + + + Reject changes + } />