From 6f5cb385b00205759d21527eeb80f2e9851379d3 Mon Sep 17 00:00:00 2001 From: Taranto Date: Mon, 17 Aug 2020 17:48:52 +0100 Subject: [PATCH] feat: compliance triggers and customers up to spec --- .../src/components/editableTable/Row.js | 10 +- .../components/propertyCard/PropertyCard.js | 91 +++-- .../propertyCard/PropertyCard.styles.js | 2 +- .../src/pages/Transactions/CopyToClipboard.js | 9 +- .../src/pages/Triggers/Triggers.js | 12 +- .../src/pages/Triggers/Triggers.styles.js | 7 + .../src/pages/Triggers/Wizard.js | 19 +- .../src/pages/Triggers/helper.js | 354 ++++++++++++++++-- 8 files changed, 400 insertions(+), 104 deletions(-) diff --git a/new-lamassu-admin/src/components/editableTable/Row.js b/new-lamassu-admin/src/components/editableTable/Row.js index be538660..6f6c77f0 100644 --- a/new-lamassu-admin/src/components/editableTable/Row.js +++ b/new-lamassu-admin/src/components/editableTable/Row.js @@ -93,6 +93,7 @@ const ECol = ({ }) => { const { name, + bypassField, input, editable = true, size, @@ -122,6 +123,9 @@ const ECol = ({ innerProps.getLabel = view } + const isEditing = editing && editable + const isField = !bypassField + return ( - {editing && editable ? ( + {isEditing && isField && ( - ) : ( - values && <>{view(values[name])} )} + {isEditing && !isField && } + {!isEditing && values && <>{view(values[name], values)}} {suffix && ( {suffix} )} diff --git a/new-lamassu-admin/src/pages/Customers/components/propertyCard/PropertyCard.js b/new-lamassu-admin/src/pages/Customers/components/propertyCard/PropertyCard.js index 50f3da68..353d2d72 100644 --- a/new-lamassu-admin/src/pages/Customers/components/propertyCard/PropertyCard.js +++ b/new-lamassu-admin/src/pages/Customers/components/propertyCard/PropertyCard.js @@ -3,12 +3,12 @@ import { makeStyles } from '@material-ui/core/styles' import classnames from 'classnames' import React, { memo } from 'react' -// import { ActionButton } from 'src/components/buttons' +import { ActionButton } from 'src/components/buttons' import { H3 } from 'src/components/typography' -// import { ReactComponent as AuthorizeReversedIcon } from 'src/styling/icons/button/authorize/white.svg' -// import { ReactComponent as AuthorizeIcon } from 'src/styling/icons/button/authorize/zodiac.svg' -// import { ReactComponent as RejectReversedIcon } from 'src/styling/icons/button/cancel/white.svg' -// import { ReactComponent as RejectIcon } from 'src/styling/icons/button/cancel/zodiac.svg' +import { ReactComponent as AuthorizeReversedIcon } from 'src/styling/icons/button/authorize/white.svg' +import { ReactComponent as AuthorizeIcon } from 'src/styling/icons/button/authorize/zodiac.svg' +import { ReactComponent as RejectReversedIcon } from 'src/styling/icons/button/cancel/white.svg' +import { ReactComponent as RejectIcon } from 'src/styling/icons/button/cancel/zodiac.svg' import { propertyCardStyles } from './PropertyCard.styles' @@ -24,48 +24,46 @@ const PropertyCard = memo( const propertyCardClassNames = { [classes.propertyCard]: true, - [classes.propertyCardPending]: true - // [classes.propertyCardPending]: state === OVERRIDE_PENDING - // [classes.propertyCardRejected]: state === OVERRIDE_REJECTED, - // [classes.propertyCardAccepted]: state === OVERRIDE_AUTHORIZED + [classes.propertyCardPending]: state === OVERRIDE_PENDING, + [classes.propertyCardRejected]: state === OVERRIDE_REJECTED, + [classes.propertyCardAccepted]: state === OVERRIDE_AUTHORIZED } - // const label1ClassNames = { - // [classes.label1]: true, - // [classes.label1Pending]: true - // [classes.label1Pending]: state === OVERRIDE_PENDING - // [classes.label1Rejected]: state === OVERRIDE_REJECTED, - // [classes.label1Accepted]: state === OVERRIDE_AUTHORIZED - // } + const label1ClassNames = { + [classes.label1]: true, + [classes.label1Pending]: state === OVERRIDE_PENDING, + [classes.label1Rejected]: state === OVERRIDE_REJECTED, + [classes.label1Accepted]: state === OVERRIDE_AUTHORIZED + } - // const AuthorizeButton = () => ( - // authorize()}> - // Authorize - // - // ) + const AuthorizeButton = () => ( + authorize()}> + Authorize + + ) - // const RejectButton = () => ( - // reject()}> - // Reject - // - // ) + const RejectButton = () => ( + reject()}> + Reject + + ) - // const authorizedAsString = - // state === OVERRIDE_PENDING - // ? 'Pending' - // : state === OVERRIDE_REJECTED - // ? 'Rejected' - // : 'Accepted' + const authorizedAsString = + state === OVERRIDE_PENDING + ? 'Pending' + : state === OVERRIDE_REJECTED + ? 'Rejected' + : 'Accepted' return (

{title}

- {/*
+
{authorizedAsString} -
*/} +
{children} - {/* V2 */} - {/*
+
{state !== OVERRIDE_AUTHORIZED && AuthorizeButton()} {state !== OVERRIDE_REJECTED && RejectButton()} -
*/} +
) } diff --git a/new-lamassu-admin/src/pages/Customers/components/propertyCard/PropertyCard.styles.js b/new-lamassu-admin/src/pages/Customers/components/propertyCard/PropertyCard.styles.js index a41af7a2..9cd8ca65 100644 --- a/new-lamassu-admin/src/pages/Customers/components/propertyCard/PropertyCard.styles.js +++ b/new-lamassu-admin/src/pages/Customers/components/propertyCard/PropertyCard.styles.js @@ -52,7 +52,7 @@ const propertyCardStyles = { display: 'flex', borderRadius: 8, width: '100%', - height: 'calc(100% - 75px)', + height: 'calc(100% - 104px)', padding: [[20]], boxSizing: 'border-box', boxShadow: '0 0 8px 0 rgba(0, 0, 0, 0.04)', diff --git a/new-lamassu-admin/src/pages/Transactions/CopyToClipboard.js b/new-lamassu-admin/src/pages/Transactions/CopyToClipboard.js index 61370218..ce6065c6 100644 --- a/new-lamassu-admin/src/pages/Transactions/CopyToClipboard.js +++ b/new-lamassu-admin/src/pages/Transactions/CopyToClipboard.js @@ -12,7 +12,12 @@ import { cpcStyles } from './Transactions.styles' const useStyles = makeStyles(cpcStyles) -const CopyToClipboard = ({ className, children, ...props }) => { +const CopyToClipboard = ({ + className, + buttonClassname, + children, + ...props +}) => { const [anchorEl, setAnchorEl] = useState(null) useEffect(() => { @@ -39,7 +44,7 @@ const CopyToClipboard = ({ className, children, ...props }) => {
{children}
-
+