From bcda2751775fc07ccb190559cfc4bd398edd7b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Salgado?= Date: Tue, 21 Dec 2021 19:37:26 +0000 Subject: [PATCH 1/4] fix: UI/UX tweaks --- .../src/components/LogsDownloaderPopper.js | 3 +- new-lamassu-admin/src/components/Tooltip.js | 26 +++-- .../src/components/editableTable/Header.js | 4 +- .../src/components/editableTable/Table.js | 4 +- .../src/components/inputs/base/Select.js | 5 +- .../src/components/layout/Sidebar.js | 21 ++-- .../src/components/layout/Sidebar.styles.js | 4 +- .../components/layout/TitleSection.styles.js | 1 + .../src/pages/Accounting/Accounting.js | 6 +- .../src/pages/Analytics/Analytics.js | 2 + .../src/pages/Blacklist/Blacklist.js | 6 +- .../src/pages/Cashout/Cashout.js | 104 +++++++++--------- new-lamassu-admin/src/pages/Cashout/helper.js | 12 +- .../Commissions/components/CommissionsList.js | 2 + .../Customers/components/EditableCard.js | 4 +- .../LoyaltyPanel/IndividualDiscountModal.js | 6 +- .../src/pages/LoyaltyPanel/PromoCodesModal.js | 6 +- .../pages/Maintenance/Wizard/WizardStep.js | 6 +- .../src/pages/Notifications/Notifications.js | 77 +++++++------ .../sections/FiatBalanceOverrides.js | 19 +++- .../src/pages/Notifications/sections/Setup.js | 10 +- .../src/pages/OperatorInfo/CoinATMRadar.js | 6 +- .../src/pages/Triggers/Triggers.js | 6 +- .../src/pages/Wizard/components/Twilio.js | 6 +- 24 files changed, 200 insertions(+), 146 deletions(-) diff --git a/new-lamassu-admin/src/components/LogsDownloaderPopper.js b/new-lamassu-admin/src/components/LogsDownloaderPopper.js index 9c02760a..a444e5de 100644 --- a/new-lamassu-admin/src/components/LogsDownloaderPopper.js +++ b/new-lamassu-admin/src/components/LogsDownloaderPopper.js @@ -1,7 +1,7 @@ import { useLazyQuery } from '@apollo/react-hooks' import { makeStyles, ClickAwayListener } from '@material-ui/core' import classnames from 'classnames' -import { format, isSameDay } from 'date-fns/fp' +import { format } from 'date-fns/fp' import FileSaver from 'file-saver' import * as R from 'ramda' import React, { useState, useCallback } from 'react' @@ -188,7 +188,6 @@ const LogsDownloaderPopover = ({ if (!range || !range.from) return if (range.from && !range.until) range.until = new Date() - if (isSameDay(range.until, range.from)) range.until = new Date() if (selectedRadio === RANGE) { fetchLogs({ diff --git a/new-lamassu-admin/src/components/Tooltip.js b/new-lamassu-admin/src/components/Tooltip.js index 952305ee..2fa5b7f9 100644 --- a/new-lamassu-admin/src/components/Tooltip.js +++ b/new-lamassu-admin/src/components/Tooltip.js @@ -1,4 +1,5 @@ import { makeStyles, ClickAwayListener } from '@material-ui/core' +import * as R from 'ramda' import React, { useState, memo } from 'react' import Popper from 'src/components/Popper' @@ -8,9 +9,9 @@ const useStyles = makeStyles({ transparentButton: { border: 'none', backgroundColor: 'transparent', - marginTop: 4, outline: 'none', - cursor: 'pointer' + cursor: 'pointer', + marginTop: 4 }, popoverContent: ({ width }) => ({ width, @@ -69,11 +70,22 @@ const HoverableTooltip = memo(({ parentElements, children, width }) => { return (
-
- {parentElements} -
+ {!R.isNil(parentElements) && ( +
+ {parentElements} +
+ )} + {R.isNil(parentElements) && ( + + )} { deleteWidth, enableToggle, toggleWidth, + orderedBy, DEFAULT_COL_SIZE } = useContext(TableCtx) @@ -62,7 +63,8 @@ const Header = () => { idx ) => ( - {header || startCase(name)} + {header || startCase(name)}{' '} + {!R.isNil(orderedBy) && R.equals(name, orderedBy.code) && '-'} ) diff --git a/new-lamassu-admin/src/components/editableTable/Table.js b/new-lamassu-admin/src/components/editableTable/Table.js index d3edb906..a5e66733 100644 --- a/new-lamassu-admin/src/components/editableTable/Table.js +++ b/new-lamassu-admin/src/components/editableTable/Table.js @@ -56,7 +56,8 @@ const ETable = ({ sortBy, createText = 'Add override', forceAdd = false, - tbodyWrapperClass + tbodyWrapperClass, + orderedBy = null }) => { const [editingId, setEditingId] = useState(null) const [adding, setAdding] = useState(false) @@ -155,6 +156,7 @@ const ETable = ({ actionColSize, stripeWhen, forceAdd, + orderedBy, DEFAULT_COL_SIZE } diff --git a/new-lamassu-admin/src/components/inputs/base/Select.js b/new-lamassu-admin/src/components/inputs/base/Select.js index c29ac6b0..95f5cd39 100644 --- a/new-lamassu-admin/src/components/inputs/base/Select.js +++ b/new-lamassu-admin/src/components/inputs/base/Select.js @@ -1,6 +1,7 @@ import { makeStyles } from '@material-ui/core' import classnames from 'classnames' import { useSelect } from 'downshift' +import * as R from 'ramda' import React from 'react' import { ReactComponent as Arrowdown } from 'src/styling/icons/action/arrow/regular.svg' @@ -29,7 +30,9 @@ function Select({ className, label, items, ...props }) { const selectClassNames = { [classes.select]: true, - [classes.selectFiltered]: selectedItem !== props.default, + [classes.selectFiltered]: props.defaultAsFilter + ? true + : !R.equals(selectedItem, props.default), [classes.open]: isOpen } diff --git a/new-lamassu-admin/src/components/layout/Sidebar.js b/new-lamassu-admin/src/components/layout/Sidebar.js index 820bb750..4c60d38e 100644 --- a/new-lamassu-admin/src/components/layout/Sidebar.js +++ b/new-lamassu-admin/src/components/layout/Sidebar.js @@ -27,16 +27,17 @@ const Sidebar = ({ {loading &&

Loading...

} {!loading && data?.map((it, idx) => ( -
onClick(it)}> - {itemRender ? itemRender(it, isSelected(it)) : displayName(it)} +
onClick(it)}> +
+ {itemRender ? itemRender(it, isSelected(it)) : displayName(it)} +
))} {!loading && children} diff --git a/new-lamassu-admin/src/components/layout/Sidebar.styles.js b/new-lamassu-admin/src/components/layout/Sidebar.styles.js index 2391cfce..1165ed59 100644 --- a/new-lamassu-admin/src/components/layout/Sidebar.styles.js +++ b/new-lamassu-admin/src/components/layout/Sidebar.styles.js @@ -30,7 +30,9 @@ export default { boxShadow: `-200px 0px 0px 0px ${sidebarColor}` } }, - + linkWrapper: { + cursor: 'pointer' + }, link: { extend: p, position: 'relative', diff --git a/new-lamassu-admin/src/components/layout/TitleSection.styles.js b/new-lamassu-admin/src/components/layout/TitleSection.styles.js index 05d9689b..351193da 100644 --- a/new-lamassu-admin/src/components/layout/TitleSection.styles.js +++ b/new-lamassu-admin/src/components/layout/TitleSection.styles.js @@ -19,6 +19,7 @@ export default { }, buttonText: { color: backgroundColor, + fontFamily: 'Mont', fontSize: 15 }, icon: { diff --git a/new-lamassu-admin/src/pages/Accounting/Accounting.js b/new-lamassu-admin/src/pages/Accounting/Accounting.js index c57ebea9..7175cd3d 100644 --- a/new-lamassu-admin/src/pages/Accounting/Accounting.js +++ b/new-lamassu-admin/src/pages/Accounting/Accounting.js @@ -5,7 +5,7 @@ import * as R from 'ramda' import React, { useContext } from 'react' import AppContext from 'src/AppContext' -import { Tooltip } from 'src/components/Tooltip' +import { HoverableTooltip } from 'src/components/Tooltip' import TitleSection from 'src/components/layout/TitleSection' import DataTable from 'src/components/tables/DataTable' import { H4, Info2, P } from 'src/components/typography' @@ -127,9 +127,9 @@ const Accounting = () => { {it.description} {!!it.extraInfo && ( - +

{it.extraInfo}

-
+ )}
) diff --git a/new-lamassu-admin/src/pages/Analytics/Analytics.js b/new-lamassu-admin/src/pages/Analytics/Analytics.js index 8b00c2fc..61a69d47 100644 --- a/new-lamassu-admin/src/pages/Analytics/Analytics.js +++ b/new-lamassu-admin/src/pages/Analytics/Analytics.js @@ -284,6 +284,7 @@ const Analytics = () => { items={REPRESENTING_OPTIONS} default={REPRESENTING_OPTIONS[0]} selectedItem={representing} + defaultAsFilter />