From 8e83d184ba5b7d5731d58d72b11658816c6645a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Oliveira?= Date: Mon, 18 Oct 2021 15:48:17 +0100 Subject: [PATCH] fix: button display and revert button component changes --- .../src/components/buttons/FeatureButton.js | 4 +- .../Customers/components/EditableCard.js | 39 +++++++++++-------- 2 files changed, 25 insertions(+), 18 deletions(-) diff --git a/new-lamassu-admin/src/components/buttons/FeatureButton.js b/new-lamassu-admin/src/components/buttons/FeatureButton.js index 86a06c5e..3fe97cd7 100644 --- a/new-lamassu-admin/src/components/buttons/FeatureButton.js +++ b/new-lamassu-admin/src/components/buttons/FeatureButton.js @@ -32,8 +32,8 @@ const styles = { const useStyles = makeStyles(styles) const FeatureButton = memo( - ({ className, Icon, InverseIcon, children, active, ...props }) => { - const classes = useStyles({ active }) + ({ className, Icon, InverseIcon, children, ...props }) => { + const classes = useStyles() const classNames = { [classes.featureButton]: true, diff --git a/new-lamassu-admin/src/pages/Customers/components/EditableCard.js b/new-lamassu-admin/src/pages/Customers/components/EditableCard.js index e3a7f230..fc75f458 100644 --- a/new-lamassu-admin/src/pages/Customers/components/EditableCard.js +++ b/new-lamassu-admin/src/pages/Customers/components/EditableCard.js @@ -123,8 +123,7 @@ const EditableCard = ({ [classes.label1Rejected]: state === OVERRIDE_REJECTED, [classes.label1Accepted]: state === OVERRIDE_AUTHORIZED } - const isNotAuthorized = - state === OVERRIDE_REJECTED || state === OVERRIDE_PENDING + const authorized = state === OVERRIDE_PENDING ? { label: 'Pending', type: 'neutral' } @@ -208,20 +207,28 @@ const EditableCard = ({ Cancel - authorize() : () => reject() - }> - {isNotAuthorized ? 'Authorize' : 'Reject'} - + {authorized.label !== 'Accepted' && ( +
+ authorize()}> + {'Authorize'} + +
+ )} + {authorized.label !== 'Rejected' && ( + reject()}> + {'Reject'} + + )} {error && ( Failed to save changes )}