diff --git a/ui/address/AddressTxsFilter.tsx b/ui/address/AddressTxsFilter.tsx index 1b8ead77ff..c566f1d91e 100644 --- a/ui/address/AddressTxsFilter.tsx +++ b/ui/address/AddressTxsFilter.tsx @@ -38,8 +38,8 @@ const AddressTxsFilter = ({ onFilterChange, defaultFilter, isActive, isLoading } All - From - To + Outgoing transactions + Incoming transactions diff --git a/ui/address/__screenshots__/AddressInternalTxs.pw.tsx_default_base-view-mobile-1.png b/ui/address/__screenshots__/AddressInternalTxs.pw.tsx_default_base-view-mobile-1.png index 2d36b1a5a8..b724db94a6 100644 Binary files a/ui/address/__screenshots__/AddressInternalTxs.pw.tsx_default_base-view-mobile-1.png and b/ui/address/__screenshots__/AddressInternalTxs.pw.tsx_default_base-view-mobile-1.png differ diff --git a/ui/address/__screenshots__/AddressInternalTxs.pw.tsx_mobile_base-view-mobile-1.png b/ui/address/__screenshots__/AddressInternalTxs.pw.tsx_mobile_base-view-mobile-1.png index 51fdeb8eb8..7eaf7bc55a 100644 Binary files a/ui/address/__screenshots__/AddressInternalTxs.pw.tsx_mobile_base-view-mobile-1.png and b/ui/address/__screenshots__/AddressInternalTxs.pw.tsx_mobile_base-view-mobile-1.png differ diff --git a/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_mobile-with-token-filter-and-no-pagination-1.png b/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_mobile-with-token-filter-and-no-pagination-1.png index 53d53b249c..2986322aa8 100644 Binary files a/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_mobile-with-token-filter-and-no-pagination-1.png and b/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_mobile-with-token-filter-and-no-pagination-1.png differ diff --git a/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_mobile-with-token-filter-and-pagination-1.png b/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_mobile-with-token-filter-and-pagination-1.png index ebb49117dd..fbcf8a9464 100644 Binary files a/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_mobile-with-token-filter-and-pagination-1.png and b/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_mobile-with-token-filter-and-pagination-1.png differ diff --git a/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_with-token-filter-and-no-pagination-1.png b/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_with-token-filter-and-no-pagination-1.png index c7d9422137..a790f6bebb 100644 Binary files a/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_with-token-filter-and-no-pagination-1.png and b/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_with-token-filter-and-no-pagination-1.png differ diff --git a/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_with-token-filter-and-pagination-1.png b/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_with-token-filter-and-pagination-1.png index 6ce1cc6b65..174c2ccf79 100644 Binary files a/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_with-token-filter-and-pagination-1.png and b/ui/address/__screenshots__/AddressTokenTransfers.pw.tsx_default_with-token-filter-and-pagination-1.png differ diff --git a/ui/address/__screenshots__/AddressTxs.pw.tsx_default_base-view-mobile-1.png b/ui/address/__screenshots__/AddressTxs.pw.tsx_default_base-view-mobile-1.png index 542322b3ee..f0ca735b55 100644 Binary files a/ui/address/__screenshots__/AddressTxs.pw.tsx_default_base-view-mobile-1.png and b/ui/address/__screenshots__/AddressTxs.pw.tsx_default_base-view-mobile-1.png differ diff --git a/ui/address/__screenshots__/AddressTxs.pw.tsx_default_base-view-screen-xl-1.png b/ui/address/__screenshots__/AddressTxs.pw.tsx_default_base-view-screen-xl-1.png index 423926aaa0..041475ef03 100644 Binary files a/ui/address/__screenshots__/AddressTxs.pw.tsx_default_base-view-screen-xl-1.png and b/ui/address/__screenshots__/AddressTxs.pw.tsx_default_base-view-screen-xl-1.png differ diff --git a/ui/address/__screenshots__/AddressTxs.pw.tsx_mobile_base-view-mobile-1.png b/ui/address/__screenshots__/AddressTxs.pw.tsx_mobile_base-view-mobile-1.png index 9ec178775e..c21bdb99cc 100644 Binary files a/ui/address/__screenshots__/AddressTxs.pw.tsx_mobile_base-view-mobile-1.png and b/ui/address/__screenshots__/AddressTxs.pw.tsx_mobile_base-view-mobile-1.png differ diff --git a/ui/address/internals/AddressIntTxsListItem.tsx b/ui/address/internals/AddressIntTxsListItem.tsx index 463a7a053c..12494ff00a 100644 --- a/ui/address/internals/AddressIntTxsListItem.tsx +++ b/ui/address/internals/AddressIntTxsListItem.tsx @@ -1,4 +1,4 @@ -import { Flex, Box, HStack, Skeleton } from '@chakra-ui/react'; +import { Flex, HStack, Skeleton } from '@chakra-ui/react'; import BigNumber from 'bignumber.js'; import React from 'react'; @@ -6,12 +6,10 @@ import type { InternalTransaction } from 'types/api/internalTransaction'; import config from 'configs/app'; import dayjs from 'lib/date/dayjs'; +import AddressFromTo from 'ui/shared/address/AddressFromTo'; import Tag from 'ui/shared/chakra/Tag'; -import AddressEntity from 'ui/shared/entities/address/AddressEntity'; import BlockEntity from 'ui/shared/entities/block/BlockEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity'; -import IconSvg from 'ui/shared/IconSvg'; -import InOutTag from 'ui/shared/InOutTag'; import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile'; import TxStatus from 'ui/shared/statusTag/TxStatus'; import { TX_INTERNALS_ITEMS } from 'ui/tx/internals/utils'; @@ -35,9 +33,6 @@ const TxInternalsListItem = ({ const typeTitle = TX_INTERNALS_ITEMS.find(({ id }) => id === type)?.title; const toData = to ? to : createdContract; - const isOut = Boolean(currentAddress && currentAddress === from.hash); - const isIn = Boolean(currentAddress && currentAddress === toData?.hash); - return ( @@ -65,28 +60,13 @@ const TxInternalsListItem = ({ lineHeight={ 5 } /> - - - { (isIn || isOut) ? - : - - } - { toData && ( - - ) } - + Value { config.chain.currency.symbol } diff --git a/ui/address/internals/AddressIntTxsTable.tsx b/ui/address/internals/AddressIntTxsTable.tsx index 4db7362ca0..85ad31ae17 100644 --- a/ui/address/internals/AddressIntTxsTable.tsx +++ b/ui/address/internals/AddressIntTxsTable.tsx @@ -24,11 +24,9 @@ const AddressIntTxsTable = ({ data, currentAddress, isLoading }: Props) => { Parent txn hash Type Block - From - - To + From/To - Value { config.chain.currency.symbol } + Value { config.chain.currency.symbol } diff --git a/ui/address/internals/AddressIntTxsTableItem.tsx b/ui/address/internals/AddressIntTxsTableItem.tsx index 7f1820e370..4e3301d2f2 100644 --- a/ui/address/internals/AddressIntTxsTableItem.tsx +++ b/ui/address/internals/AddressIntTxsTableItem.tsx @@ -6,12 +6,10 @@ import type { InternalTransaction } from 'types/api/internalTransaction'; import config from 'configs/app'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; +import AddressFromTo from 'ui/shared/address/AddressFromTo'; import Tag from 'ui/shared/chakra/Tag'; -import AddressEntity from 'ui/shared/entities/address/AddressEntity'; import BlockEntity from 'ui/shared/entities/block/BlockEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity'; -import IconSvg from 'ui/shared/IconSvg'; -import InOutTag from 'ui/shared/InOutTag'; import TxStatus from 'ui/shared/statusTag/TxStatus'; import { TX_INTERNALS_ITEMS } from 'ui/tx/internals/utils'; @@ -34,9 +32,6 @@ const AddressIntTxsTableItem = ({ const typeTitle = TX_INTERNALS_ITEMS.find(({ id }) => id === type)?.title; const toData = to ? to : createdContract; - const isOut = Boolean(currentAddress && currentAddress === from.hash); - const isIn = Boolean(currentAddress && currentAddress === toData?.hash); - const timeAgo = useTimeAgoIncrement(timestamp, true); return ( @@ -77,33 +72,13 @@ const AddressIntTxsTableItem = ({ /> - - - { (isIn || isOut) ? - : - - } - - - { toData && ( - - ) } - { BigNumber(value).div(BigNumber(10 ** config.chain.currency.decimals)).toFormat() } diff --git a/ui/home/LatestTxsItem.tsx b/ui/home/LatestTxsItem.tsx index ed0666e5ef..497ad91289 100644 --- a/ui/home/LatestTxsItem.tsx +++ b/ui/home/LatestTxsItem.tsx @@ -13,9 +13,8 @@ import type { Transaction } from 'types/api/transaction'; import config from 'configs/app'; import getValueWithUnit from 'lib/getValueWithUnit'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; -import AddressEntity from 'ui/shared/entities/address/AddressEntity'; +import AddressFromTo from 'ui/shared/address/AddressFromTo'; import TxEntity from 'ui/shared/entities/tx/TxEntity'; -import IconSvg from 'ui/shared/IconSvg'; import TxStatus from 'ui/shared/statusTag/TxStatus'; import TxFeeStability from 'ui/shared/tx/TxFeeStability'; import TxWatchListTags from 'ui/shared/tx/TxWatchListTags'; @@ -35,7 +34,7 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => { return ( { - - - - - { dataTo && ( - - ) } - - + { !config.UI.views.tx.hiddenFields?.value && ( diff --git a/ui/home/LatestTxsItemMobile.tsx b/ui/home/LatestTxsItemMobile.tsx index eb96ff62f5..e2a74deda4 100644 --- a/ui/home/LatestTxsItemMobile.tsx +++ b/ui/home/LatestTxsItemMobile.tsx @@ -12,9 +12,8 @@ import type { Transaction } from 'types/api/transaction'; import config from 'configs/app'; import getValueWithUnit from 'lib/getValueWithUnit'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; -import AddressEntity from 'ui/shared/entities/address/AddressEntity'; +import AddressFromTo from 'ui/shared/address/AddressFromTo'; import TxEntity from 'ui/shared/entities/tx/TxEntity'; -import IconSvg from 'ui/shared/IconSvg'; import TxStatus from 'ui/shared/statusTag/TxStatus'; import TxFeeStability from 'ui/shared/tx/TxFeeStability'; import TxWatchListTags from 'ui/shared/tx/TxWatchListTags'; @@ -66,31 +65,14 @@ const LatestTxsItem = ({ tx, isLoading }: Props) => { ) } - - - - { dataTo && ( - - ) } - + { !config.UI.views.tx.hiddenFields?.value && ( Value { config.chain.currency.symbol } diff --git a/ui/home/__screenshots__/LatestTxs.pw.tsx_dark-color-mode_default-view-dark-mode-1.png b/ui/home/__screenshots__/LatestTxs.pw.tsx_dark-color-mode_default-view-dark-mode-1.png index 36bbb929d3..b2996dc96c 100644 Binary files a/ui/home/__screenshots__/LatestTxs.pw.tsx_dark-color-mode_default-view-dark-mode-1.png and b/ui/home/__screenshots__/LatestTxs.pw.tsx_dark-color-mode_default-view-dark-mode-1.png differ diff --git a/ui/home/__screenshots__/LatestTxs.pw.tsx_default_default-view-dark-mode-1.png b/ui/home/__screenshots__/LatestTxs.pw.tsx_default_default-view-dark-mode-1.png index 0fc6154b45..35ea9d289c 100644 Binary files a/ui/home/__screenshots__/LatestTxs.pw.tsx_default_default-view-dark-mode-1.png and b/ui/home/__screenshots__/LatestTxs.pw.tsx_default_default-view-dark-mode-1.png differ diff --git a/ui/home/__screenshots__/LatestTxs.pw.tsx_default_mobile-default-view-1.png b/ui/home/__screenshots__/LatestTxs.pw.tsx_default_mobile-default-view-1.png index 6622d1c204..794589625d 100644 Binary files a/ui/home/__screenshots__/LatestTxs.pw.tsx_default_mobile-default-view-1.png and b/ui/home/__screenshots__/LatestTxs.pw.tsx_default_mobile-default-view-1.png differ diff --git a/ui/home/__screenshots__/LatestTxs.pw.tsx_default_socket-new-item-1.png b/ui/home/__screenshots__/LatestTxs.pw.tsx_default_socket-new-item-1.png index f1a8b21010..fa325833f7 100644 Binary files a/ui/home/__screenshots__/LatestTxs.pw.tsx_default_socket-new-item-1.png and b/ui/home/__screenshots__/LatestTxs.pw.tsx_default_socket-new-item-1.png differ diff --git a/ui/pages/__screenshots__/Home.pw.tsx_dark-color-mode_default-view---default-dark-mode-1.png b/ui/pages/__screenshots__/Home.pw.tsx_dark-color-mode_default-view---default-dark-mode-1.png index 172d314254..1425d94075 100644 Binary files a/ui/pages/__screenshots__/Home.pw.tsx_dark-color-mode_default-view---default-dark-mode-1.png and b/ui/pages/__screenshots__/Home.pw.tsx_dark-color-mode_default-view---default-dark-mode-1.png differ diff --git a/ui/pages/__screenshots__/Home.pw.tsx_default_default-view-screen-xl-1.png b/ui/pages/__screenshots__/Home.pw.tsx_default_default-view-screen-xl-1.png index 6ec486f1dd..e8d9ed42ef 100644 Binary files a/ui/pages/__screenshots__/Home.pw.tsx_default_default-view-screen-xl-1.png and b/ui/pages/__screenshots__/Home.pw.tsx_default_default-view-screen-xl-1.png differ diff --git a/ui/pages/__screenshots__/Home.pw.tsx_default_mobile-base-view-1.png b/ui/pages/__screenshots__/Home.pw.tsx_default_mobile-base-view-1.png index f5fd2e4c57..548a1f32ae 100644 Binary files a/ui/pages/__screenshots__/Home.pw.tsx_default_mobile-base-view-1.png and b/ui/pages/__screenshots__/Home.pw.tsx_default_mobile-base-view-1.png differ diff --git a/ui/shared/CopyToClipboard.tsx b/ui/shared/CopyToClipboard.tsx index be20647990..4941909638 100644 --- a/ui/shared/CopyToClipboard.tsx +++ b/ui/shared/CopyToClipboard.tsx @@ -1,4 +1,4 @@ -import { IconButton, Tooltip, useClipboard, chakra, useDisclosure, Skeleton } from '@chakra-ui/react'; +import { IconButton, Tooltip, useClipboard, chakra, useDisclosure, Skeleton, useColorModeValue } from '@chakra-ui/react'; import React, { useEffect, useState } from 'react'; import IconSvg from 'ui/shared/IconSvg'; @@ -14,6 +14,7 @@ const CopyToClipboard = ({ text, className, isLoading }: Props) => { const [ copied, setCopied ] = useState(false); // have to implement controlled tooltip because of the issue - https://github.com/chakra-ui/chakra-ui/issues/7107 const { isOpen, onOpen, onClose } = useDisclosure(); + const iconColor = useColorModeValue('gray.400', 'gray.500'); useEffect(() => { if (hasCopied) { @@ -34,7 +35,7 @@ const CopyToClipboard = ({ text, className, isLoading }: Props) => { icon={ } w="20px" h="20px" - color="gray.400" + color={ iconColor } variant="simple" display="inline-block" flexShrink={ 0 } diff --git a/ui/shared/IconSvg.tsx b/ui/shared/IconSvg.tsx index fb30c5e8cd..3d5d6ef068 100644 --- a/ui/shared/IconSvg.tsx +++ b/ui/shared/IconSvg.tsx @@ -12,9 +12,9 @@ interface Props extends HTMLChakraProps<'div'> { isLoading?: boolean; } -const IconSvg = ({ name, isLoading, ...props }: Props) => { +const IconSvg = ({ name, isLoading, ...props }: Props, ref: React.ForwardedRef) => { return ( - + @@ -22,4 +22,4 @@ const IconSvg = ({ name, isLoading, ...props }: Props) => { ); }; -export default IconSvg; +export default React.forwardRef(IconSvg); diff --git a/ui/shared/InOutTag.tsx b/ui/shared/InOutTag.tsx deleted file mode 100644 index bf7be50a85..0000000000 --- a/ui/shared/InOutTag.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { chakra } from '@chakra-ui/react'; -import React from 'react'; - -import Tag from 'ui/shared/chakra/Tag'; - -interface Props { - isIn: boolean; - isOut: boolean; - className?: string; - isLoading?: boolean; -} - -const InOutTag = ({ isIn, isOut, className, isLoading }: Props) => { - if (!isIn && !isOut) { - return null; - } - - const colorScheme = isOut ? 'orange' : 'green'; - - return ( - - { isOut ? 'OUT' : 'IN' } - - ); -}; - -export default React.memo(chakra(InOutTag)); diff --git a/ui/shared/TokenTransfer/TokenTransferFilter.tsx b/ui/shared/TokenTransfer/TokenTransferFilter.tsx index 137c545b34..f89931e178 100644 --- a/ui/shared/TokenTransfer/TokenTransferFilter.tsx +++ b/ui/shared/TokenTransfer/TokenTransferFilter.tsx @@ -35,7 +35,7 @@ const TokenTransferFilter = ({ const isInitialLoading = useIsInitialLoading(isLoading); return ( - + { withAddressFilter && ( <> Address @@ -49,8 +49,8 @@ const TokenTransferFilter = ({ > All - From - To + Outgoing transfers + Incoming transfers diff --git a/ui/shared/TokenTransfer/TokenTransferListItem.tsx b/ui/shared/TokenTransfer/TokenTransferListItem.tsx index 0d63e07b51..3ad382ea91 100644 --- a/ui/shared/TokenTransfer/TokenTransferListItem.tsx +++ b/ui/shared/TokenTransfer/TokenTransferListItem.tsx @@ -5,13 +5,11 @@ import type { TokenTransfer } from 'types/api/tokenTransfer'; import getCurrencyValue from 'lib/getCurrencyValue'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; +import AddressFromTo from 'ui/shared/address/AddressFromTo'; import Tag from 'ui/shared/chakra/Tag'; -import AddressEntity from 'ui/shared/entities/address/AddressEntity'; import NftEntity from 'ui/shared/entities/nft/NftEntity'; import TokenEntity from 'ui/shared/entities/token/TokenEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity'; -import IconSvg from 'ui/shared/IconSvg'; -import InOutTag from 'ui/shared/InOutTag'; import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile'; import { getTokenTransferTypeText } from 'ui/shared/TokenTransfer/helpers'; import TxAdditionalInfo from 'ui/txs/TxAdditionalInfo'; @@ -45,7 +43,6 @@ const TokenTransferListItem = ({ decimals: total.decimals || '0', }) : { usd: null, valueStr: null }; - const addressWidth = `calc((100% - ${ baseAddress ? '50px - 24px' : '24px - 24px' }) / 2)`; return ( @@ -80,36 +77,13 @@ const TokenTransferListItem = ({ ) } ) } - - - { baseAddress ? ( - - ) : - - } - - + { valueStr && ( Value diff --git a/ui/shared/TokenTransfer/TokenTransferTable.tsx b/ui/shared/TokenTransfer/TokenTransferTable.tsx index 20163f202f..3e4ba261c0 100644 --- a/ui/shared/TokenTransfer/TokenTransferTable.tsx +++ b/ui/shared/TokenTransfer/TokenTransferTable.tsx @@ -40,11 +40,9 @@ const TokenTransferTable = ({ { showTxInfo && } Token Token ID - { showTxInfo && Txn hash } - From - { baseAddress && } - To - Value + { showTxInfo && Txn hash } + From/To + Value diff --git a/ui/shared/TokenTransfer/TokenTransferTableItem.tsx b/ui/shared/TokenTransfer/TokenTransferTableItem.tsx index aa057f1a95..4dcf7e0ce6 100644 --- a/ui/shared/TokenTransfer/TokenTransferTableItem.tsx +++ b/ui/shared/TokenTransfer/TokenTransferTableItem.tsx @@ -5,12 +5,11 @@ import type { TokenTransfer } from 'types/api/tokenTransfer'; import getCurrencyValue from 'lib/getCurrencyValue'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; +import AddressFromTo from 'ui/shared/address/AddressFromTo'; import Tag from 'ui/shared/chakra/Tag'; -import AddressEntity from 'ui/shared/entities/address/AddressEntity'; import NftEntity from 'ui/shared/entities/nft/NftEntity'; import TokenEntity from 'ui/shared/entities/token/TokenEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity'; -import InOutTag from 'ui/shared/InOutTag'; import { getTokenTransferTypeText } from 'ui/shared/TokenTransfer/helpers'; import TxAdditionalInfo from 'ui/txs/TxAdditionalInfo'; @@ -85,36 +84,13 @@ const TokenTransferTableItem = ({ ) } - - - { baseAddress && ( - - - - - - ) } - - diff --git a/ui/shared/TokenTransfer/__screenshots__/TokenTransferList.pw.tsx_default_with-tx-info-1.png b/ui/shared/TokenTransfer/__screenshots__/TokenTransferList.pw.tsx_default_with-tx-info-1.png index cb52e15b4d..26454b93a7 100644 Binary files a/ui/shared/TokenTransfer/__screenshots__/TokenTransferList.pw.tsx_default_with-tx-info-1.png and b/ui/shared/TokenTransfer/__screenshots__/TokenTransferList.pw.tsx_default_with-tx-info-1.png differ diff --git a/ui/shared/TokenTransfer/__screenshots__/TokenTransferList.pw.tsx_default_without-tx-info-1.png b/ui/shared/TokenTransfer/__screenshots__/TokenTransferList.pw.tsx_default_without-tx-info-1.png index 76300132d9..0e761f89a7 100644 Binary files a/ui/shared/TokenTransfer/__screenshots__/TokenTransferList.pw.tsx_default_without-tx-info-1.png and b/ui/shared/TokenTransfer/__screenshots__/TokenTransferList.pw.tsx_default_without-tx-info-1.png differ diff --git a/ui/shared/TokenTransfer/__screenshots__/TokenTransferTable.pw.tsx_default_with-tx-info-1.png b/ui/shared/TokenTransfer/__screenshots__/TokenTransferTable.pw.tsx_default_with-tx-info-1.png index 3848d01acb..1a7e00b9a6 100644 Binary files a/ui/shared/TokenTransfer/__screenshots__/TokenTransferTable.pw.tsx_default_with-tx-info-1.png and b/ui/shared/TokenTransfer/__screenshots__/TokenTransferTable.pw.tsx_default_with-tx-info-1.png differ diff --git a/ui/shared/TokenTransfer/__screenshots__/TokenTransferTable.pw.tsx_default_without-tx-info-1.png b/ui/shared/TokenTransfer/__screenshots__/TokenTransferTable.pw.tsx_default_without-tx-info-1.png index f4549dc16c..9bc8b54155 100644 Binary files a/ui/shared/TokenTransfer/__screenshots__/TokenTransferTable.pw.tsx_default_without-tx-info-1.png and b/ui/shared/TokenTransfer/__screenshots__/TokenTransferTable.pw.tsx_default_without-tx-info-1.png differ diff --git a/ui/shared/address/AddressFromTo.pw.tsx b/ui/shared/address/AddressFromTo.pw.tsx new file mode 100644 index 0000000000..78124f3cd1 --- /dev/null +++ b/ui/shared/address/AddressFromTo.pw.tsx @@ -0,0 +1,62 @@ +import { test, expect } from '@playwright/experimental-ct-react'; +import React from 'react'; + +import * as addressMock from 'mocks/address/address'; +import TestApp from 'playwright/TestApp'; +import * as configs from 'playwright/utils/configs'; + +import AddressFromTo from './AddressFromTo'; + +test.use({ viewport: configs.viewport.mobile }); + +test('outgoing txn', async({ mount }) => { + const component = await mount( + + + , + ); + await expect(component).toHaveScreenshot(); +}); + +test('incoming txn', async({ mount }) => { + const component = await mount( + + + , + ); + await expect(component).toHaveScreenshot(); +}); + +test('compact mode', async({ mount }) => { + const component = await mount( + + + , + ); + await expect(component).toHaveScreenshot(); +}); + +test('loading state', async({ mount }) => { + const component = await mount( + + + , + ); + await expect(component).toHaveScreenshot(); +}); diff --git a/ui/shared/address/AddressFromTo.tsx b/ui/shared/address/AddressFromTo.tsx new file mode 100644 index 0000000000..7f3df69d7f --- /dev/null +++ b/ui/shared/address/AddressFromTo.tsx @@ -0,0 +1,115 @@ +import type { ThemeTypings } from '@chakra-ui/react'; +import { Flex, chakra, useBreakpointValue } from '@chakra-ui/react'; +import React from 'react'; + +import type { AddressParam } from 'types/api/addressParams'; + +import type { EntityProps } from 'ui/shared/entities/address/AddressEntity'; +import AddressEntity from 'ui/shared/entities/address/AddressEntity'; +import AddressEntityWithTokenFilter from 'ui/shared/entities/address/AddressEntityWithTokenFilter'; + +import AddressFromToIcon from './AddressFromToIcon'; +import { getTxCourseType } from './utils'; + +type Mode = 'compact' | 'long'; + +interface Props { + from: AddressParam; + to: AddressParam | null; + current?: string; + mode?: Mode | Partial>; + className?: string; + isLoading?: boolean; + tokenHash?: string; + truncation?: EntityProps['truncation']; + noIcon?: boolean; +} + +const AddressFromTo = ({ from, to, current, mode: modeProp, className, isLoading, tokenHash = '', truncation, noIcon }: Props) => { + const mode = useBreakpointValue( + { + base: (typeof modeProp === 'object' ? modeProp.base : modeProp), + lg: (typeof modeProp === 'object' ? modeProp.lg : modeProp), + xl: (typeof modeProp === 'object' ? modeProp.xl : modeProp), + }, + ) ?? 'long'; + + const Entity = tokenHash ? AddressEntityWithTokenFilter : AddressEntity; + + if (mode === 'compact') { + return ( + + + + + + { to ? ( + + ) : - } + + ); + } + + const isOutgoing = current === from.hash; + const iconSizeWithMargins = (5 + (isOutgoing ? 4 : 2) + 3) * 4; + + return ( + + + + { to ? ( + + ) : - } + + ); +}; + +export default chakra(AddressFromTo); diff --git a/ui/shared/address/AddressFromToIcon.pw.tsx b/ui/shared/address/AddressFromToIcon.pw.tsx new file mode 100644 index 0000000000..e65b55479e --- /dev/null +++ b/ui/shared/address/AddressFromToIcon.pw.tsx @@ -0,0 +1,22 @@ +import { Box } from '@chakra-ui/react'; +import { test, expect } from '@playwright/experimental-ct-react'; +import React from 'react'; + +import TestApp from 'playwright/TestApp'; + +import AddressFromToIcon from './AddressFromToIcon'; + +test.use({ viewport: { width: 36, height: 36 } }); + +[ 'in', 'out', 'self', 'unspecified' ].forEach((type) => { + test(`${ type } txn type +@dark-mode`, async({ mount }) => { + const component = await mount( + + + + + , + ); + await expect(component).toHaveScreenshot(); + }); +}); diff --git a/ui/shared/address/AddressFromToIcon.tsx b/ui/shared/address/AddressFromToIcon.tsx new file mode 100644 index 0000000000..de7059696f --- /dev/null +++ b/ui/shared/address/AddressFromToIcon.tsx @@ -0,0 +1,62 @@ +import { Tooltip, chakra, useColorModeValue } from '@chakra-ui/react'; +import React from 'react'; + +import IconSvg from 'ui/shared/IconSvg'; + +import type { TxCourseType } from './utils'; + +interface Props { + isLoading?: boolean; + type: TxCourseType; + className?: string; +} + +const AddressFromToIcon = ({ isLoading, type, className }: Props) => { + const styles = { + 'in': { + color: useColorModeValue('green.500', 'green.200'), + bgColor: useColorModeValue('green.50', 'green.800'), + }, + out: { + color: useColorModeValue('yellow.600', 'yellow.500'), + bgColor: useColorModeValue('orange.50', 'yellow.900'), + }, + self: { + color: useColorModeValue('blackAlpha.400', 'whiteAlpha.400'), + bgColor: useColorModeValue('blackAlpha.50', 'whiteAlpha.50'), + }, + unspecified: { + color: useColorModeValue('gray.500', 'gray.300'), + bgColor: 'transparent', + }, + }; + const labels = { + 'in': 'Incoming txn', + out: 'Outgoing txn', + self: 'Txn to the same address', + }; + + const icon = ( + + ); + + if (type === 'unspecified') { + return icon; + } + + return ( + + { icon } + + ); +}; + +export default React.memo(chakra(AddressFromToIcon)); diff --git a/ui/shared/address/__screenshots__/AddressFromTo.pw.tsx_default_compact-mode-1.png b/ui/shared/address/__screenshots__/AddressFromTo.pw.tsx_default_compact-mode-1.png new file mode 100644 index 0000000000..073c5688d4 Binary files /dev/null and b/ui/shared/address/__screenshots__/AddressFromTo.pw.tsx_default_compact-mode-1.png differ diff --git a/ui/shared/address/__screenshots__/AddressFromTo.pw.tsx_default_incoming-txn-1.png b/ui/shared/address/__screenshots__/AddressFromTo.pw.tsx_default_incoming-txn-1.png new file mode 100644 index 0000000000..3c3e387f1b Binary files /dev/null and b/ui/shared/address/__screenshots__/AddressFromTo.pw.tsx_default_incoming-txn-1.png differ diff --git a/ui/shared/address/__screenshots__/AddressFromTo.pw.tsx_default_loading-state-1.png b/ui/shared/address/__screenshots__/AddressFromTo.pw.tsx_default_loading-state-1.png new file mode 100644 index 0000000000..5f560ebcbf Binary files /dev/null and b/ui/shared/address/__screenshots__/AddressFromTo.pw.tsx_default_loading-state-1.png differ diff --git a/ui/shared/address/__screenshots__/AddressFromTo.pw.tsx_default_outgoing-txn-1.png b/ui/shared/address/__screenshots__/AddressFromTo.pw.tsx_default_outgoing-txn-1.png new file mode 100644 index 0000000000..1e28068da6 Binary files /dev/null and b/ui/shared/address/__screenshots__/AddressFromTo.pw.tsx_default_outgoing-txn-1.png differ diff --git a/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_dark-color-mode_in-txn-type-dark-mode-1.png b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_dark-color-mode_in-txn-type-dark-mode-1.png new file mode 100644 index 0000000000..68968da31c Binary files /dev/null and b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_dark-color-mode_in-txn-type-dark-mode-1.png differ diff --git a/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_dark-color-mode_out-txn-type-dark-mode-1.png b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_dark-color-mode_out-txn-type-dark-mode-1.png new file mode 100644 index 0000000000..b711beedce Binary files /dev/null and b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_dark-color-mode_out-txn-type-dark-mode-1.png differ diff --git a/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_dark-color-mode_self-txn-type-dark-mode-1.png b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_dark-color-mode_self-txn-type-dark-mode-1.png new file mode 100644 index 0000000000..c5936f647f Binary files /dev/null and b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_dark-color-mode_self-txn-type-dark-mode-1.png differ diff --git a/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_dark-color-mode_unspecified-txn-type-dark-mode-1.png b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_dark-color-mode_unspecified-txn-type-dark-mode-1.png new file mode 100644 index 0000000000..78bfd3a44c Binary files /dev/null and b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_dark-color-mode_unspecified-txn-type-dark-mode-1.png differ diff --git a/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_default_in-txn-type-dark-mode-1.png b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_default_in-txn-type-dark-mode-1.png new file mode 100644 index 0000000000..c5b874fc96 Binary files /dev/null and b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_default_in-txn-type-dark-mode-1.png differ diff --git a/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_default_out-txn-type-dark-mode-1.png b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_default_out-txn-type-dark-mode-1.png new file mode 100644 index 0000000000..a871127c88 Binary files /dev/null and b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_default_out-txn-type-dark-mode-1.png differ diff --git a/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_default_self-txn-type-dark-mode-1.png b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_default_self-txn-type-dark-mode-1.png new file mode 100644 index 0000000000..dcc281e8b5 Binary files /dev/null and b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_default_self-txn-type-dark-mode-1.png differ diff --git a/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_default_unspecified-txn-type-dark-mode-1.png b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_default_unspecified-txn-type-dark-mode-1.png new file mode 100644 index 0000000000..1498f7dec8 Binary files /dev/null and b/ui/shared/address/__screenshots__/AddressFromToIcon.pw.tsx_default_unspecified-txn-type-dark-mode-1.png differ diff --git a/ui/shared/address/utils.ts b/ui/shared/address/utils.ts new file mode 100644 index 0000000000..d1329736e0 --- /dev/null +++ b/ui/shared/address/utils.ts @@ -0,0 +1,21 @@ +export type TxCourseType = 'in' | 'out' | 'self' | 'unspecified'; + +export function getTxCourseType(from: string, to: string | undefined, current?: string): TxCourseType { + if (current === undefined) { + return 'unspecified'; + } + + if (to && from === to && from === current) { + return 'self'; + } + + if (from === current) { + return 'out'; + } + + if (to && to === current) { + return 'in'; + } + + return 'unspecified'; +} diff --git a/ui/shared/entities/address/AddressEntity.tsx b/ui/shared/entities/address/AddressEntity.tsx index c13251c0d9..bc817c1af0 100644 --- a/ui/shared/entities/address/AddressEntity.tsx +++ b/ui/shared/entities/address/AddressEntity.tsx @@ -160,10 +160,13 @@ const AddressEntry = (props: EntityProps) => { _before={ !props.isLoading && context?.highlightedAddress === props.address.hash ? { content: `" "`, position: 'absolute', - top: '-7px', + py: 1, + pl: 1, + pr: props.noCopy ? 2 : 0, + top: '-5px', left: '-5px', - width: `calc(100% + ${ props.noCopy ? 10 : 5 }px)`, - height: 'calc(100% + 12px)', + width: `100%`, + height: '100%', borderRadius: 'base', borderColor: highlightedBorderColor, borderWidth: '1px', diff --git a/ui/shared/entities/address/__screenshots__/AddressEntity.pw.tsx_default_hover-1.png b/ui/shared/entities/address/__screenshots__/AddressEntity.pw.tsx_default_hover-1.png index 03e4575a14..0d77e3eb86 100644 Binary files a/ui/shared/entities/address/__screenshots__/AddressEntity.pw.tsx_default_hover-1.png and b/ui/shared/entities/address/__screenshots__/AddressEntity.pw.tsx_default_hover-1.png differ diff --git a/ui/token/TokenTransfer/TokenTransferListItem.tsx b/ui/token/TokenTransfer/TokenTransferListItem.tsx index 95aa336465..63342e6d4f 100644 --- a/ui/token/TokenTransfer/TokenTransferListItem.tsx +++ b/ui/token/TokenTransfer/TokenTransferListItem.tsx @@ -5,11 +5,10 @@ import type { TokenTransfer } from 'types/api/tokenTransfer'; import getCurrencyValue from 'lib/getCurrencyValue'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; +import AddressFromTo from 'ui/shared/address/AddressFromTo'; import Tag from 'ui/shared/chakra/Tag'; -import AddressEntityWithTokenFilter from 'ui/shared/entities/address/AddressEntityWithTokenFilter'; import NftEntity from 'ui/shared/entities/nft/NftEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity'; -import IconSvg from 'ui/shared/IconSvg'; import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile'; import TruncatedValue from 'ui/shared/TruncatedValue'; @@ -53,23 +52,14 @@ const TokenTransferListItem = ({ ) } { method && { method } } - - - - - + { valueStr && (token.type === 'ERC-20' || token.type === 'ERC-1155') && ( diff --git a/ui/token/TokenTransfer/TokenTransferTable.tsx b/ui/token/TokenTransfer/TokenTransferTable.tsx index 6c96ddef94..8ffd5e3912 100644 --- a/ui/token/TokenTransfer/TokenTransferTable.tsx +++ b/ui/token/TokenTransfer/TokenTransferTable.tsx @@ -26,17 +26,15 @@ const TokenTransferTable = ({ data, top, showSocketInfo, socketInfoAlert, socket return ( - +
- + - - - { (tokenType === 'ERC-721' || tokenType === 'ERC-1155') && } + + { (tokenType === 'ERC-721' || tokenType === 'ERC-1155') && } { (tokenType === 'ERC-20' || tokenType === 'ERC-1155') && ( - ) } diff --git a/ui/token/TokenTransfer/TokenTransferTableItem.tsx b/ui/token/TokenTransfer/TokenTransferTableItem.tsx index e3eef16dae..5fa807d1ac 100644 --- a/ui/token/TokenTransfer/TokenTransferTableItem.tsx +++ b/ui/token/TokenTransfer/TokenTransferTableItem.tsx @@ -5,11 +5,10 @@ import type { TokenTransfer } from 'types/api/tokenTransfer'; import getCurrencyValue from 'lib/getCurrencyValue'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; +import AddressFromTo from 'ui/shared/address/AddressFromTo'; import Tag from 'ui/shared/chakra/Tag'; -import AddressEntityWithTokenFilter from 'ui/shared/entities/address/AddressEntityWithTokenFilter'; import NftEntity from 'ui/shared/entities/nft/NftEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity'; -import IconSvg from 'ui/shared/IconSvg'; type Props = TokenTransfer & { tokenId?: string; isLoading?: boolean } @@ -60,26 +59,13 @@ const TokenTransferTableItem = ({ ) : null } - - { (token.type === 'ERC-721' || token.type === 'ERC-1155') && ( diff --git a/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_default_erc1155-mobile-1.png b/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_default_erc1155-mobile-1.png index 883558d9aa..57632cb1b1 100644 Binary files a/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_default_erc1155-mobile-1.png and b/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_default_erc1155-mobile-1.png differ diff --git a/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_default_erc20-mobile-1.png b/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_default_erc20-mobile-1.png index 5382264aea..8f36708ceb 100644 Binary files a/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_default_erc20-mobile-1.png and b/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_default_erc20-mobile-1.png differ diff --git a/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_default_erc721-mobile-1.png b/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_default_erc721-mobile-1.png index d1bc47e9eb..53de197485 100644 Binary files a/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_default_erc721-mobile-1.png and b/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_default_erc721-mobile-1.png differ diff --git a/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_mobile_erc1155-mobile-1.png b/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_mobile_erc1155-mobile-1.png index c6add2e46a..8084dfafbe 100644 Binary files a/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_mobile_erc1155-mobile-1.png and b/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_mobile_erc1155-mobile-1.png differ diff --git a/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_mobile_erc20-mobile-1.png b/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_mobile_erc20-mobile-1.png index 2b6f10df88..b0659575e6 100644 Binary files a/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_mobile_erc20-mobile-1.png and b/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_mobile_erc20-mobile-1.png differ diff --git a/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_mobile_erc721-mobile-1.png b/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_mobile_erc721-mobile-1.png index 3d163bd4ef..6b77acf6c9 100644 Binary files a/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_mobile_erc721-mobile-1.png and b/ui/token/TokenTransfer/__screenshots__/TokenTransfer.pw.tsx_mobile_erc721-mobile-1.png differ diff --git a/ui/tx/__screenshots__/TxDetails.pw.tsx_default_with-token-transfer-mobile-1.png b/ui/tx/__screenshots__/TxDetails.pw.tsx_default_with-token-transfer-mobile-1.png index 974f0373e8..dd982ff5d9 100644 Binary files a/ui/tx/__screenshots__/TxDetails.pw.tsx_default_with-token-transfer-mobile-1.png and b/ui/tx/__screenshots__/TxDetails.pw.tsx_default_with-token-transfer-mobile-1.png differ diff --git a/ui/tx/__screenshots__/TxDetails.pw.tsx_mobile_with-token-transfer-mobile-1.png b/ui/tx/__screenshots__/TxDetails.pw.tsx_mobile_with-token-transfer-mobile-1.png index 58863375dd..0a131e0681 100644 Binary files a/ui/tx/__screenshots__/TxDetails.pw.tsx_mobile_with-token-transfer-mobile-1.png and b/ui/tx/__screenshots__/TxDetails.pw.tsx_mobile_with-token-transfer-mobile-1.png differ diff --git a/ui/tx/__screenshots__/TxInternals.pw.tsx_default_base-view-mobile-1.png b/ui/tx/__screenshots__/TxInternals.pw.tsx_default_base-view-mobile-1.png index 55b8612904..6e0f3ec27a 100644 Binary files a/ui/tx/__screenshots__/TxInternals.pw.tsx_default_base-view-mobile-1.png and b/ui/tx/__screenshots__/TxInternals.pw.tsx_default_base-view-mobile-1.png differ diff --git a/ui/tx/__screenshots__/TxInternals.pw.tsx_mobile_base-view-mobile-1.png b/ui/tx/__screenshots__/TxInternals.pw.tsx_mobile_base-view-mobile-1.png index 80d7e53681..09af681115 100644 Binary files a/ui/tx/__screenshots__/TxInternals.pw.tsx_mobile_base-view-mobile-1.png and b/ui/tx/__screenshots__/TxInternals.pw.tsx_mobile_base-view-mobile-1.png differ diff --git a/ui/tx/details/TxDetailsTokenTransfer.tsx b/ui/tx/details/TxDetailsTokenTransfer.tsx index 6a1c71e342..c31db5852a 100644 --- a/ui/tx/details/TxDetailsTokenTransfer.tsx +++ b/ui/tx/details/TxDetailsTokenTransfer.tsx @@ -4,9 +4,8 @@ import React from 'react'; import type { TokenTransfer as TTokenTransfer, Erc20TotalPayload, Erc721TotalPayload, Erc1155TotalPayload } from 'types/api/tokenTransfer'; import getCurrencyValue from 'lib/getCurrencyValue'; -import AddressEntity from 'ui/shared/entities/address/AddressEntity'; +import AddressFromTo from 'ui/shared/address/AddressFromTo'; import TokenEntity from 'ui/shared/entities/token/TokenEntity'; -import IconSvg from 'ui/shared/IconSvg'; import NftTokenTransferSnippet from 'ui/tx/NftTokenTransferSnippet'; interface Props { @@ -75,11 +74,13 @@ const TxDetailsTokenTransfer = ({ data }: Props) => { flexDir="row" w="100%" > - - - - - + { content } diff --git a/ui/tx/internals/TxInternalsListItem.tsx b/ui/tx/internals/TxInternalsListItem.tsx index df6d73519f..c067fdcc40 100644 --- a/ui/tx/internals/TxInternalsListItem.tsx +++ b/ui/tx/internals/TxInternalsListItem.tsx @@ -1,13 +1,12 @@ -import { Flex, Box, HStack, Skeleton } from '@chakra-ui/react'; +import { Flex, HStack, Skeleton } from '@chakra-ui/react'; import BigNumber from 'bignumber.js'; import React from 'react'; import type { InternalTransaction } from 'types/api/internalTransaction'; import config from 'configs/app'; +import AddressFromTo from 'ui/shared/address/AddressFromTo'; import Tag from 'ui/shared/chakra/Tag'; -import AddressEntity from 'ui/shared/entities/address/AddressEntity'; -import IconSvg from 'ui/shared/IconSvg'; import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile'; import TxStatus from 'ui/shared/statusTag/TxStatus'; import { TX_INTERNALS_ITEMS } from 'ui/tx/internals/utils'; @@ -24,21 +23,13 @@ const TxInternalsListItem = ({ type, from, to, value, success, error, gas_limit: { typeTitle && { typeTitle } } - - - - { toData && ( - - ) } - + Value { config.chain.currency.symbol } diff --git a/ui/tx/internals/TxInternalsTable.tsx b/ui/tx/internals/TxInternalsTable.tsx index 3165688666..f6f215c311 100644 --- a/ui/tx/internals/TxInternalsTable.tsx +++ b/ui/tx/internals/TxInternalsTable.tsx @@ -27,9 +27,7 @@ const TxInternalsTable = ({ data, sort, onSortToggle, top, isLoading }: Props) = - - + - - { showBlockInfo && } - - - + { !config.UI.views.tx.hiddenFields?.value && ( ) } - - - - - - - - + { !config.UI.views.tx.hiddenFields?.value && (
Txn hashTxn hash MethodFrom - ToToken IDFrom/ToToken ID + - - - - -
TypeFrom - ToFrom/To { sort?.includes('value') && } diff --git a/ui/tx/internals/TxInternalsTableItem.tsx b/ui/tx/internals/TxInternalsTableItem.tsx index cfa1bca773..b344b81147 100644 --- a/ui/tx/internals/TxInternalsTableItem.tsx +++ b/ui/tx/internals/TxInternalsTableItem.tsx @@ -5,9 +5,8 @@ import React from 'react'; import type { InternalTransaction } from 'types/api/internalTransaction'; import config from 'configs/app'; +import AddressFromTo from 'ui/shared/address/AddressFromTo'; import Tag from 'ui/shared/chakra/Tag'; -import AddressEntity from 'ui/shared/entities/address/AddressEntity'; -import IconSvg from 'ui/shared/IconSvg'; import TxStatus from 'ui/shared/statusTag/TxStatus'; import { TX_INTERNALS_ITEMS } from 'ui/tx/internals/utils'; @@ -32,22 +31,12 @@ const TxInternalTableItem = ({ type, from, to, value, success, error, gas_limit: - - - - { toData && ( - - ) } - { BigNumber(value).div(BigNumber(10 ** config.chain.currency.decimals)).toFormat() } diff --git a/ui/txs/TxsListItem.tsx b/ui/txs/TxsListItem.tsx index 84ac614f50..422869557d 100644 --- a/ui/txs/TxsListItem.tsx +++ b/ui/txs/TxsListItem.tsx @@ -11,11 +11,9 @@ import config from 'configs/app'; import getValueWithUnit from 'lib/getValueWithUnit'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; import { space } from 'lib/html-entities'; -import AddressEntity from 'ui/shared/entities/address/AddressEntity'; +import AddressFromTo from 'ui/shared/address/AddressFromTo'; import BlockEntity from 'ui/shared/entities/block/BlockEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity'; -import IconSvg from 'ui/shared/IconSvg'; -import InOutTag from 'ui/shared/InOutTag'; import ListItemMobile from 'ui/shared/ListItemMobile/ListItemMobile'; import TxStatus from 'ui/shared/statusTag/TxStatus'; import TxFeeStability from 'ui/shared/tx/TxFeeStability'; @@ -31,15 +29,9 @@ type Props = { isLoading?: boolean; } -const TAG_WIDTH = 48; -const ARROW_WIDTH = 24; - const TxsListItem = ({ tx, isLoading, showBlockInfo, currentAddress, enableTimeIncrement }: Props) => { const dataTo = tx.to ? tx.to : tx.created_contract; - const isOut = Boolean(currentAddress && currentAddress === tx.from.hash); - const isIn = Boolean(currentAddress && currentAddress === tx.to?.hash); - const timeAgo = useTimeAgoIncrement(tx.timestamp, enableTimeIncrement); return ( @@ -89,37 +81,14 @@ const TxsListItem = ({ tx, isLoading, showBlockInfo, currentAddress, enableTimeI /> ) } - - - { (isIn || isOut) ? - : ( - - ) } - { dataTo ? ( - - ) : '-' } - + { !config.UI.views.tx.hiddenFields?.value && ( Value diff --git a/ui/txs/TxsTable.tsx b/ui/txs/TxsTable.tsx index a3493a6f85..23fa528bd4 100644 --- a/ui/txs/TxsTable.tsx +++ b/ui/txs/TxsTable.tsx @@ -1,4 +1,4 @@ -import { Link, Table, Tbody, Tr, Th, Show, Hide } from '@chakra-ui/react'; +import { Link, Table, Tbody, Tr, Th } from '@chakra-ui/react'; import { AnimatePresence } from 'framer-motion'; import React from 'react'; @@ -49,14 +49,7 @@ const TxsTable = ({ Type MethodBlock - From - From / To - - To - From/To diff --git a/ui/txs/TxsTableItem.tsx b/ui/txs/TxsTableItem.tsx index da49947db4..fb94dcba1e 100644 --- a/ui/txs/TxsTableItem.tsx +++ b/ui/txs/TxsTableItem.tsx @@ -2,11 +2,7 @@ import { Tr, Td, VStack, - Show, - Hide, - Flex, Skeleton, - Box, } from '@chakra-ui/react'; import { motion } from 'framer-motion'; import React from 'react'; @@ -15,13 +11,11 @@ import type { Transaction } from 'types/api/transaction'; import config from 'configs/app'; import useTimeAgoIncrement from 'lib/hooks/useTimeAgoIncrement'; +import AddressFromTo from 'ui/shared/address/AddressFromTo'; import Tag from 'ui/shared/chakra/Tag'; import CurrencyValue from 'ui/shared/CurrencyValue'; -import AddressEntity from 'ui/shared/entities/address/AddressEntity'; import BlockEntity from 'ui/shared/entities/block/BlockEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity'; -import IconSvg from 'ui/shared/IconSvg'; -import InOutTag from 'ui/shared/InOutTag'; import TxStatus from 'ui/shared/statusTag/TxStatus'; import TxFeeStability from 'ui/shared/tx/TxFeeStability'; import TxWatchListTags from 'ui/shared/tx/TxWatchListTags'; @@ -39,39 +33,8 @@ type Props = { const TxsTableItem = ({ tx, showBlockInfo, currentAddress, enableTimeIncrement, isLoading }: Props) => { const dataTo = tx.to ? tx.to : tx.created_contract; - const isOut = Boolean(currentAddress && currentAddress === tx.from.hash); - const isIn = Boolean(currentAddress && currentAddress === dataTo?.hash); - const timeAgo = useTimeAgoIncrement(tx.timestamp, enableTimeIncrement); - const addressFrom = ( - - ); - - const addressTo = dataTo ? ( - - ) : '-'; - return (
- { addressFrom } - - { (isIn || isOut) ? - : ( - - - - ) } - - { addressTo } - - - { (isIn || isOut) ? - : ( - - ) } - - { addressFrom } - { addressTo } - - - + + diff --git a/ui/txs/__screenshots__/TxsListItem.pw.tsx_dark-color-mode_base-view-dark-mode-1.png b/ui/txs/__screenshots__/TxsListItem.pw.tsx_dark-color-mode_base-view-dark-mode-1.png index 50ff51df8f..8bc4a380af 100644 Binary files a/ui/txs/__screenshots__/TxsListItem.pw.tsx_dark-color-mode_base-view-dark-mode-1.png and b/ui/txs/__screenshots__/TxsListItem.pw.tsx_dark-color-mode_base-view-dark-mode-1.png differ diff --git a/ui/txs/__screenshots__/TxsListItem.pw.tsx_default_base-view-dark-mode-1.png b/ui/txs/__screenshots__/TxsListItem.pw.tsx_default_base-view-dark-mode-1.png index 304fba7300..a315ee637d 100644 Binary files a/ui/txs/__screenshots__/TxsListItem.pw.tsx_default_base-view-dark-mode-1.png and b/ui/txs/__screenshots__/TxsListItem.pw.tsx_default_base-view-dark-mode-1.png differ diff --git a/ui/txs/__screenshots__/TxsListItem.pw.tsx_default_with-base-address-1.png b/ui/txs/__screenshots__/TxsListItem.pw.tsx_default_with-base-address-1.png index ac6657a22a..2760510fcc 100644 Binary files a/ui/txs/__screenshots__/TxsListItem.pw.tsx_default_with-base-address-1.png and b/ui/txs/__screenshots__/TxsListItem.pw.tsx_default_with-base-address-1.png differ diff --git a/ui/txs/__screenshots__/TxsTable.pw.tsx_dark-color-mode_base-view-dark-mode-1.png b/ui/txs/__screenshots__/TxsTable.pw.tsx_dark-color-mode_base-view-dark-mode-1.png index 06cc6d00d1..01ce8a8bb7 100644 Binary files a/ui/txs/__screenshots__/TxsTable.pw.tsx_dark-color-mode_base-view-dark-mode-1.png and b/ui/txs/__screenshots__/TxsTable.pw.tsx_dark-color-mode_base-view-dark-mode-1.png differ diff --git a/ui/txs/__screenshots__/TxsTable.pw.tsx_default_base-view-dark-mode-1.png b/ui/txs/__screenshots__/TxsTable.pw.tsx_default_base-view-dark-mode-1.png index 8a67393837..463c63ba69 100644 Binary files a/ui/txs/__screenshots__/TxsTable.pw.tsx_default_base-view-dark-mode-1.png and b/ui/txs/__screenshots__/TxsTable.pw.tsx_default_base-view-dark-mode-1.png differ diff --git a/ui/txs/__screenshots__/TxsTable.pw.tsx_default_base-view-screen-xl-1.png b/ui/txs/__screenshots__/TxsTable.pw.tsx_default_base-view-screen-xl-1.png index b006157364..d8833df5a6 100644 Binary files a/ui/txs/__screenshots__/TxsTable.pw.tsx_default_base-view-screen-xl-1.png and b/ui/txs/__screenshots__/TxsTable.pw.tsx_default_base-view-screen-xl-1.png differ