From b07a3d9ad62217a43740bf0c9cb7e264def343c4 Mon Sep 17 00:00:00 2001 From: Rafael Taranto Date: Tue, 29 Apr 2025 12:25:09 +0100 Subject: [PATCH] partial: blacklist css migration --- .../src/pages/Blacklist/Blacklist.jsx | 58 +++++++------- .../src/pages/Blacklist/Blacklist.styles.js | 75 ------------------- .../src/pages/Blacklist/BlacklistAdvanced.jsx | 20 ++--- .../src/pages/Blacklist/BlacklistModal.jsx | 25 +++---- .../src/pages/Blacklist/BlacklistTable.jsx | 11 +-- 5 files changed, 45 insertions(+), 144 deletions(-) delete mode 100644 new-lamassu-admin/src/pages/Blacklist/Blacklist.styles.js diff --git a/new-lamassu-admin/src/pages/Blacklist/Blacklist.jsx b/new-lamassu-admin/src/pages/Blacklist/Blacklist.jsx index 637fb7e8..d0962c94 100644 --- a/new-lamassu-admin/src/pages/Blacklist/Blacklist.jsx +++ b/new-lamassu-admin/src/pages/Blacklist/Blacklist.jsx @@ -1,9 +1,8 @@ import { useQuery, useMutation, gql } from '@apollo/client' import Dialog from '@mui/material/Dialog' +import DialogTitle from '@mui/material/DialogTitle' import DialogContent from '@mui/material/DialogContent' -import DialogActions from '@mui/material/DialogActions' import Switch from '@mui/material/Switch' -import { makeStyles } from '@mui/styles' import * as R from 'ramda' import React, { useState } from 'react' import { HelpTooltip } from 'src/components/Tooltip' @@ -21,13 +20,10 @@ import { } from 'src/components/buttons' import { fromNamespace, toNamespace } from 'src/utils/config' -import styles from './Blacklist.styles' import BlackListAdvanced from './BlacklistAdvanced' import BlackListModal from './BlacklistModal' import BlacklistTable from './BlacklistTable' -const useStyles = makeStyles(styles) - const DELETE_ROW = gql` mutation DeleteBlacklistRow($address: String!) { deleteBlacklistRow(address: $address) { @@ -88,8 +84,6 @@ const EDIT_BLACKLIST_MESSAGE = gql` ` const PaperWalletDialog = ({ onConfirmed, onDissmised, open, props }) => { - const classes = useStyles() - return ( { } }} {...props}> -
- - - +
+ + + + +

{'Are you sure you want to enable this?'}

+
+ + {`This mode means that only paper wallets will be printed for users, and they won't be permitted to scan an address from their own wallet.`} + {`This mode is only useful for countries like Switzerland which mandates such a feature.\n`} + {`Don't enable this if you want users to be able to scan an address of their choosing.`} +
+ + +
+
-

- {'Are you sure you want to enable this?'} -

- - {`This mode means that only paper wallets will be printed for users, and they won't be permitted to scan an address from their own wallet.`} - {`This mode is only useful for countries like Switzerland which mandates such a feature.\n`} - {`Don't enable this if you want users to be able to scan an address of their choosing.`} - - - - -
) } @@ -162,8 +160,6 @@ const Blacklist = () => { refetchQueries: () => ['getBlacklistData'] }) - const classes = useStyles() - const blacklistData = R.path(['blacklist'])(blacklistResponse) ?? [] const complianceConfig = @@ -289,7 +285,7 @@ const Blacklist = () => { )} {!advancedSettings && ( -
+
*': { - marginTop: 20 - }, - display: 'flex', - flexDirection: 'column', - height: '100%' - }, - footer: { - display: 'flex', - flexDirection: 'row', - margin: [['auto', 0, spacer * 3, 0]] - }, - submit: { - margin: [['auto', 0, 0, 'auto']] - }, - modalTitle: { - margin: [['auto', 0, 8.5, 'auto']] - }, - subtitle: { - display: 'flex', - justifyContent: 'space-between', - alignItems: 'center', - flexDirection: 'row' - }, - white: { - color: white - }, - deleteButton: { - paddingLeft: 13 - }, - addressRow: { - marginLeft: 8 - }, - error: { - marginTop: 20 - }, - closeButton: { - display: 'flex', - padding: [[spacer * 2, spacer * 2, 0, spacer * 2]], - paddingRight: spacer * 1.5, - justifyContent: 'end' - }, - dialogTitle: { - margin: [[0, spacer * 2, spacer, spacer * 4 + spacer]] - }, - dialogContent: { - width: 615, - marginLeft: 16 - }, - dialogActions: { - padding: spacer * 4, - paddingTop: spacer * 2 - }, - cancelButton: { - marginRight: 8, - padding: 0 - }, - resetToDefault: { - width: 145 - } -} - -export default styles diff --git a/new-lamassu-admin/src/pages/Blacklist/BlacklistAdvanced.jsx b/new-lamassu-admin/src/pages/Blacklist/BlacklistAdvanced.jsx index 2f554905..5314bac9 100644 --- a/new-lamassu-admin/src/pages/Blacklist/BlacklistAdvanced.jsx +++ b/new-lamassu-admin/src/pages/Blacklist/BlacklistAdvanced.jsx @@ -1,4 +1,3 @@ -import { makeStyles } from '@mui/styles' import { Form, Formik, Field } from 'formik' import * as R from 'ramda' import React, { useState } from 'react' @@ -15,10 +14,6 @@ import * as Yup from 'yup' import { ActionButton, IconButton, Button } from 'src/components/buttons' import { TextInput } from 'src/components/inputs/formik' -import styles from './Blacklist.styles' - -const useStyles = makeStyles(styles) - const DEFAULT_MESSAGE = `This address may be associated with a deceptive offer or a prohibited group. Please make sure you're using an address from your own wallet.` const getErrorMsg = (formikErrors, formikTouched, mutationError) => { @@ -35,7 +30,6 @@ const BlacklistAdvanced = ({ onClose, mutationError }) => { - const classes = useStyles() const [selectedMessage, setSelectedMessage] = useState(null) const elements = [ @@ -63,7 +57,7 @@ const BlacklistAdvanced = ({ size: 'sm', view: it => ( setSelectedMessage(it)} size="large"> @@ -78,7 +72,7 @@ const BlacklistAdvanced = ({ size: 'sm', view: it => ( {({ errors, touched, setFieldValue }) => ( -
+ setFieldValue('content', DEFAULT_MESSAGE)}> Reset to default @@ -156,15 +150,13 @@ const BlacklistAdvanced = ({ rows={6} component={TextInput} /> -
+
{getErrorMsg(errors, touched, mutationError) && ( {getErrorMsg(errors, touched, mutationError)} )} - +
)} diff --git a/new-lamassu-admin/src/pages/Blacklist/BlacklistModal.jsx b/new-lamassu-admin/src/pages/Blacklist/BlacklistModal.jsx index 3a6555ba..dbd267f9 100644 --- a/new-lamassu-admin/src/pages/Blacklist/BlacklistModal.jsx +++ b/new-lamassu-admin/src/pages/Blacklist/BlacklistModal.jsx @@ -1,4 +1,3 @@ -import { makeStyles } from '@mui/styles' import { Formik, Form, Field } from 'formik' import * as R from 'ramda' import React from 'react' @@ -10,11 +9,7 @@ import * as Yup from 'yup' import { Link } from 'src/components/buttons' import { TextInput } from 'src/components/inputs/formik' -import styles from './Blacklist.styles' -const useStyles = makeStyles(styles) - const BlackListModal = ({ onClose, addToBlacklist, errorMsg }) => { - const classes = useStyles() const handleAddToBlacklist = address => { addToBlacklist(address) } @@ -40,8 +35,8 @@ const BlackListModal = ({ onClose, addToBlacklist, errorMsg }) => { onSubmit={({ address }) => { handleAddToBlacklist(address.trim()) }}> -
-

Blacklist new address

+ +

Blacklist new address

{ placeholder={`ex: ${placeholderAddress}`} component={TextInput} /> +
+ {!R.isNil(errorMsg) && {errorMsg}} +
+ + Blacklist address + +
+
-
- {!R.isNil(errorMsg) && {errorMsg}} -
- - Blacklist address - -
-
) } diff --git a/new-lamassu-admin/src/pages/Blacklist/BlacklistTable.jsx b/new-lamassu-admin/src/pages/Blacklist/BlacklistTable.jsx index 877ca6a8..33d99819 100644 --- a/new-lamassu-admin/src/pages/Blacklist/BlacklistTable.jsx +++ b/new-lamassu-admin/src/pages/Blacklist/BlacklistTable.jsx @@ -1,4 +1,3 @@ -import { makeStyles } from '@mui/styles' import * as R from 'ramda' import React, { useState } from 'react' import { DeleteDialog } from 'src/components/DeleteDialog' @@ -8,10 +7,6 @@ import DeleteIcon from 'src/styling/icons/action/delete/enabled.svg?react' import { IconButton } from 'src/components/buttons' -import styles from './Blacklist.styles' - -const useStyles = makeStyles(styles) - const BlacklistTable = ({ data, handleDeleteEntry, @@ -20,8 +15,6 @@ const BlacklistTable = ({ deleteDialog, setDeleteDialog }) => { - const classes = useStyles() - const [toBeDeleted, setToBeDeleted] = useState() const elements = [ @@ -32,7 +25,7 @@ const BlacklistTable = ({ textAlign: 'left', size: 'sm', view: it => ( -
+
{R.path(['address'], it)}
) @@ -45,7 +38,7 @@ const BlacklistTable = ({ size: 'sm', view: it => ( { setDeleteDialog(true) setToBeDeleted(it)