diff --git a/new-lamassu-admin/src/components/buttons/ActionButton.jsx b/new-lamassu-admin/src/components/buttons/ActionButton.jsx index d2fb2043..36eba7cf 100644 --- a/new-lamassu-admin/src/components/buttons/ActionButton.jsx +++ b/new-lamassu-admin/src/components/buttons/ActionButton.jsx @@ -7,14 +7,15 @@ import styles from './ActionButton.styles' const useStyles = makeStyles(styles) const ActionButton = memo( - ({ className, Icon, InverseIcon, color, children, ...props }) => { + ({ className, Icon, InverseIcon, color, center, children, ...props }) => { const classes = useStyles() const classNames = { [classes.actionButton]: true, [classes.primary]: color === 'primary', [classes.secondary]: color === 'secondary', [classes.spring]: color === 'spring', - [classes.tomato]: color === 'tomato' + [classes.tomato]: color === 'tomato', + [classes.center]: center } return ( diff --git a/new-lamassu-admin/src/components/buttons/ActionButton.styles.js b/new-lamassu-admin/src/components/buttons/ActionButton.styles.js index f924347a..d6659029 100644 --- a/new-lamassu-admin/src/components/buttons/ActionButton.styles.js +++ b/new-lamassu-admin/src/components/buttons/ActionButton.styles.js @@ -119,5 +119,9 @@ export default { } } }, + center: { + alignItems: 'center', + justifyContent: 'center' + }, actionButtonIconActive: {} } diff --git a/new-lamassu-admin/src/components/inputs/base/TextInput.jsx b/new-lamassu-admin/src/components/inputs/base/TextInput.jsx index 33ba68ac..2c4592e7 100644 --- a/new-lamassu-admin/src/components/inputs/base/TextInput.jsx +++ b/new-lamassu-admin/src/components/inputs/base/TextInput.jsx @@ -19,6 +19,7 @@ const TextInput = memo( suffix, textAlign, width, + inputClasses, // lg or sm size, bold, @@ -29,7 +30,7 @@ const TextInput = memo( const classes = useStyles({ textAlign, width, size }) const isTextFilled = !error && !R.isNil(value) && !R.isEmpty(value) const filled = isPasswordFilled || isTextFilled - const inputClasses = { + const divClass = { [classes.bold]: bold } @@ -44,15 +45,17 @@ const TextInput = memo( classes={{ root: classes.root }} className={className} InputProps={{ - className: classnames(inputClasses), + className: classnames(divClass), classes: { root: classes.size, - underline: filled ? classes.underline : null + underline: filled ? classes.underline : null, + input: inputClasses }, ...InputProps }} - {...props} /> - ); + {...props} + /> + ) } ) diff --git a/new-lamassu-admin/src/pages/Customers/CustomerData.jsx b/new-lamassu-admin/src/pages/Customers/CustomerData.jsx index e1f9a265..61a8e1d3 100644 --- a/new-lamassu-admin/src/pages/Customers/CustomerData.jsx +++ b/new-lamassu-admin/src/pages/Customers/CustomerData.jsx @@ -1,28 +1,19 @@ -import Grid from '@mui/material/Grid' -import { makeStyles } from '@mui/styles' import * as R from 'ramda' import { useState, React } from 'react' import ImagePopper from 'src/components/ImagePopper' import { H3, Info3 } from 'src/components/typography' import CardIcon from 'src/styling/icons/ID/card/comet.svg?react' import PhoneIcon from 'src/styling/icons/ID/phone/comet.svg?react' -import CrossedCameraIcon from 'src/styling/icons/ID/photo/crossed-camera.svg?react' import EditIcon from 'src/styling/icons/action/edit/comet.svg?react' -import CustomerListViewReversedIcon from 'src/styling/icons/circle buttons/customer-list-view/white.svg?react' -import CustomerListViewIcon from 'src/styling/icons/circle buttons/customer-list-view/zodiac.svg?react' -import OverviewReversedIcon from 'src/styling/icons/circle buttons/overview/white.svg?react' -import OverviewIcon from 'src/styling/icons/circle buttons/overview/zodiac.svg?react' import * as Yup from 'yup' -import { FeatureButton } from 'src/components/buttons' import { TextInput } from 'src/components/inputs/formik' import { OVERRIDE_AUTHORIZED, OVERRIDE_REJECTED -} from 'src/pages/Customers/components/propertyCard' +} from 'src/pages/Customers/components/consts' import { onlyFirstToUpper } from 'src/utils/string' -import styles from './CustomerData.styles' import { EditableCard } from './components' import { customerDataElements, @@ -32,32 +23,20 @@ import { getFormattedPhone } from './helper' -const useStyles = makeStyles(styles) - const IMAGE_WIDTH = 165 const IMAGE_HEIGHT = 32 const POPUP_IMAGE_WIDTH = 360 const POPUP_IMAGE_HEIGHT = 240 -const Photo = ({ show, src }) => { - const classes = useStyles({ width: IMAGE_WIDTH }) - +const Photo = ({ src }) => { return ( - <> - {show ? ( - - ) : ( -
- -
- )} - + ) } @@ -75,8 +54,6 @@ const CustomerData = ({ setRetrieve, checkAgainstSanctions }) => { - const classes = useStyles() - const [listView, setListView] = useState(false) const [previewPhoto, setPreviewPhoto] = useState(null) const [previewCard, setPreviewCard] = useState(null) @@ -163,7 +140,7 @@ const CustomerData = ({ { fields: customerDataElements.idCardData, title: 'ID Scan', - titleIcon: , + titleIcon: , state: R.path(['idCardDataOverride'])(customer), authorize: () => updateCustomer({ idCardDataOverride: OVERRIDE_AUTHORIZED }), @@ -187,7 +164,7 @@ const CustomerData = ({ { fields: smsDataElements, title: 'SMS data', - titleIcon: , + titleIcon: , state: R.path(['phoneOverride'])(customer), authorize: () => updateCustomer({ phoneOverride: OVERRIDE_AUTHORIZED }), reject: () => updateCustomer({ phoneOverride: OVERRIDE_REJECTED }), @@ -208,7 +185,7 @@ const CustomerData = ({ { title: 'Email', fields: customerDataElements.email, - titleIcon: , + titleIcon: , // state: R.path(['emailOverride'])(customer), // authorize: () => updateCustomer({ emailOverride: OVERRIDE_AUTHORIZED }), // reject: () => updateCustomer({ emailOverride: OVERRIDE_REJECTED }), @@ -220,13 +197,13 @@ const CustomerData = ({ }, { title: 'Name', - titleIcon: , + titleIcon: , isAvailable: false, editable: true }, { title: 'Sanctions check', - titleIcon: , + titleIcon: , state: R.path(['sanctionsOverride'])(customer), authorize: () => updateCustomer({ sanctionsOverride: OVERRIDE_AUTHORIZED }), @@ -238,7 +215,7 @@ const CustomerData = ({ { fields: customerDataElements.frontCamera, title: 'Front facing camera', - titleIcon: , + titleIcon: , state: R.path(['frontCameraOverride'])(customer), authorize: () => updateCustomer({ frontCameraOverride: OVERRIDE_AUTHORIZED }), @@ -259,7 +236,6 @@ const CustomerData = ({ return customer.frontCameraPath ? ( , + titleIcon: , state: R.path(['idCardPhotoOverride'])(customer), authorize: () => updateCustomer({ idCardPhotoOverride: OVERRIDE_AUTHORIZED }), @@ -298,7 +274,6 @@ const CustomerData = ({ return customer.idCardPhotoPath ? ( , + titleIcon: , state: R.path(['usSsnOverride'])(customer), authorize: () => updateCustomer({ usSsnOverride: OVERRIDE_AUTHORIZED }), reject: () => updateCustomer({ usSsnOverride: OVERRIDE_REJECTED }), @@ -342,7 +317,7 @@ const CustomerData = ({ } ], title: it.customInfoRequest.customRequest.name, - titleIcon: , + titleIcon: , state: R.path(['override'])(it), authorize: () => authorizeCustomRequest({ @@ -395,7 +370,7 @@ const CustomerData = ({ } ], title: it.label, - titleIcon: , + titleIcon: , save: values => { updateCustomEntry({ fieldId: it.id, @@ -445,7 +420,7 @@ const CustomerData = ({ editable: false } ], - titleIcon: , + titleIcon: , title: `External Info [${it.service}]`, initialValues: it ?? { externalId: '', @@ -477,26 +452,28 @@ const CustomerData = ({ idx ) => { return ( - - {children} - +
+ + {children} + +
) } @@ -505,113 +482,67 @@ const CustomerData = ({ idx ) => { return ( - - {children} - +
+ + {children} + +
) } const visibleCards = getVisibleCards(cards) + const Separator = ({ title }) => ( +
+
+
+ {title} +
+
+
+ ) + return (
-
-

{'Customer data'}

- { - // TODO: Remove false condition for next release - // false && ( - // <> - // setListView(false)} - // /> - // setListView(true)}> - // - // ) - } -
+

{'Customer data'}

- {!listView && customer && ( - - - {visibleCards.map((elem, idx) => { - return isEven(idx) ? editableCard(elem, idx) : null - })} - - - {visibleCards.map((elem, idx) => { - return !isEven(idx) ? editableCard(elem, idx) : null - })} - - - )} - {!R.isEmpty(customFields) && ( -
- Custom data entry - - + {customer && ( +
+ {visibleCards.map((elem, idx) => { + return editableCard(elem, idx) + })} + {!R.isEmpty(customFields) && ( + <> + {customFields.map((elem, idx) => { - return isEven(idx) ? editableCard(elem, idx) : null + return editableCard(elem, idx) })} - - - {customFields.map((elem, idx) => { - return !isEven(idx) ? editableCard(elem, idx) : null - })} - - -
- )} - {!R.isEmpty(customRequirements) && ( -
- Custom requirements - - + + )} + {!R.isEmpty(customRequirements) && ( + <> + {customRequirements.map((elem, idx) => { - return isEven(idx) ? editableCard(elem, idx) : null + return editableCard(elem, idx) })} - - - {customRequirements.map((elem, idx) => { - return !isEven(idx) ? editableCard(elem, idx) : null - })} - - -
- )} - {!R.isEmpty(externalCompliance) && ( -
- - External compliance information - - - + + )} + {!R.isEmpty(externalCompliance) && ( + <> + {externalCompliance.map((elem, idx) => { - return isEven(idx) ? nonEditableCard(elem, idx) : null + return nonEditableCard(elem, idx) })} - - - {externalCompliance.map((elem, idx) => { - return !isEven(idx) ? nonEditableCard(elem, idx) : null - })} - - + + )}
)}
diff --git a/new-lamassu-admin/src/pages/Customers/CustomerData.styles.js b/new-lamassu-admin/src/pages/Customers/CustomerData.styles.js deleted file mode 100644 index 373e2f0c..00000000 --- a/new-lamassu-admin/src/pages/Customers/CustomerData.styles.js +++ /dev/null @@ -1,49 +0,0 @@ -import { offColor } from 'src/styling/variables' - -export default { - header: { - display: 'flex', - flexDirection: 'row', - marginBottom: 15 - }, - title: { - marginTop: 7, - marginRight: 24 - }, - editIcon: { - marginTop: 5 - }, - cardIcon: { - marginTop: 7 - }, - viewIcons: { - marginRight: 12 - }, - wrapper: { - display: 'block', - overflow: 'hidden', - whiteSpace: 'nowrap' - }, - separator: { - color: offColor, - margin: [[8, 0, 8, 150]], - position: 'relative', - display: 'inline-block', - '&:before, &:after': { - content: '""', - position: 'absolute', - background: offColor, - top: '50%', - width: 1000, - height: 1 - }, - '&:before': { - right: '100%', - marginRight: 15 - }, - '&:after': { - left: '100%', - marginLeft: 15 - } - } -} diff --git a/new-lamassu-admin/src/pages/Customers/CustomerNotes.jsx b/new-lamassu-admin/src/pages/Customers/CustomerNotes.jsx index 8e8f01b7..ee1ad95e 100644 --- a/new-lamassu-admin/src/pages/Customers/CustomerNotes.jsx +++ b/new-lamassu-admin/src/pages/Customers/CustomerNotes.jsx @@ -1,16 +1,12 @@ -import { makeStyles } from '@mui/styles' import * as R from 'ramda' import { React, useState } from 'react' import { H3 } from 'src/components/typography' -import styles from './CustomerNotes.styles' import NewNoteCard from './components/notes/NewNoteCard' import NewNoteModal from './components/notes/NewNoteModal' import NoteCard from './components/notes/NoteCard' import NoteEdit from './components/notes/NoteEdit' -const useStyles = makeStyles(styles) - const CustomerNotes = ({ customer, createNote, @@ -18,7 +14,6 @@ const CustomerNotes = ({ editNote, timezone }) => { - const classes = useStyles() const [openModal, setOpenModal] = useState(false) const [editing, setEditing] = useState(null) @@ -52,11 +47,9 @@ const CustomerNotes = ({ return (
-
-

{'Notes'}

-
+

{'Notes'}

{R.isNil(editing) && ( -
+
{customerNotes.map((it, idx) => ( { - const classes = useStyles() - const [photosDialog, setPhotosDialog] = useState(false) const [photoClickedIndex, setPhotoClickIndex] = useState(null) const orderedPhotosData = !R.isNil(photoClickedIndex) @@ -23,10 +17,8 @@ const CustomerPhotos = ({ photosData, timezone }) => { return (
-
-

{'Photos & files'}

-
-
+

{'Photos & files'}

+
{photosData.map((elem, idx) => ( { - const classes = useStyles() - return ( { setPhotoClickIndex(idx) setPhotosDialog(true) }}> - -
+ +
- - {format('yyyy-MM-dd', new Date(date))} - + {format('yyyy-MM-dd', new Date(date))}
) diff --git a/new-lamassu-admin/src/pages/Customers/CustomerPhotos.styles.js b/new-lamassu-admin/src/pages/Customers/CustomerPhotos.styles.js deleted file mode 100644 index 93d8637f..00000000 --- a/new-lamassu-admin/src/pages/Customers/CustomerPhotos.styles.js +++ /dev/null @@ -1,38 +0,0 @@ -const styles = { - header: { - display: 'flex', - flexDirection: 'row' - }, - title: { - marginTop: 7, - marginRight: 24, - marginBottom: 32 - }, - photosChipList: { - display: 'flex', - flexDirection: 'row', - flexWrap: 'wrap', - gap: 14 - }, - image: { - objectFit: 'cover', - objectPosition: 'center', - width: 224, - height: 200, - borderTopLeftRadius: 4, - borderTopRightRadius: 4 - }, - photoCardChip: { - cursor: 'pointer' - }, - footer: { - display: 'flex', - flexDirection: 'row', - margin: [[8, 0, 0, 8]] - }, - date: { - margin: [[0, 0, 8, 12]] - } -} - -export default styles diff --git a/new-lamassu-admin/src/pages/Customers/CustomerProfile.jsx b/new-lamassu-admin/src/pages/Customers/CustomerProfile.jsx index 219c3cb5..acae9d2e 100644 --- a/new-lamassu-admin/src/pages/Customers/CustomerProfile.jsx +++ b/new-lamassu-admin/src/pages/Customers/CustomerProfile.jsx @@ -4,7 +4,6 @@ import DialogActions from '@mui/material/DialogActions' import DialogContent from '@mui/material/DialogContent' import Dialog from '@mui/material/Dialog' import Switch from '@mui/material/Switch' -import { makeStyles } from '@mui/styles' import NavigateNextIcon from '@mui/icons-material/NavigateNext' import * as R from 'ramda' import React, { memo, useState } from 'react' @@ -23,7 +22,7 @@ import { Button, IconButton, ActionButton } from 'src/components/buttons' import { OVERRIDE_AUTHORIZED, OVERRIDE_REJECTED -} from 'src/pages/Customers/components/propertyCard' +} from 'src/pages/Customers/components/consts' // TODO: Enable for next release // import DiscountReversedIcon from 'src/styling/icons/button/discount/white.svg?react' // import Discount from 'src/styling/icons/button/discount/zodiac.svg?react' @@ -32,7 +31,6 @@ import { fromNamespace, namespaces } from 'src/utils/config' import CustomerData from './CustomerData' import CustomerNotes from './CustomerNotes' import CustomerPhotos from './CustomerPhotos' -import styles from './CustomerProfile.styles' import { CustomerDetails, TransactionsList, @@ -41,8 +39,6 @@ import { } from './components' import { getFormattedPhone, getName, formatPhotosData } from './helper' -const useStyles = makeStyles(styles) - const GET_CUSTOMER = gql` query customer($customerId: ID!) { config @@ -528,23 +524,22 @@ const CustomerProfile = memo(() => { display: it.customRequest.name })) ?? [] - const classes = useStyles() const email = R.path(['email'])(customerData) const phone = R.path(['phone'])(customerData) return ( <> } aria-label="breadcrumb"> history.push('/compliance/customers')}> Customers - + {name.length ? name : email?.length @@ -552,8 +547,8 @@ const CustomerProfile = memo(() => { : getFormattedPhone(phone, locale.country)} -
-
+
+
{!loading && !customerData.isAnonymous && ( <> { onClick={onClickSidebarItem} />
- Actions -
+ + Actions + +
{ {`Manual data entry`} {/* { */} {isSuspended && ( { )} {
- + {`Special user status`} -
-
+
+
{ : enableTestCustomer() } /> - {`Test user`} + Test user
)}
-
+
{isOverview && (
@@ -724,8 +720,6 @@ const RetrieveDataDialog = ({ error, props }) => { - const classes = useStyles() - return ( -
+
onDismissed(false)}>
-

{'Retrieve API data from Twilio'}

- +

{'Retrieve API data from Twilio'}

+ {`With this action you'll be using Twilio's API to retrieve additional data from this user. This includes name and address, if available.\n`} {` There is a small cost from Twilio for each retrieval. Would you like to proceed?`} {error && ( - + Failed to fetch additional data )} - -
diff --git a/new-lamassu-admin/src/pages/Customers/components/CreateCustomerModal.jsx b/new-lamassu-admin/src/pages/Customers/components/CreateCustomerModal.jsx index ba7e1484..c71f5289 100644 --- a/new-lamassu-admin/src/pages/Customers/components/CreateCustomerModal.jsx +++ b/new-lamassu-admin/src/pages/Customers/components/CreateCustomerModal.jsx @@ -1,4 +1,3 @@ -import { makeStyles } from '@mui/styles' import { Field, Form, Formik } from 'formik' import { parsePhoneNumberWithError } from 'libphonenumber-js' import * as R from 'ramda' @@ -10,28 +9,6 @@ import * as Yup from 'yup' import { Button } from 'src/components/buttons' import { TextInput } from 'src/components/inputs/formik' -import { spacer, primaryColor, fontPrimary } from 'src/styling/variables' - -const styles = { - modalTitle: { - marginTop: -5, - color: primaryColor, - fontFamily: fontPrimary - }, - footer: { - display: 'flex', - flexDirection: 'row', - margin: [['auto', 0, spacer * 3, 0]] - }, - form: { - display: 'flex', - flexDirection: 'column', - height: '100%' - }, - submit: { - margin: [['auto', 0, 0, 'auto']] - } -} const getValidationSchema = countryCodes => Yup.object().shape({ @@ -39,7 +16,9 @@ const getValidationSchema = countryCodes => .required('A phone number is required') .test('is-valid-number', 'That is not a valid phone number', value => { try { - return countryCodes.some(countryCode => parsePhoneNumberWithError(value, countryCode).isValid()) + return countryCodes.some(countryCode => + parsePhoneNumberWithError(value, countryCode).isValid() + ) } catch (e) { return false } @@ -60,8 +39,6 @@ const initialValues = { phoneNumber: '' } -const useStyles = makeStyles(styles) - const getErrorMsg = (formikErrors, formikTouched) => { if (!formikErrors || !formikTouched) return null if (formikErrors.phoneNumber && formikTouched.phoneNumber) @@ -70,8 +47,6 @@ const getErrorMsg = (formikErrors, formikTouched) => { } const CreateCustomerModal = ({ showModal, handleClose, onSubmit, locale }) => { - const classes = useStyles() - const possibleCountries = R.append( locale?.country, R.map(it => it.country, locale?.overrides ?? []) @@ -99,8 +74,10 @@ const CreateCustomerModal = ({ showModal, handleClose, onSubmit, locale }) => { }) }}> {({ errors, touched }) => ( - -

Create new customer

+ +

Create new customer

{ autoFocus label="Phone number" /> -
+
{getErrorMsg(errors, touched) && ( {getErrorMsg(errors, touched)} )}
diff --git a/new-lamassu-admin/src/pages/Customers/components/CustomInfoRequestsData.jsx b/new-lamassu-admin/src/pages/Customers/components/CustomInfoRequestsData.jsx deleted file mode 100644 index 037a161f..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/CustomInfoRequestsData.jsx +++ /dev/null @@ -1,193 +0,0 @@ -import { useMutation, gql } from "@apollo/client"; -import { makeStyles } from '@mui/styles' -import classnames from 'classnames' -import React, { useState } from 'react' -import Modal from 'src/components/Modal' -import { MainStatus } from 'src/components/Status' -import { - Table, - THead, - Th, - Tr, - Td, - TBody -} from 'src/components/fake-table/Table' -import { H3, Label1 } from 'src/components/typography' -import AuthorizeReversedIcon from 'src/styling/icons/button/authorize/white.svg?react' -import AuthorizeIcon from 'src/styling/icons/button/authorize/zodiac.svg?react' -import RejectReversedIcon from 'src/styling/icons/button/cancel/white.svg?react' -import RejectIcon from 'src/styling/icons/button/cancel/zodiac.svg?react' -import LinkIcon from 'src/styling/icons/month arrows/right.svg?react' - -import { ActionButton } from 'src/components/buttons' -import { white, disabledColor } from 'src/styling/variables' - -import DetailsCard from '../../Triggers/CustomInfoRequests/DetailsCard' -const styles = { - white: { - color: white - }, - actionButton: { - display: 'flex', - height: 28, - marginRight: 'auto' - }, - flex: { - display: 'flex' - }, - disabledBtn: { - backgroundColor: disabledColor, - '&:hover': { - backgroundColor: disabledColor - } - }, - linkIcon: { - marginTop: 12, - marginLeft: 4, - cursor: 'pointer' - } -} - -const SET_AUTHORIZED_REQUEST = gql` - mutation setAuthorizedCustomRequest( - $customerId: ID! - $infoRequestId: ID! - $override: String! - ) { - setAuthorizedCustomRequest( - customerId: $customerId - infoRequestId: $infoRequestId - override: $override - ) - } -` - -const useStyles = makeStyles(styles) -const CustomInfoRequestsData = ({ data }) => { - const classes = useStyles() - const [toView, setToView] = useState(null) - const [setAuthorized] = useMutation(SET_AUTHORIZED_REQUEST, { - onError: () => console.error('Error while clearing notification'), - refetchQueries: () => ['customer'] - }) - - const authorize = it => - setAuthorized({ - variables: { - customerId: it.customerId, - infoRequestId: it.customInfoRequest.id, - isAuthorized: true - } - }) - - const reject = it => - setAuthorized({ - variables: { - customerId: it.customerId, - infoRequestId: it.customInfoRequest.id, - isAuthorized: false - } - }) - - const getBtnClasses = (it, isAuthorize) => { - return { - [classes.actionButton]: true, - [classes.disabledBtn]: - (isAuthorize && it.approved === true) || - (!isAuthorize && it.approved === false) - } - } - - const AuthorizeButton = it => ( - authorize(it)}> - Authorize - - ) - - const RejectButton = it => ( - reject(it)}> - Reject - - ) - - const getActionButtons = it => { - return ( - <> - {AuthorizeButton(it)} - {RejectButton(it)} - - ) - } - - const getAuthorizedStatus = it => - it.approved === null - ? { label: 'Pending', type: 'neutral' } - : it.approved === false - ? { label: 'Rejected', type: 'error' } - : { label: 'Accepted', type: 'success' } - - return ( - <> -

Custom Info Requests Data

-
- - - - - - - - - {data.map((it, idx) => ( - - - - - - - - - ))} - -
Custom Request NameCustom Request DataStatus - Actions -
-
- {it.customInfoRequest.customRequest.name} -
setToView(it)}> - -
-
-
-
{JSON.stringify(it.customerData.data, null, 2)}
-
- - -
{getActionButtons(it)}
-
- {toView && ( - setToView(null)}> -

Custom Information Request Details

- -
- )} -
- - ) -} - -export default CustomInfoRequestsData diff --git a/new-lamassu-admin/src/pages/Customers/components/CustomerDetails.jsx b/new-lamassu-admin/src/pages/Customers/components/CustomerDetails.jsx index 3b285039..fb09c760 100644 --- a/new-lamassu-admin/src/pages/Customers/components/CustomerDetails.jsx +++ b/new-lamassu-admin/src/pages/Customers/components/CustomerDetails.jsx @@ -1,19 +1,13 @@ -import { makeStyles } from '@mui/styles' import * as R from 'ramda' import React, { memo } from 'react' import { H2, Label1, P } from 'src/components/typography' import IdIcon from 'src/styling/icons/ID/card/zodiac.svg?react' -import mainStyles from '../CustomersList.styles' import { getFormattedPhone, getName } from '../helper' import PhotosCard from './PhotosCard' -const useStyles = makeStyles(mainStyles) - const CustomerDetails = memo(({ customer, photosData, locale, timezone }) => { - const classes = useStyles() - const idNumber = R.path(['idCardData', 'documentNumber'])(customer) const usSsn = R.path(['usSsn'])(customer) const name = getName(customer) @@ -50,11 +44,11 @@ const CustomerDetails = memo(({ customer, photosData, locale, timezone }) => { }) return ( -
+
-
- +
+

{name.length ? name @@ -68,7 +62,7 @@ const CustomerDetails = memo(({ customer, photosData, locale, timezone }) => { {header} @@ -76,11 +70,7 @@ const CustomerDetails = memo(({ customer, photosData, locale, timezone }) => {

{elements.map(({ size, value }, idx) => ( -

+

{value}

))} diff --git a/new-lamassu-admin/src/pages/Customers/components/CustomerSidebar.jsx b/new-lamassu-admin/src/pages/Customers/components/CustomerSidebar.jsx index f35041ba..3b396d96 100644 --- a/new-lamassu-admin/src/pages/Customers/components/CustomerSidebar.jsx +++ b/new-lamassu-admin/src/pages/Customers/components/CustomerSidebar.jsx @@ -1,4 +1,3 @@ -import { makeStyles } from '@mui/styles' import classnames from 'classnames' import React from 'react' import CustomerDataReversedIcon from 'src/styling/icons/customer-nav/data/comet.svg?react' @@ -10,12 +9,9 @@ import OverviewIcon from 'src/styling/icons/customer-nav/overview/white.svg?reac import PhotosReversedIcon from 'src/styling/icons/customer-nav/photos/comet.svg?react' import Photos from 'src/styling/icons/customer-nav/photos/white.svg?react' -import styles from './CustomerSidebar.styles' - -const useStyles = makeStyles(styles) +import { P } from '/src/components/typography/index.jsx' const CustomerSidebar = ({ isSelected, onClick }) => { - const classes = useStyles() const sideBarOptions = [ { code: 'overview', @@ -44,19 +40,24 @@ const CustomerSidebar = ({ isSelected, onClick }) => { ] return ( -
+
{sideBarOptions?.map(({ Icon, InverseIcon, display, code }, idx) => (
onClick(code)}> -
- {isSelected(code) ? : } -
- {display} + {isSelected(code) ? : } +

+ {display} +

))}
diff --git a/new-lamassu-admin/src/pages/Customers/components/CustomerSidebar.styles.js b/new-lamassu-admin/src/pages/Customers/components/CustomerSidebar.styles.js deleted file mode 100644 index 9485c7f4..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/CustomerSidebar.styles.js +++ /dev/null @@ -1,41 +0,0 @@ -import typographyStyles from 'src/components/typography/styles' -import { zircon, offDarkColor, white } from 'src/styling/variables' - -const { tl2, p } = typographyStyles - -const sidebarColor = zircon - -export default { - sidebar: { - display: 'flex', - backgroundColor: sidebarColor, - width: 219, - flexDirection: 'column', - borderRadius: 5 - }, - link: { - alignItems: 'center', - display: 'flex', - extend: p, - position: 'relative', - color: offDarkColor, - padding: 15, - cursor: 'pointer' - }, - activeLink: { - display: 'flex', - alignItems: 'center', - extend: tl2, - color: white, - backgroundColor: offDarkColor, - '&:first-child': { - borderRadius: [[5, 5, 0, 0]] - }, - '&:last-child': { - borderRadius: [[0, 0, 5, 5]] - } - }, - icon: { - marginRight: 15 - } -} diff --git a/new-lamassu-admin/src/pages/Customers/components/EditableCard.jsx b/new-lamassu-admin/src/pages/Customers/components/EditableCard.jsx index 682ad41e..56e04f9d 100644 --- a/new-lamassu-admin/src/pages/Customers/components/EditableCard.jsx +++ b/new-lamassu-admin/src/pages/Customers/components/EditableCard.jsx @@ -1,18 +1,13 @@ import CardContent from '@mui/material/CardContent' import Card from '@mui/material/Card' -import Grid from '@mui/material/Grid' -import { makeStyles } from '@mui/styles' import classnames from 'classnames' import { Form, Formik, Field as FormikField } from 'formik' import * as R from 'ramda' import { useState, React, useRef } from 'react' -// import { HelpTooltip } from 'src/components/Tooltip' import ErrorMessage from 'src/components/ErrorMessage' import PromptWhenDirty from 'src/components/PromptWhenDirty' import { MainStatus } from 'src/components/Status' import { Label1, P, H3 } from 'src/components/typography' -import DeleteIcon from 'src/styling/icons/action/delete/enabled.svg?react' -import DeleteReversedIcon from 'src/styling/icons/action/delete/white.svg?react' import EditIcon from 'src/styling/icons/action/edit/enabled.svg?react' import EditReversedIcon from 'src/styling/icons/action/edit/white.svg?react' import AuthorizeIcon from 'src/styling/icons/button/authorize/white.svg?react' @@ -25,84 +20,34 @@ import SaveReversedIcon from 'src/styling/icons/circle buttons/save/white.svg?re import { ActionButton } from 'src/components/buttons' import { - OVERRIDE_AUTHORIZED, OVERRIDE_REJECTED, OVERRIDE_PENDING -} from 'src/pages/Customers/components/propertyCard' -import { comet } from 'src/styling/variables' +} from 'src/pages/Customers/components/consts' -import styles from './EditableCard.styles' - -const useStyles = makeStyles(styles) - -const fieldStyles = { - field: { - position: 'relative', - width: 280, - height: 48, - padding: [[0, 4, 4, 0]], - marginTop: 2 - }, - label: { - color: comet, - margin: [[0, 0, 0, 0]] - }, - notEditing: { - display: 'flex', - flexDirection: 'column', - '& > p:first-child': { - height: 16, - lineHeight: '16px', - transformOrigin: 'left', - paddingLeft: 0, - margin: [[3, 0, 3, 0]] - }, - '& > p:last-child': { - overflow: 'hidden', - whiteSpace: 'nowrap', - textOverflow: 'ellipsis', - margin: 0 - } - }, - editing: { - '& > div': { - '& > input': { - padding: 0, - fontSize: 14 - } - } - }, - readOnlyLabel: { - color: comet, - margin: [[3, 0, 3, 0]] - }, - readOnlyValue: { - margin: 0 - } +const ReadOnlyField = ({ field, value }) => { + return ( +
+ + {field.label} + +

+ {value} +

+
+ ) } -const fieldUseStyles = makeStyles(fieldStyles) - const EditableField = ({ editing, field, value, size, ...props }) => { - const classes = fieldUseStyles() - const classNames = { - [classes.field]: true, - [classes.notEditing]: !editing - } - + if (!editing) return return ( -
- {!editing && ( - <> - {field.label} -

{value}

- - )} +
{editing && ( <> - {field.label} + + {field.label} + { ) } -const ReadOnlyField = ({ field, value, ...props }) => { - const classes = fieldUseStyles() - const classNames = { - [classes.field]: true, - [classes.notEditing]: true - } - - return ( - <> -
- {field.label} -

{value}

-
- - ) -} - const EditableCard = ({ fields, save = () => {}, @@ -152,8 +80,6 @@ const EditableCard = ({ editable, checkAgainstSanctions }) => { - const classes = useStyles() - const formRef = useRef() const [editing, setEditing] = useState(false) @@ -162,12 +88,6 @@ const EditableCard = ({ const triggerInput = () => input.click() - const label1ClassNames = { - [classes.label1]: true, - [classes.label1Pending]: state === OVERRIDE_PENDING, - [classes.label1Rejected]: state === OVERRIDE_REJECTED, - [classes.label1Accepted]: state === OVERRIDE_AUTHORIZED - } const authorized = state === OVERRIDE_PENDING ? { label: 'Pending', type: 'neutral' } @@ -176,247 +96,211 @@ const EditableCard = ({ : { label: 'Accepted', type: 'success' } return ( -
- - -
-
- {titleIcon} -

{title}

- { - // TODO: Enable for next release - /* */ - } -
- {state && authorize && ( -
- -
- )} + + +
+
+ {titleIcon} +

{title}

- {children(formRef.current?.values ?? {})} - { - save(values) - setEditing(false) - }} - onReset={() => { - setEditing(false) - setError(false) - }}> - {({ setFieldValue }) => ( - - -
- - - {!hasImage && - fields?.map((field, idx) => { - return idx >= 0 && idx < 4 ? ( - !field.editable ? ( - - ) : ( - - ) - ) : null - })} - - - {!hasImage && - fields?.map((field, idx) => { - return idx >= 4 ? ( - !field.editable ? ( - - ) : ( - - ) - ) : null - })} - - + {state && authorize && } +
+ {children(formRef.current?.values ?? {})} + { + save(values) + setEditing(false) + }} + onReset={() => { + setEditing(false) + setError(false) + }}> + {({ setFieldValue }) => ( + + +
+
+ {!hasImage && + fields?.map((field, idx) => { + return idx >= 0 && idx < 4 ? ( + !field.editable ? ( + + ) : ( + + ) + ) : null + })}
-
- {!editing && ( -
-
- {/*{false && (*/} - {/* deleteEditedData()}>*/} - {/* Delete*/} - {/* */} - {/*)}*/} - {!hasAdditionalData && ( - retrieveAdditionalData()}> - Retrieve API data - - )} - {checkAgainstSanctions && ( - checkAgainstSanctions()}> - Check against OFAC sanction list - - )} -
- {editable && ( +
+ {!hasImage && + fields?.map((field, idx) => { + return idx >= 4 ? ( + !field.editable ? ( + + ) : ( + + ) + ) : null + })} +
+
+
+ {!editing && ( + <> + {!hasAdditionalData && ( + retrieveAdditionalData()}> + Retrieve API data + + )} + {checkAgainstSanctions && ( + checkAgainstSanctions()}> + Check against OFAC sanction list + + )} + {editable && ( + setEditing(true)}> + Edit + + )} + {!editable && + authorize && + authorized.label !== 'Accepted' && ( setEditing(true)}> - Edit + color="spring" + type="button" + Icon={AuthorizeIcon} + InverseIcon={AuthorizeIcon} + onClick={() => authorize()}> + Authorize )} - {!editable && - authorize && - authorized.label !== 'Accepted' && ( -
- authorize()}> - Authorize - + {!editable && + authorize && + authorized.label !== 'Rejected' && ( + reject()}> + Reject + + )} + + )} + {editing && ( + <> + {hasImage && state !== OVERRIDE_PENDING && ( + triggerInput()}> + { +
+ setInput(fileInput)} + onChange={event => { + // need to store it locally if we want to display it even after saving to db + const file = R.head(event.target.files) + if (!file) return + setFieldValue(R.head(fields).name, file) + }} + /> + Replace
- )} - {!editable && - authorize && - authorized.label !== 'Rejected' && ( - reject()}> - Reject - - )} -
- )} - {editing && ( -
-
- {hasImage && state !== OVERRIDE_PENDING && ( - triggerInput()}> - { -
- setInput(fileInput)} - onChange={event => { - // need to store it locally if we want to display it even after saving to db - const file = R.head(event.target.files) - if (!file) return - setFieldValue(R.head(fields).name, file) - }} - /> - Replace -
- } -
- )} -
-
- {fields && ( -
- - Save - -
- )} -
- cancel()} - type="reset"> - Cancel - -
- {authorize && authorized.label !== 'Accepted' && ( -
- authorize()}> - Authorize - -
- )} - {authorize && authorized.label !== 'Rejected' && ( - reject()}> - Reject - - )} - {error && ( - Failed to save changes - )} -
-
- )} -
- - )} - - - -
+ } + + )} + {fields && ( + + Save + + )} + cancel()} + type="reset"> + Cancel + + {authorize && authorized.label !== 'Accepted' && ( + authorize()}> + Authorize + + )} + {authorize && authorized.label !== 'Rejected' && ( + reject()}> + Reject + + )} + {error && ( + Failed to save changes + )} + + )} +
+ + )} +
+ + ) } diff --git a/new-lamassu-admin/src/pages/Customers/components/EditableCard.styles.js b/new-lamassu-admin/src/pages/Customers/components/EditableCard.styles.js deleted file mode 100644 index 3ef803d2..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/EditableCard.styles.js +++ /dev/null @@ -1,70 +0,0 @@ -import { tomato, spring4, comet } from 'src/styling/variables' - -export default { - label1: { - display: 'flex', - width: 85, - justifyContent: 'right' - }, - label1Pending: { - color: comet - }, - label1Rejected: { - color: tomato - }, - label1Accepted: { - color: spring4 - }, - editButton: { - marginTop: 20, - display: 'flex', - justifyContent: 'right' - }, - deleteButton: { - marginRight: 8 - }, - headerWrapper: { - display: 'flex', - flexDirection: 'row', - justifyContent: 'space-between', - height: 40 - }, - editingWrapper: { - display: 'flex', - flexDirection: 'row', - justifyContent: 'space-between', - marginTop: 20 - }, - replace: { - marginRight: 5 - }, - input: { - display: 'none' - }, - button: { - marginRight: 5 - }, - editingButtons: { - display: 'flex', - justifyContent: 'right' - }, - card: { - borderRadius: 10, - marginRight: 15, - marginBottom: 15 - }, - cardHeader: { - display: 'flex', - flexDirection: 'row', - marginBottom: 15 - }, - editIcon: { - marginTop: 5 - }, - cardIcon: { - marginTop: 7 - }, - cardTitle: { - margin: [[8, 15, 15, 15]] - } -} diff --git a/new-lamassu-admin/src/pages/Customers/components/Field.jsx b/new-lamassu-admin/src/pages/Customers/components/Field.jsx deleted file mode 100644 index 7992773d..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/Field.jsx +++ /dev/null @@ -1,38 +0,0 @@ -import { makeStyles } from '@mui/styles' -import classnames from 'classnames' -import React, { memo } from 'react' -import { Info3, Label1 } from 'src/components/typography' - -import { comet } from 'src/styling/variables' - -const useStyles = makeStyles({ - field: { - height: 46 - }, - label: { - color: comet, - margin: [[0, 3]] - }, - value: { - whiteSpace: 'nowrap', - overflow: 'hidden', - textOverflow: 'ellipsis', - margin: 0, - paddingLeft: 4 - } -}) - -const Field = memo(({ label, display, size, className }) => { - const classes = useStyles() - - return ( -
- {label} - {display} -
- ) -}) - -export default Field diff --git a/new-lamassu-admin/src/pages/Customers/components/FrontCameraPhoto.jsx b/new-lamassu-admin/src/pages/Customers/components/FrontCameraPhoto.jsx deleted file mode 100644 index 4dcee494..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/FrontCameraPhoto.jsx +++ /dev/null @@ -1,28 +0,0 @@ -import Paper from '@mui/material/Paper' -import { makeStyles } from '@mui/styles' -import React, { memo } from 'react' -import CrossedCameraIcon from 'src/styling/icons/ID/photo/crossed-camera.svg?react' - -import mainStyles from '../CustomersList.styles' - -const useStyles = makeStyles(mainStyles) - -const FrontCameraPhoto = memo(({ frontCameraPath }) => { - const classes = useStyles() - - return ( - - {frontCameraPath ? ( - - ) : ( - - )} - - ) -}) - -export default FrontCameraPhoto diff --git a/new-lamassu-admin/src/pages/Customers/components/IdCardPhotoCard.jsx b/new-lamassu-admin/src/pages/Customers/components/IdCardPhotoCard.jsx deleted file mode 100644 index 9433c255..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/IdCardPhotoCard.jsx +++ /dev/null @@ -1,52 +0,0 @@ -import { makeStyles } from '@mui/styles' -import * as R from 'ramda' -import React, { memo } from 'react' -import CrossedCameraIcon from 'src/styling/icons/ID/photo/crossed-camera.svg?react' - -import { - PropertyCard, - OVERRIDE_AUTHORIZED, - OVERRIDE_REJECTED -} from 'src/pages/Customers/components/propertyCard' - -const useStyles = makeStyles({ - idCardPhotoCard: { - width: 325, - height: 240, - margin: [[32, 0, 0, 0]] - }, - idCardPhoto: { - maxHeight: 130 - }, - field: { - marginLeft: 14 - } -}) - -const IdCardPhotoCard = memo(({ customerData, updateCustomer }) => { - const classes = useStyles() - - return ( - - updateCustomer({ idCardPhotoOverride: OVERRIDE_AUTHORIZED }) - } - reject={() => updateCustomer({ idCardPhotoOverride: OVERRIDE_REJECTED })}> -
- {customerData.idCardPhotoPath ? ( - - ) : ( - - )} -
-
- ) -}) - -export default IdCardPhotoCard diff --git a/new-lamassu-admin/src/pages/Customers/components/IdDataCard.jsx b/new-lamassu-admin/src/pages/Customers/components/IdDataCard.jsx deleted file mode 100644 index 1cb0fb73..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/IdDataCard.jsx +++ /dev/null @@ -1,88 +0,0 @@ -import { differenceInYears, format, parse } from 'date-fns/fp' -import * as R from 'ramda' -import React, { memo } from 'react' - -import { - PropertyCard, - OVERRIDE_AUTHORIZED, - OVERRIDE_REJECTED -} from 'src/pages/Customers/components/propertyCard' -import { ifNotNull } from 'src/utils/nullCheck' - -import { getName } from '../helper' - -import Field from './Field' - -const IdDataCard = memo(({ customerData, updateCustomer }) => { - const idData = R.path(['idCardData'])(customerData) - const rawExpirationDate = R.path(['expirationDate'])(idData) - const country = R.path(['country'])(idData) - const rawDob = R.path(['dateOfBirth'])(idData) - - const elements = [ - { - header: 'Name', - display: `${getName(customerData)}`, - size: 190 - }, - { - header: 'ID number', - display: R.path(['documentNumber'])(idData), - size: 160 - }, - { - header: 'Birth date', - display: - (rawDob && - format('yyyy-MM-dd')(parse(new Date(), 'yyyyMMdd', rawDob))) ?? - '', - size: 110 - }, - { - header: 'Age', - display: - (rawDob && - differenceInYears( - parse(new Date(), 'yyyyMMdd', rawDob), - new Date() - )) ?? - '', - size: 50 - }, - { - header: 'Gender', - display: R.path(['gender'])(idData) ?? R.path(['sex'])(idData), - size: 80 - }, - { - header: country === 'Canada' ? 'Province' : 'State', - display: R.path(['state'])(idData), - size: 120 - }, - { - header: 'Expiration date', - display: ifNotNull( - rawExpirationDate, - format('yyyy-MM-dd', rawExpirationDate) - ) - } - ] - - return ( - - updateCustomer({ idCardDataOverride: OVERRIDE_AUTHORIZED }) - } - reject={() => updateCustomer({ idCardDataOverride: OVERRIDE_REJECTED })}> -
- {elements.map(({ header, display, size }, idx) => ( - - ))} -
-
- ) -}) - -export default IdDataCard diff --git a/new-lamassu-admin/src/pages/Customers/components/PhoneCard.jsx b/new-lamassu-admin/src/pages/Customers/components/PhoneCard.jsx deleted file mode 100644 index 74dcd3f5..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/PhoneCard.jsx +++ /dev/null @@ -1,36 +0,0 @@ -import { parsePhoneNumberFromString } from 'libphonenumber-js' -import * as R from 'ramda' -import React, { memo } from 'react' - -import { - PropertyCard, - OVERRIDE_AUTHORIZED, - OVERRIDE_REJECTED -} from 'src/pages/Customers/components/propertyCard' - -import Field from './Field' - -const PhoneCard = memo( - ({ className, customerData, updateCustomer, locale }) => ( - updateCustomer({ smsOverride: OVERRIDE_AUTHORIZED })} - reject={() => updateCustomer({ smsOverride: OVERRIDE_REJECTED })}> - - - ) -) - -export default PhoneCard diff --git a/new-lamassu-admin/src/pages/Customers/components/PhotosCard.jsx b/new-lamassu-admin/src/pages/Customers/components/PhotosCard.jsx index 542ebeb4..dd72a435 100644 --- a/new-lamassu-admin/src/pages/Customers/components/PhotosCard.jsx +++ b/new-lamassu-admin/src/pages/Customers/components/PhotosCard.jsx @@ -1,20 +1,14 @@ import ButtonBase from '@mui/material/ButtonBase' import Paper from '@mui/material/Card' -import { makeStyles } from '@mui/styles' import * as R from 'ramda' import React, { memo, useState } from 'react' import { InformativeDialog } from 'src/components/InformativeDialog' import { Info2 } from 'src/components/typography' import CrossedCameraIcon from 'src/styling/icons/ID/photo/crossed-camera.svg?react' -import styles from './PhotosCard.styles' import PhotosCarousel from './PhotosCarousel' -const useStyles = makeStyles(styles) - const PhotosCard = memo(({ photosData, timezone }) => { - const classes = useStyles() - const [photosDialog, setPhotosDialog] = useState(false) const sortedPhotosData = R.sortWith( @@ -26,24 +20,24 @@ const PhotosCard = memo(({ photosData, timezone }) => { return ( <> - + { setPhotosDialog(true) }}> {singlePhoto ? ( -
+
- -
- {sortedPhotosData.length} -
+
+ + {sortedPhotosData.length}
) : ( diff --git a/new-lamassu-admin/src/pages/Customers/components/PhotosCard.styles.js b/new-lamassu-admin/src/pages/Customers/components/PhotosCard.styles.js deleted file mode 100644 index 5d974078..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/PhotosCard.styles.js +++ /dev/null @@ -1,42 +0,0 @@ -import { zircon, backgroundColor } from 'src/styling/variables' - -export default { - photo: { - width: 135, - height: 135, - borderRadius: 8, - backgroundColor: zircon, - margin: [[0, 28, 0, 0]], - alignItems: 'center', - justifyContent: 'center', - display: 'flex' - }, - img: { - objectFit: 'cover', - objectPosition: 'center', - width: 135, - height: 135 - }, - container: { - position: 'relative', - '& > img': { - display: 'block' - }, - '& > circle': { - position: 'absolute', - top: '0', - right: '0', - marginRight: 5, - marginTop: 5 - } - }, - circle: { - background: backgroundColor, - borderRadius: '50%', - width: 25, - height: 25, - alignItems: 'center', - justifyContent: 'center', - display: 'flex' - } -} diff --git a/new-lamassu-admin/src/pages/Customers/components/PhotosCarousel.jsx b/new-lamassu-admin/src/pages/Customers/components/PhotosCarousel.jsx index 6b4a8337..e8855dec 100644 --- a/new-lamassu-admin/src/pages/Customers/components/PhotosCarousel.jsx +++ b/new-lamassu-admin/src/pages/Customers/components/PhotosCarousel.jsx @@ -1,4 +1,3 @@ -import { makeStyles } from '@mui/styles' import * as R from 'ramda' import React, { memo, useState } from 'react' import { Carousel } from 'src/components/Carousel' @@ -8,35 +7,34 @@ import { formatDate } from 'src/utils/timezones' import CopyToClipboard from '../../Transactions/CopyToClipboard' -import styles from './PhotosCarousel.styles' - -const useStyles = makeStyles(styles) - const PhotosCarousel = memo(({ photosData, timezone }) => { - const classes = useStyles() const [currentIndex, setCurrentIndex] = useState(0) const Label = ({ children }) => { - const classes = useStyles() - return {children} + return ( + + {children} + + ) } const isFaceCustomerPhoto = !R.has('id')(photosData[currentIndex]) const slidePhoto = index => setCurrentIndex(index) + // TODO hide copy to clipboard shit return ( <> {!isFaceCustomerPhoto && ( -
+
{photosData && photosData[currentIndex]?.id}
)} -
+
<> diff --git a/new-lamassu-admin/src/pages/Customers/components/PhotosCarousel.styles.js b/new-lamassu-admin/src/pages/Customers/components/PhotosCarousel.styles.js deleted file mode 100644 index 03d3f755..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/PhotosCarousel.styles.js +++ /dev/null @@ -1,30 +0,0 @@ -import typographyStyles from 'src/components/typography/styles' -import { offColor } from 'src/styling/variables' - -const { p } = typographyStyles - -export default { - label: { - color: offColor, - margin: [[0, 0, 6, 0]] - }, - firstRow: { - padding: [[8]], - display: 'flex', - flexDirection: 'column' - }, - secondRow: { - extend: p, - display: 'flex', - padding: [[8]], - '& > div': { - display: 'flex', - flexDirection: 'column', - '& > div': { - height: 37, - marginBottom: 15, - marginRight: 55 - } - } - } -} diff --git a/new-lamassu-admin/src/pages/Customers/components/TransactionsList.jsx b/new-lamassu-admin/src/pages/Customers/components/TransactionsList.jsx index aa8ea43a..d6384bc3 100644 --- a/new-lamassu-admin/src/pages/Customers/components/TransactionsList.jsx +++ b/new-lamassu-admin/src/pages/Customers/components/TransactionsList.jsx @@ -1,7 +1,5 @@ import { toUnit } from '@lamassu/coins/lightUtils' -import { makeStyles } from '@mui/styles' import BigNumber from 'bignumber.js' -import classnames from 'classnames' import * as R from 'ramda' import React from 'react' import DataTable from 'src/components/tables/DataTable' @@ -13,21 +11,13 @@ import { ifNotNull } from 'src/utils/nullCheck' import { formatDate } from 'src/utils/timezones' import CopyToClipboard from '../../Transactions/CopyToClipboard' -import mainStyles from '../CustomersList.styles' - -const useStyles = makeStyles(mainStyles) const TransactionsList = ({ customer, data, loading }) => { - const classes = useStyles() const LastTxIcon = customer.lastTxClass === 'cashOut' ? TxOutIcon : TxInIcon const hasData = !(R.isEmpty(data) || R.isNil(data)) const { lastUsedMachineName } = customer const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone - const tableSpacingClasses = { - [classes.titleAndButtonsContainer]: loading || (!loading && !hasData), - [classes.txTableSpacing]: !loading && hasData - } const summaryElements = [ { @@ -61,7 +51,7 @@ const TransactionsList = ({ customer, data, loading }) => { value: ifNotNull( customer.lastTxFiat, <> - + {`${Number.parseFloat(customer.lastTxFiat)} ${customer.lastTxFiatCode}`} @@ -80,9 +70,9 @@ const TransactionsList = ({ customer, data, loading }) => { view: it => ( <> {it.txClass === 'cashOut' ? ( - + ) : ( - + )} ) @@ -96,7 +86,9 @@ const TransactionsList = ({ customer, data, loading }) => { header: 'Transaction ID', width: 145, view: it => ( - {it.id} + + {it.id} + ) }, { @@ -144,7 +136,7 @@ const TransactionsList = ({ customer, data, loading }) => { {header} @@ -152,28 +144,21 @@ const TransactionsList = ({ customer, data, loading }) => {
{summaryElements.map(({ size, value }, idx) => ( -

+

{value}

))}
-
-
- {loading ? ( -

Loading

- ) : hasData ? ( - '' - ) : ( -

No transactions so far

- )} -
+
+ {loading ? ( +

Loading

+ ) : hasData ? ( + + ) : ( +

No transactions so far

+ )}
- {hasData && } ) } diff --git a/new-lamassu-admin/src/pages/Customers/components/Upload.jsx b/new-lamassu-admin/src/pages/Customers/components/Upload.jsx index e2f63e7b..1e81c289 100644 --- a/new-lamassu-admin/src/pages/Customers/components/Upload.jsx +++ b/new-lamassu-admin/src/pages/Customers/components/Upload.jsx @@ -1,4 +1,3 @@ -import { makeStyles } from '@mui/styles' import { useFormikContext } from 'formik' import * as R from 'ramda' import React, { useState, useCallback } from 'react' @@ -7,42 +6,9 @@ import { Label3, H3 } from 'src/components/typography' import UploadPhotoIcon from 'src/styling/icons/button/photo/zodiac-resized.svg?react' import UploadFileIcon from 'src/styling/icons/button/upload-file/zodiac-resized.svg?react' -import { offColor, subheaderColor } from 'src/styling/variables' - -const useStyles = makeStyles({ - box: { - boxSizing: 'border-box', - width: 450, - height: 120, - borderStyle: 'dashed', - borderColor: offColor, - borderRadius: 4, - borderWidth: 1, - backgroundColor: subheaderColor, - display: 'flex', - justifyContent: 'center' - }, - inputContent: { - marginTop: 35, - display: 'flex' - }, - uploadContent: { - marginTop: 50, - display: 'flex' - }, - board: { - marginTop: 40, - width: 450, - height: 120 - }, - icon: { - margin: [[14, 20, 0, 0]] - } -}) +import classes from './Upload.module.css' const Upload = ({ type }) => { - const classes = useStyles() - const [data, setData] = useState({}) const { setFieldValue } = useFormikContext() @@ -71,20 +37,14 @@ const Upload = ({ type }) => { return ( <> -
+
{R.isEmpty(data) && (
-
- {isImage ? ( - - ) : ( - - )} - {`Drag and drop ${ - isImage ? 'an image' : 'a file' - } or click to open the explorer`} -
+ {isImage ? : } + {`Drag and drop ${ + isImage ? 'an image' : 'a file' + } or click to open the explorer`}
)} {!R.isEmpty(data) && isImage && ( @@ -94,7 +54,7 @@ const Upload = ({ type }) => { )} {!R.isEmpty(data) && !isImage && (
-

{data.preview}

+

{data.preview}

)}
diff --git a/new-lamassu-admin/src/pages/Customers/components/Upload.module.css b/new-lamassu-admin/src/pages/Customers/components/Upload.module.css new file mode 100644 index 00000000..3f7955df --- /dev/null +++ b/new-lamassu-admin/src/pages/Customers/components/Upload.module.css @@ -0,0 +1,14 @@ +.box { + box-sizing: border-box; + width: 450px; + height: 120px; + border-style: dashed; + border-color: var(--comet); + border-radius: 4px; + border-width: 1px; + background-color: var(--zircon); + display: flex; + justify-content: center; + align-items: center; + gap: 20px; +} diff --git a/new-lamassu-admin/src/pages/Customers/components/consts.js b/new-lamassu-admin/src/pages/Customers/components/consts.js new file mode 100644 index 00000000..5cec0f8b --- /dev/null +++ b/new-lamassu-admin/src/pages/Customers/components/consts.js @@ -0,0 +1,5 @@ +const OVERRIDE_PENDING = 'automatic' +const OVERRIDE_AUTHORIZED = 'verified' +const OVERRIDE_REJECTED = 'blocked' + +export { OVERRIDE_PENDING, OVERRIDE_AUTHORIZED, OVERRIDE_REJECTED } diff --git a/new-lamassu-admin/src/pages/Customers/components/index.js b/new-lamassu-admin/src/pages/Customers/components/index.js index 7e3c3e19..448efe76 100644 --- a/new-lamassu-admin/src/pages/Customers/components/index.js +++ b/new-lamassu-admin/src/pages/Customers/components/index.js @@ -3,19 +3,13 @@ import Wizard from '../Wizard' import CustomerDetails from './CustomerDetails' import CustomerSidebar from './CustomerSidebar' import EditableCard from './EditableCard' -import Field from './Field' -import IdDataCard from './IdDataCard' -import PhotosCarousel from './PhotosCarousel' import TransactionsList from './TransactionsList' import Upload from './Upload' export { - PhotosCarousel, CustomerDetails, - IdDataCard, TransactionsList, CustomerSidebar, - Field, EditableCard, Wizard, Upload diff --git a/new-lamassu-admin/src/pages/Customers/components/notes/NewNoteCard.jsx b/new-lamassu-admin/src/pages/Customers/components/notes/NewNoteCard.jsx index 9bef903a..a3c568e8 100644 --- a/new-lamassu-admin/src/pages/Customers/components/notes/NewNoteCard.jsx +++ b/new-lamassu-admin/src/pages/Customers/components/notes/NewNoteCard.jsx @@ -1,23 +1,16 @@ import Paper from '@mui/material/Paper' -import { makeStyles } from '@mui/styles' -import classNames from 'classnames' import { React } from 'react' import { P } from 'src/components/typography' import AddIcon from 'src/styling/icons/button/add/zodiac.svg?react' -import styles from './NoteCard.styles' - -const useStyles = makeStyles(styles) - const NewNoteCard = ({ setOpenModal }) => { - const classes = useStyles() return ( -
setOpenModal(true)}> - - -

Add new

-
-
+ setOpenModal(true)}> + +

Add new

+
) } diff --git a/new-lamassu-admin/src/pages/Customers/components/notes/NewNoteModal.jsx b/new-lamassu-admin/src/pages/Customers/components/notes/NewNoteModal.jsx index 6325bb7d..5725472a 100644 --- a/new-lamassu-admin/src/pages/Customers/components/notes/NewNoteModal.jsx +++ b/new-lamassu-admin/src/pages/Customers/components/notes/NewNoteModal.jsx @@ -1,4 +1,3 @@ -import { makeStyles } from '@mui/styles' import { Form, Formik, Field } from 'formik' import { React } from 'react' import ErrorMessage from 'src/components/ErrorMessage' @@ -8,10 +7,6 @@ import * as Yup from 'yup' import { Button } from 'src/components/buttons' import { TextInput } from 'src/components/inputs/formik' -import styles from './NewNoteModal.styles' - -const useStyles = makeStyles(styles) - const initialValues = { title: '', content: '' @@ -23,8 +18,6 @@ const validationSchema = Yup.object().shape({ }) const NewNoteModal = ({ showModal, onClose, onSubmit, errorMsg }) => { - const classes = useStyles() - return ( <> { onSubmit={({ title, content }) => { onSubmit({ title, content }) }}> -
+ { rows={11} label="Note content" /> -
+
{errorMsg && {errorMsg}} -
diff --git a/new-lamassu-admin/src/pages/Customers/components/notes/NewNoteModal.styles.js b/new-lamassu-admin/src/pages/Customers/components/notes/NewNoteModal.styles.js deleted file mode 100644 index a42ecd41..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/notes/NewNoteModal.styles.js +++ /dev/null @@ -1,25 +0,0 @@ -import { spacer } from 'src/styling/variables' - -const styles = { - form: { - display: 'flex', - flexDirection: 'column', - height: '100%', - '& > *': { - marginTop: 20 - }, - '& > *:last-child': { - marginTop: 'auto' - } - }, - submit: { - margin: [['auto', 0, 0, 'auto']] - }, - footer: { - display: 'flex', - flexDirection: 'row', - margin: [['auto', 0, spacer * 3, 0]] - } -} - -export default styles diff --git a/new-lamassu-admin/src/pages/Customers/components/notes/NoteCard.jsx b/new-lamassu-admin/src/pages/Customers/components/notes/NoteCard.jsx index c4a4f21a..912e0d95 100644 --- a/new-lamassu-admin/src/pages/Customers/components/notes/NoteCard.jsx +++ b/new-lamassu-admin/src/pages/Customers/components/notes/NoteCard.jsx @@ -1,5 +1,4 @@ import Paper from '@mui/material/Paper' -import { makeStyles } from '@mui/styles' import * as R from 'ramda' import { React } from 'react' import { H3, P } from 'src/components/typography' @@ -7,10 +6,6 @@ import DeleteIcon from 'src/styling/icons/action/delete/enabled.svg?react' import { formatDate } from 'src/utils/timezones' -import styles from './NoteCard.styles' - -const useStyles = makeStyles(styles) - const formatContent = content => { const fragments = R.split(/\n/)(content) return R.map((it, idx) => { @@ -25,31 +20,28 @@ const formatContent = content => { } const NoteCard = ({ note, deleteNote, handleClick, timezone }) => { - const classes = useStyles() - return ( -
- handleClick(note)}> -
-
-

{note?.title}

-

{formatDate(note?.created, timezone, 'yyyy-MM-dd')}

-
-
- { - e.stopPropagation() - deleteNote({ noteId: note.id }) - }} - /> -
+ handleClick(note)}> +
+
+

{note?.title}

+

{formatDate(note?.created, timezone, 'yyyy-MM-dd')}

-

- {formatContent(note?.content)} -

- -
+
+ { + e.stopPropagation() + deleteNote({ noteId: note.id }) + }} + /> +
+
+

+ {formatContent(note?.content)} +

+
) } diff --git a/new-lamassu-admin/src/pages/Customers/components/notes/NoteCard.styles.js b/new-lamassu-admin/src/pages/Customers/components/notes/NoteCard.styles.js deleted file mode 100644 index 9712fa77..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/notes/NoteCard.styles.js +++ /dev/null @@ -1,93 +0,0 @@ -import { zircon } from 'src/styling/variables' - -const styles = { - noteCardWrapper: { - flexGrow: 0, - flexShrink: 0, - flexBasis: `25%`, - minWidth: 0, - maxWidth: 500, - '&:nth-child(4n+1)': { - '& > div': { - margin: [[0, 10, 0, 0]] - } - }, - '&:nth-child(4n)': { - '& > div': { - margin: [[0, 0, 0, 10]] - } - }, - margin: [[10, 0]] - }, - noteCardChip: { - height: 200, - margin: [[0, 10]], - padding: [[10, 10]], - cursor: 'pointer' - }, - newNoteCard: { - backgroundColor: zircon, - display: 'flex', - flexDirection: 'column', - justifyContent: 'center', - alignItems: 'center' - }, - noteCardHeader: { - display: 'flex', - flexDirection: 'row', - justifyContent: 'space-between', - width: '100%' - }, - noteCardTitle: { - overflow: 'hidden', - whiteSpace: 'nowrap', - textOverflow: 'ellipsis', - marginRight: 10 - }, - noteCardContent: { - display: 'box', - lineClamp: 7, - boxOrient: 'vertical', - margin: [[15, 0]], - overflow: 'hidden', - textOverflow: 'ellipsis', - wordWrap: 'break-word' - }, - editCardChip: { - height: 325, - padding: 15 - }, - editCardHeader: { - display: 'flex', - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'center', - marginBottom: 15 - }, - editCardActions: { - display: 'flex', - flexDirection: 'row', - alignItems: 'center', - '& > *': { - marginRight: 10 - }, - '& > *:last-child': { - marginRight: 0 - } - }, - editNotesContent: { - '& > div': { - '&:after': { - borderBottom: 'none' - }, - '&:before': { - borderBottom: 'none' - }, - '&:hover:not(.Mui-disabled)::before': { - borderBottom: 'none' - } - } - } -} - -export default styles diff --git a/new-lamassu-admin/src/pages/Customers/components/notes/NoteEdit.jsx b/new-lamassu-admin/src/pages/Customers/components/notes/NoteEdit.jsx index 3fac6309..ea9f8ca3 100644 --- a/new-lamassu-admin/src/pages/Customers/components/notes/NoteEdit.jsx +++ b/new-lamassu-admin/src/pages/Customers/components/notes/NoteEdit.jsx @@ -1,5 +1,4 @@ import Paper from '@mui/material/Paper' -import { makeStyles } from '@mui/styles' import { formatDurationWithOptions, intervalToDuration } from 'date-fns/fp' import { Form, Formik, Field } from 'formik' import { React, useRef } from 'react' @@ -14,13 +13,8 @@ import { ActionButton } from 'src/components/buttons' import { TextInput } from 'src/components/inputs/formik' import { toTimezone } from 'src/utils/timezones' -import styles from './NoteCard.styles' - -const useStyles = makeStyles(styles) - const NoteEdit = ({ note, cancel, edit, timezone }) => { const formRef = useRef() - const classes = useStyles() const validationSchema = Yup.object().shape({ content: Yup.string() @@ -31,8 +25,8 @@ const NoteEdit = ({ note, cancel, edit, timezone }) => { } return ( - -
+ +

{`Last edited `} {formatDurationWithOptions( @@ -44,7 +38,7 @@ const NoteEdit = ({ note, cancel, edit, timezone }) => { )} {` ago`}

-
+
{ { - const classes = useStyles() - - 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 RejectButton = () => ( - reject()}> - Reject - - ) - - const EditButton = () => ( - edit()}> - Edit - - ) - - const ConfirmButton = () => ( - - Confirm - - ) - - const authorized = - state === OVERRIDE_PENDING - ? { label: 'Pending', type: 'neutral' } - : state === OVERRIDE_REJECTED - ? { label: 'Rejected', type: 'error' } - : { label: 'Accepted', type: 'success' } - - return ( - -

{title}

-
- {state && ( -
- -
- )} - {children} -
- {authorize && state !== OVERRIDE_AUTHORIZED && AuthorizeButton()} - {reject && state !== OVERRIDE_REJECTED && RejectButton()} - {edit && !isEditing && EditButton()} - {confirm && isEditing && ConfirmButton()} -
-
-
- ) - } -) - -export { - PropertyCard, - OVERRIDE_PENDING, - OVERRIDE_AUTHORIZED, - OVERRIDE_REJECTED -} 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 deleted file mode 100644 index ff8b334f..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/propertyCard/PropertyCard.styles.js +++ /dev/null @@ -1,69 +0,0 @@ -import { white, tomato, spring4, comet } from 'src/styling/variables' - -const propertyCardStyles = { - label1: { - display: 'flex', - marginBottom: 2, - marginTop: 'auto', - width: 85 - }, - label1Pending: { - color: comet - }, - label1Rejected: { - color: tomato - }, - label1Accepted: { - color: spring4 - }, - cardActionButton: { - display: 'flex', - height: 28, - marginRight: 'auto', - marginLeft: 12 - }, - propertyCardTopRow: { - display: 'flex', - margin: [[0, 10, 5, 0]] - }, - propertyCardBottomRow: { - display: 'flex', - flexDirection: 'row', - height: 45 - }, - propertyCard: { - display: 'flex', - flexDirection: 'column', - borderRadius: 8, - width: '100%', - height: 100, - padding: [[20]], - boxSizing: 'border-box', - boxShadow: '0 0 8px 0 rgba(0, 0, 0, 0.04)', - border: 'solid 0', - backgroundColor: white, - margin: [[20, 0, 0, 0]] - }, - rowSpaceBetween: { - display: 'flex', - flexFlow: 'row nowrap', - alignItems: 'center', - justifyContent: 'space-between' - }, - columnSpaceBetween: { - display: 'flex', - flexFlow: 'column nowrap', - alignItems: 'center', - justifyContent: 'space-between', - width: 90 - }, - buttonsWrapper: { - display: 'flex', - flexDirection: 'row', - justifyContent: 'flex-end', - marginLeft: 'auto', - marginTop: 'auto' - } -} - -export { propertyCardStyles } diff --git a/new-lamassu-admin/src/pages/Customers/components/propertyCard/index.js b/new-lamassu-admin/src/pages/Customers/components/propertyCard/index.js deleted file mode 100644 index 3002e26a..00000000 --- a/new-lamassu-admin/src/pages/Customers/components/propertyCard/index.js +++ /dev/null @@ -1,13 +0,0 @@ -import { - PropertyCard, - OVERRIDE_PENDING, - OVERRIDE_AUTHORIZED, - OVERRIDE_REJECTED -} from './PropertyCard' - -export { - PropertyCard, - OVERRIDE_PENDING, - OVERRIDE_AUTHORIZED, - OVERRIDE_REJECTED -} diff --git a/new-lamassu-admin/src/pages/Customers/helper.jsx b/new-lamassu-admin/src/pages/Customers/helper.jsx index 6bb774b1..ca672fc7 100644 --- a/new-lamassu-admin/src/pages/Customers/helper.jsx +++ b/new-lamassu-admin/src/pages/Customers/helper.jsx @@ -1,6 +1,4 @@ import React from 'react' -import { makeStyles } from '@mui/styles' -import classnames from 'classnames' import { parse, isValid, format } from 'date-fns/fp' import { Field, useFormikContext } from 'formik' import { parsePhoneNumberFromString } from 'libphonenumber-js' @@ -14,45 +12,10 @@ import { TextInput, Autocomplete } from 'src/components/inputs/formik' -import { errorColor } from 'src/styling/variables' import { MANUAL } from 'src/utils/constants' import { Upload } from './components' -const useStyles = makeStyles({ - radio: { - padding: 4, - margin: 4 - }, - radioGroup: { - flexDirection: 'row' - }, - error: { - color: errorColor - }, - specialLabel: { - height: 40, - padding: 0, - width: 250 - }, - label: { - height: 40, - padding: 0 - }, - specialGrid: { - display: 'grid', - gridTemplateColumns: [[182, 162, 141]] - }, - picker: { - width: 150 - }, - field: { - '& > *:last-child': { - marginBottom: 24 - } - } -}) - const CUSTOMER_BLOCKED = 'blocked' const CUSTOM = 'custom' const REQUIREMENT = 'requirement' @@ -215,68 +178,50 @@ const updateRequirementOptions = it => [ ] const EntryType = ({ customInfoRequirementOptions }) => { - const classes = useStyles() const { values } = useFormikContext() const displayCustomOptions = values.entryType === CUSTOM const displayRequirementOptions = values.entryType === REQUIREMENT - return ( - <> + const Entry = ({ title, name, options, className }) => ( +
-

Type of entry

+

{title}

+
+ ) + + return ( + <> + {displayCustomOptions && ( -
-
-

Type of data

-
- -
+ )} {displayRequirementOptions && ( -
-
-

Requirements

-
- -
+ )} ) } const ManualDataEntry = ({ selectedValues, customInfoRequirementOptions }) => { - const classes = useStyles() - const typeOfEntrySelected = selectedValues?.entryType const dataTypeSelected = selectedValues?.dataType const requirementSelected = selectedValues?.requirement @@ -316,14 +261,14 @@ const ManualDataEntry = ({ selectedValues, customInfoRequirementOptions }) => { {}} /> )} -
+
{!upload && !isCustomInfoRequirement && elements.options.map(({ label, name }, idx) => ( diff --git a/new-lamassu-admin/src/pages/Transactions/CopyToClipboard.jsx b/new-lamassu-admin/src/pages/Transactions/CopyToClipboard.jsx index 306111f5..021b6a65 100644 --- a/new-lamassu-admin/src/pages/Transactions/CopyToClipboard.jsx +++ b/new-lamassu-admin/src/pages/Transactions/CopyToClipboard.jsx @@ -16,6 +16,7 @@ const CopyToClipboard = ({ className, buttonClassname, children, + variant, wrapperClassname, removeSpace = true, ...props @@ -71,7 +72,7 @@ const CopyToClipboard = ({ )}
- ); + ) } export default CopyToClipboard diff --git a/new-lamassu-admin/src/styling/global/global.css b/new-lamassu-admin/src/styling/global/global.css index 5c8432f6..9186c0ca 100644 --- a/new-lamassu-admin/src/styling/global/global.css +++ b/new-lamassu-admin/src/styling/global/global.css @@ -27,6 +27,10 @@ --neon: #5a67ff; --malachite: #00CD5A; --orange-yellow: #ffcc00; + + --mont: 'Mont'; + --museo: 'MuseoSans'; + --bpmono: 'BPmono'; } @theme { @@ -44,6 +48,13 @@ --color-neon: var(--neon); --color-malachite: var(--malachite); --color-orange-yellow: var(--orange-yellow); + --font-mont: var(--mont); + --font-museo: var(--museo); + --font-bpmono: var(--bpmono); +} + +@utility col-span-all { + column-span: all; } body {