From 4e96152e2166d80635d224e02fbe462b482d350f Mon Sep 17 00:00:00 2001 From: nicolas Date: Thu, 1 Apr 2021 05:54:14 -0300 Subject: [PATCH] Replace AddressInfo by EthHashInfo (#2103) --- src/components/AddressInfo/index.tsx | 78 ------------------- .../ConfirmTxModal/ReviewConfirm.tsx | 28 +++++-- .../ContractInteraction/Review/index.tsx | 7 +- 3 files changed, 26 insertions(+), 87 deletions(-) delete mode 100644 src/components/AddressInfo/index.tsx diff --git a/src/components/AddressInfo/index.tsx b/src/components/AddressInfo/index.tsx deleted file mode 100644 index 8e08f2b7..00000000 --- a/src/components/AddressInfo/index.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import React from 'react' -import { getExplorerInfo, getNetworkInfo } from 'src/config' -import CopyBtn from 'src/components/CopyBtn' -import Identicon from 'src/components/Identicon' -import Block from 'src/components/layout/Block' -import Bold from 'src/components/layout/Bold' -import Paragraph from 'src/components/layout/Paragraph' -import { border, xs } from 'src/theme/variables' -import styled from 'styled-components' -import { ExplorerButton } from '@gnosis.pm/safe-react-components' - -const Wrapper = styled.div` - display: flex; - align-items: center; - - .icon-section { - margin-right: 10px; - } - - .data-section { - display: flex; - flex-direction: column; - - .address { - display: flex; - } - } -` -const StyledBlock = styled(Block)` - font-size: 12px; - line-height: 1.08; - letter-spacing: -0.5; - background-color: ${border}; - width: fit-content; - padding: 5px 10px; - margin-top: ${xs}; - border-radius: 3px; -` -interface Props { - safeName?: string - safeAddress: string - ethBalance?: string -} - -const { nativeCoin } = getNetworkInfo() - -const AddressInfo = ({ ethBalance, safeAddress, safeName }: Props): React.ReactElement => { - return ( - -
- -
-
- {safeName && ( - - {safeName} - - )} -
- - {safeAddress} - - - -
- {ethBalance && ( - - - Balance: {`${ethBalance} ${nativeCoin.symbol}`} - - - )} -
-
- ) -} - -export default AddressInfo diff --git a/src/routes/safe/components/Apps/components/ConfirmTxModal/ReviewConfirm.tsx b/src/routes/safe/components/Apps/components/ConfirmTxModal/ReviewConfirm.tsx index 3a56ebcb..04e70266 100644 --- a/src/routes/safe/components/Apps/components/ConfirmTxModal/ReviewConfirm.tsx +++ b/src/routes/safe/components/Apps/components/ConfirmTxModal/ReviewConfirm.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useMemo, useState } from 'react' -import { ModalFooterConfirmation } from '@gnosis.pm/safe-react-components' +import { Text, EthHashInfo, ModalFooterConfirmation } from '@gnosis.pm/safe-react-components' import styled from 'styled-components' import { useDispatch } from 'react-redux' @@ -20,11 +20,12 @@ import { EditableTxParameters } from 'src/routes/safe/components/Transactions/he import { TxParametersDetail } from 'src/routes/safe/components/Transactions/helpers/TxParametersDetail' import { md, lg, sm } from 'src/theme/variables' import { TxParameters } from 'src/routes/safe/container/hooks/useTransactionParameters' -import AddressInfo from 'src/components/AddressInfo' import { DecodeTxs, BasicTxInfo } from 'src/components/DecodeTxs' import { fetchTxDecoder } from 'src/utils/decodeTx' import { DecodedData } from 'src/types/transactions/decode.d' import { fromTokenUnit } from 'src/logic/tokens/utils/humanReadableValue' +import { getExplorerInfo } from 'src/config' +import Block from 'src/components/layout/Block' import GasEstimationInfo from '../GasEstimationInfo' import { ConfirmTxModalProps, DecodedTxDetail } from '.' @@ -53,6 +54,19 @@ const DecodeTxsWrapper = styled.div` margin: 24px -24px; ` +const StyledBlock = styled(Block)` + background-color: ${({ theme }) => theme.colors.separator}; + width: fit-content; + padding: 5px 10px; + border-radius: 3px; + margin: 4px 0 0 40px; + + display: flex; + > :nth-child(1) { + margin-right: 5px; + } +` + type Props = ConfirmTxModalProps & { areTxsMalformed: boolean showDecodedTxData: (decodedTxDetails: DecodedTxDetail) => void @@ -81,6 +95,7 @@ export const ReviewConfirm = ({ const isMultiSend = txs.length > 1 const [decodedData, setDecodedData] = useState(null) const dispatch = useDispatch() + const explorerUrl = getExplorerInfo(safeAddress) const txRecipient: string | undefined = useMemo(() => (isMultiSend ? MULTI_SEND_ADDRESS : txs[0]?.to), [ txs, @@ -198,7 +213,11 @@ export const ReviewConfirm = ({ {/* Safe */} - + + + Balance: + {`${ethBalance} ${nativeCoin.symbol}`} + @@ -212,9 +231,7 @@ export const ReviewConfirm = ({ - {!isMultiSend && } - {/* Warning gas estimation */} {params?.safeTxGas && (
@@ -227,7 +244,6 @@ export const ReviewConfirm = ({ />
)} - {/* Tx Parameters */} { + const explorerUrl = getExplorerInfo(tx.contractAddress as string) const classes = useStyles() const dispatch = useDispatch() const safeAddress = useSelector(safeParamAddressFromStateSelector) @@ -144,7 +145,7 @@ const ContractInteractionReview = ({ onClose, onPrev, tx }: Props): React.ReactE - +