Commit 401f4962 authored by tom's avatar tom

remove usage of AddressIcon

parent b17946c5
...@@ -4,8 +4,7 @@ import React from 'react'; ...@@ -4,8 +4,7 @@ import React from 'react';
import { useAccount, useDisconnect } from 'wagmi'; import { useAccount, useDisconnect } from 'wagmi';
import useIsMobile from 'lib/hooks/useIsMobile'; import useIsMobile from 'lib/hooks/useIsMobile';
import AddressIcon from 'ui/shared/address/AddressIcon'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import AddressLink from 'ui/shared/address/AddressLink';
const ContractConnectWallet = () => { const ContractConnectWallet = () => {
const { open, isOpen } = useWeb3Modal(); const { open, isOpen } = useWeb3Modal();
...@@ -47,8 +46,12 @@ const ContractConnectWallet = () => { ...@@ -47,8 +46,12 @@ const ContractConnectWallet = () => {
<Flex columnGap={ 3 } rowGap={ 3 } alignItems={{ base: 'flex-start', lg: 'center' }} flexDir={{ base: 'column', lg: 'row' }}> <Flex columnGap={ 3 } rowGap={ 3 } alignItems={{ base: 'flex-start', lg: 'center' }} flexDir={{ base: 'column', lg: 'row' }}>
<Flex alignItems="center"> <Flex alignItems="center">
<span>Connected to </span> <span>Connected to </span>
<AddressIcon address={{ hash: address, is_contract: false, implementation_name: null }} mx={ 2 }/> <AddressEntity
<AddressLink type="address" fontWeight={ 600 } hash={ address } truncation={ isMobile ? 'constant' : 'dynamic' }/> address={{ hash: address, name: '', is_contract: false, implementation_name: null }}
truncation={ isMobile ? 'constant' : 'dynamic' }
fontWeight={ 600 }
ml={ 2 }
/>
</Flex> </Flex>
<Button onClick={ handleDisconnect } size="sm" variant="outline">Disconnect</Button> <Button onClick={ handleDisconnect } size="sm" variant="outline">Disconnect</Button>
</Flex> </Flex>
......
...@@ -4,16 +4,12 @@ import React from 'react'; ...@@ -4,16 +4,12 @@ import React from 'react';
import type { L2DepositsItem } from 'types/api/l2Deposits'; import type { L2DepositsItem } from 'types/api/l2Deposits';
import { route } from 'nextjs-routes';
import config from 'configs/app'; import config from 'configs/app';
import dayjs from 'lib/date/dayjs'; import dayjs from 'lib/date/dayjs';
import AddressIcon from 'ui/shared/address/AddressIcon'; import AddressEntityL1 from 'ui/shared/entities/address/AddressEntityL1';
import BlockEntityL1 from 'ui/shared/entities/block/BlockEntityL1'; import BlockEntityL1 from 'ui/shared/entities/block/BlockEntityL1';
import TxEntity from 'ui/shared/entities/tx/TxEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity';
import TxEntityL1 from 'ui/shared/entities/tx/TxEntityL1'; import TxEntityL1 from 'ui/shared/entities/tx/TxEntityL1';
import HashStringShortenDynamic from 'ui/shared/HashStringShortenDynamic';
import LinkExternal from 'ui/shared/LinkExternal';
import ListItemMobileGrid from 'ui/shared/ListItemMobile/ListItemMobileGrid'; import ListItemMobileGrid from 'ui/shared/ListItemMobile/ListItemMobileGrid';
const feature = config.features.rollup; const feature = config.features.rollup;
...@@ -31,7 +27,7 @@ const DepositsListItem = ({ item, isLoading }: Props) => { ...@@ -31,7 +27,7 @@ const DepositsListItem = ({ item, isLoading }: Props) => {
<ListItemMobileGrid.Container> <ListItemMobileGrid.Container>
<ListItemMobileGrid.Label isLoading={ isLoading }>L1 block No</ListItemMobileGrid.Label> <ListItemMobileGrid.Label isLoading={ isLoading }>L1 block No</ListItemMobileGrid.Label>
<ListItemMobileGrid.Value py="3px"> <ListItemMobileGrid.Value>
<BlockEntityL1 <BlockEntityL1
number={ item.l1_block_number } number={ item.l1_block_number }
isLoading={ isLoading } isLoading={ isLoading }
...@@ -42,7 +38,7 @@ const DepositsListItem = ({ item, isLoading }: Props) => { ...@@ -42,7 +38,7 @@ const DepositsListItem = ({ item, isLoading }: Props) => {
</ListItemMobileGrid.Value> </ListItemMobileGrid.Value>
<ListItemMobileGrid.Label isLoading={ isLoading }>L2 txn hash</ListItemMobileGrid.Label> <ListItemMobileGrid.Label isLoading={ isLoading }>L2 txn hash</ListItemMobileGrid.Label>
<ListItemMobileGrid.Value py="3px"> <ListItemMobileGrid.Value>
<TxEntity <TxEntity
isLoading={ isLoading } isLoading={ isLoading }
hash={ item.l2_tx_hash } hash={ item.l2_tx_hash }
...@@ -57,7 +53,7 @@ const DepositsListItem = ({ item, isLoading }: Props) => { ...@@ -57,7 +53,7 @@ const DepositsListItem = ({ item, isLoading }: Props) => {
</ListItemMobileGrid.Value> </ListItemMobileGrid.Value>
<ListItemMobileGrid.Label isLoading={ isLoading }>L1 txn hash</ListItemMobileGrid.Label> <ListItemMobileGrid.Label isLoading={ isLoading }>L1 txn hash</ListItemMobileGrid.Label>
<ListItemMobileGrid.Value py="3px"> <ListItemMobileGrid.Value>
<TxEntityL1 <TxEntityL1
isLoading={ isLoading } isLoading={ isLoading }
hash={ item.l1_tx_hash } hash={ item.l1_tx_hash }
...@@ -67,19 +63,12 @@ const DepositsListItem = ({ item, isLoading }: Props) => { ...@@ -67,19 +63,12 @@ const DepositsListItem = ({ item, isLoading }: Props) => {
</ListItemMobileGrid.Value> </ListItemMobileGrid.Value>
<ListItemMobileGrid.Label isLoading={ isLoading }>L1 txn origin</ListItemMobileGrid.Label> <ListItemMobileGrid.Label isLoading={ isLoading }>L1 txn origin</ListItemMobileGrid.Label>
<ListItemMobileGrid.Value py="3px"> <ListItemMobileGrid.Value>
<LinkExternal <AddressEntityL1
href={ feature.L1BaseUrl + route({ pathname: '/address/[hash]', query: { hash: item.l1_tx_origin } }) } address={{ hash: item.l1_tx_origin, name: '', is_contract: false, is_verified: false, implementation_name: '' }}
maxW="100%"
display="flex"
overflow="hidden"
isLoading={ isLoading } isLoading={ isLoading }
> noCopy
<AddressIcon address={{ hash: item.l1_tx_origin, is_contract: false, implementation_name: '' }} isLoading={ isLoading }/> />
<Skeleton isLoaded={ !isLoading } w="calc(100% - 44px)" overflow="hidden" whiteSpace="nowrap" ml={ 2 }>
<HashStringShortenDynamic hash={ item.l1_tx_origin }/>
</Skeleton>
</LinkExternal>
</ListItemMobileGrid.Value> </ListItemMobileGrid.Value>
<ListItemMobileGrid.Label isLoading={ isLoading }>Gas limit</ListItemMobileGrid.Label> <ListItemMobileGrid.Label isLoading={ isLoading }>Gas limit</ListItemMobileGrid.Label>
......
...@@ -4,16 +4,12 @@ import React from 'react'; ...@@ -4,16 +4,12 @@ import React from 'react';
import type { L2DepositsItem } from 'types/api/l2Deposits'; import type { L2DepositsItem } from 'types/api/l2Deposits';
import { route } from 'nextjs-routes';
import config from 'configs/app'; import config from 'configs/app';
import dayjs from 'lib/date/dayjs'; import dayjs from 'lib/date/dayjs';
import AddressIcon from 'ui/shared/address/AddressIcon'; import AddressEntityL1 from 'ui/shared/entities/address/AddressEntityL1';
import BlockEntityL1 from 'ui/shared/entities/block/BlockEntityL1'; import BlockEntityL1 from 'ui/shared/entities/block/BlockEntityL1';
import TxEntity from 'ui/shared/entities/tx/TxEntity'; import TxEntity from 'ui/shared/entities/tx/TxEntity';
import TxEntityL1 from 'ui/shared/entities/tx/TxEntityL1'; import TxEntityL1 from 'ui/shared/entities/tx/TxEntityL1';
import HashStringShorten from 'ui/shared/HashStringShorten';
import LinkExternal from 'ui/shared/LinkExternal';
const feature = config.features.rollup; const feature = config.features.rollup;
...@@ -59,18 +55,12 @@ const WithdrawalsTableItem = ({ item, isLoading }: Props) => { ...@@ -59,18 +55,12 @@ const WithdrawalsTableItem = ({ item, isLoading }: Props) => {
/> />
</Td> </Td>
<Td verticalAlign="middle"> <Td verticalAlign="middle">
<LinkExternal <AddressEntityL1
href={ feature.L1BaseUrl + route({ pathname: '/address/[hash]', query: { hash: item.l1_tx_origin } }) } address={{ hash: item.l1_tx_origin, name: '', is_contract: false, is_verified: false, implementation_name: '' }}
maxW="100%"
display="inline-flex"
overflow="hidden"
isLoading={ isLoading } isLoading={ isLoading }
> truncation="constant"
<AddressIcon address={{ hash: item.l1_tx_origin, is_contract: false, implementation_name: '' }} isLoading={ isLoading }/> noCopy
<Skeleton isLoaded={ !isLoading } w="calc(100% - 44px)" overflow="hidden" whiteSpace="nowrap" ml={ 2 }> />
<HashStringShorten hash={ item.l1_tx_origin }/>
</Skeleton>
</LinkExternal>
</Td> </Td>
<Td verticalAlign="middle" isNumeric> <Td verticalAlign="middle" isNumeric>
<Skeleton isLoaded={ !isLoading } color="text_secondary" display="inline-block"> <Skeleton isLoaded={ !isLoading } color="text_secondary" display="inline-block">
......
...@@ -41,10 +41,6 @@ const WithdrawalsListItem = ({ item, isLoading }: Props) => { ...@@ -41,10 +41,6 @@ const WithdrawalsListItem = ({ item, isLoading }: Props) => {
address={ item.from } address={ item.from }
isLoading={ isLoading } isLoading={ isLoading }
/> />
{ /* <Address>
<AddressIcon address={ item.from } isLoading={ isLoading }/>
<AddressLink hash={ item.from.hash } type="address" truncation="dynamic" ml={ 2 } isLoading={ isLoading }/>
</Address> */ }
</ListItemMobileGrid.Value> </ListItemMobileGrid.Value>
</> </>
) } ) }
......
...@@ -8,10 +8,8 @@ import config from 'configs/app'; ...@@ -8,10 +8,8 @@ import config from 'configs/app';
import AddressFavoriteButton from 'ui/address/details/AddressFavoriteButton'; import AddressFavoriteButton from 'ui/address/details/AddressFavoriteButton';
import AddressQrCode from 'ui/address/details/AddressQrCode'; import AddressQrCode from 'ui/address/details/AddressQrCode';
import AddressAddToWallet from 'ui/shared/address/AddressAddToWallet'; import AddressAddToWallet from 'ui/shared/address/AddressAddToWallet';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import AddressActionsMenu from 'ui/shared/AddressActions/Menu'; import AddressActionsMenu from 'ui/shared/AddressActions/Menu';
import CopyToClipboard from 'ui/shared/CopyToClipboard'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
interface Props { interface Props {
address: Pick<Address, 'hash' | 'is_contract' | 'implementation_name' | 'watchlist_names' | 'watchlist_address_id'>; address: Pick<Address, 'hash' | 'is_contract' | 'implementation_name' | 'watchlist_names' | 'watchlist_address_id'>;
...@@ -23,18 +21,14 @@ interface Props { ...@@ -23,18 +21,14 @@ interface Props {
const AddressHeadingInfo = ({ address, token, isLinkDisabled, isLoading }: Props) => { const AddressHeadingInfo = ({ address, token, isLinkDisabled, isLoading }: Props) => {
return ( return (
<Flex alignItems="center"> <Flex alignItems="center">
<AddressIcon address={ address } isLoading={ isLoading }/> <AddressEntity
<AddressLink address={ address }
type="address" isLoading={ isLoading }
hash={ address.hash }
ml={ 2 }
fontFamily="heading" fontFamily="heading"
fontSize="lg" fontSize="lg"
fontWeight={ 500 } fontWeight={ 500 }
isDisabled={ isLinkDisabled } noLink={ isLinkDisabled }
isLoading={ isLoading }
/> />
<CopyToClipboard text={ address.hash } isLoading={ isLoading }/>
{ !isLoading && address.is_contract && token && <AddressAddToWallet ml={ 2 } token={ token }/> } { !isLoading && address.is_contract && token && <AddressAddToWallet ml={ 2 } token={ token }/> }
{ !isLoading && !address.is_contract && config.features.account.isEnabled && ( { !isLoading && !address.is_contract && config.features.account.isEnabled && (
<AddressFavoriteButton hash={ address.hash } watchListId={ address.watchlist_address_id } ml={ 3 }/> <AddressFavoriteButton hash={ address.hash } watchListId={ address.watchlist_address_id } ml={ 3 }/>
......
import { chakra } from '@chakra-ui/react';
import React from 'react';
import { route } from 'nextjs-routes';
import config from 'configs/app';
import * as AddressEntity from './AddressEntity';
const feature = config.features.rollup;
const AddressEntityL1 = (props: AddressEntity.EntityProps) => {
if (!feature.isEnabled) {
return null;
}
const defaultHref = feature.L1BaseUrl + route({
pathname: '/address/[hash]',
query: {
...props.query,
hash: props.address.hash,
},
});
return (
<AddressEntity.default { ...props } href={ props.href ?? defaultHref } isExternal/>
);
};
export default chakra(AddressEntityL1);
...@@ -9,10 +9,9 @@ import iconCheck from 'icons/check.svg'; ...@@ -9,10 +9,9 @@ import iconCheck from 'icons/check.svg';
import iconCross from 'icons/cross.svg'; import iconCross from 'icons/cross.svg';
import iconSuccess from 'icons/status/success.svg'; import iconSuccess from 'icons/status/success.svg';
import dayjs from 'lib/date/dayjs'; import dayjs from 'lib/date/dayjs';
import AddressIcon from 'ui/shared/address/AddressIcon';
import AddressLink from 'ui/shared/address/AddressLink';
import Icon from 'ui/shared/chakra/Icon'; import Icon from 'ui/shared/chakra/Icon';
import CopyToClipboard from 'ui/shared/CopyToClipboard'; import CopyToClipboard from 'ui/shared/CopyToClipboard';
import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import HashStringShorten from 'ui/shared/HashStringShorten'; import HashStringShorten from 'ui/shared/HashStringShorten';
interface Props { interface Props {
...@@ -28,17 +27,18 @@ const VerifiedContractsTableItem = ({ data, isLoading }: Props) => { ...@@ -28,17 +27,18 @@ const VerifiedContractsTableItem = ({ data, isLoading }: Props) => {
return ( return (
<Tr> <Tr>
<Td> <Td>
<Flex columnGap={ 2 }> <AddressEntity
<AddressIcon address={ data.address } isLoading={ isLoading }/> address={ data.address }
<Flex columnGap={ 2 } flexWrap="wrap" w="calc(100% - 32px)"> isLoading={ isLoading }
<AddressLink hash={ data.address.hash } type="address" alias={ data.address.name } isLoading={ isLoading } my={ 1 } query={{ tab: 'contract' }}/> query={{ tab: 'contract' }}
<Flex alignItems="center"> noCopy
<Skeleton isLoaded={ !isLoading } color="text_secondary" my={ 1 }> mt={ 1 }
<HashStringShorten hash={ data.address.hash } isTooltipDisabled/> />
</Skeleton> <Flex alignItems="center" ml={ 7 }>
<CopyToClipboard text={ data.address.hash } isLoading={ isLoading }/> <Skeleton isLoaded={ !isLoading } color="text_secondary" my={ 1 }>
</Flex> <HashStringShorten hash={ data.address.hash } isTooltipDisabled/>
</Flex> </Skeleton>
<CopyToClipboard text={ data.address.hash } isLoading={ isLoading }/>
</Flex> </Flex>
</Td> </Td>
<Td isNumeric> <Td isNumeric>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment