Commit a90b72a9 authored by tom's avatar tom

small fixes

parent c2bc780d
import { Button, chakra, Flex, Grid, Popover, PopoverBody, PopoverContent, PopoverTrigger, Skeleton, useDisclosure } from '@chakra-ui/react'; import { Button, chakra, Flex, Grid, Popover, PopoverBody, PopoverContent, PopoverTrigger, Skeleton, useDisclosure } from '@chakra-ui/react';
import _clamp from 'lodash/clamp';
import React from 'react'; import React from 'react';
import type { EnsDomain } from 'types/api/ens';
import { route } from 'nextjs-routes'; import { route } from 'nextjs-routes';
import config from 'configs/app'; import config from 'configs/app';
...@@ -15,6 +18,19 @@ interface Props { ...@@ -15,6 +18,19 @@ interface Props {
mainDomainName: string | null; mainDomainName: string | null;
} }
const DomainsGrid = ({ data }: { data: Array<EnsDomain> }) => {
return (
<Grid
templateColumns={{ base: `repeat(${ _clamp(data.length, 1, 2) }, 1fr)`, lg: `repeat(${ _clamp(data.length, 1, 3) }, 1fr)` }}
columnGap={ 8 }
rowGap={ 4 }
mt={ 2 }
>
{ data.slice(0, 9).map((domain) => <EnsEntity key={ domain.id } name={ domain.name } noCopy/>) }
</Grid>
);
};
const AddressEnsDomains = ({ addressHash, mainDomainName }: Props) => { const AddressEnsDomains = ({ addressHash, mainDomainName }: Props) => {
const { isOpen, onToggle, onClose } = useDisclosure(); const { isOpen, onToggle, onClose } = useDisclosure();
...@@ -86,7 +102,7 @@ const AddressEnsDomains = ({ addressHash, mainDomainName }: Props) => { ...@@ -86,7 +102,7 @@ const AddressEnsDomains = ({ addressHash, mainDomainName }: Props) => {
flexShrink={ 0 } flexShrink={ 0 }
> >
<IconSvg name="ENS_slim" boxSize={ 5 }/> <IconSvg name="ENS_slim" boxSize={ 5 }/>
<chakra.span ml={ 1 } display={{ base: 'none', lg: 'block' }}>{ totalRecords } Domains</chakra.span> <chakra.span ml={ 1 } display={{ base: 'none', lg: 'block' }}>{ totalRecords } Domain{ data.items.length > 1 ? 's' : '' }</chakra.span>
<IconSvg name="arrows/east-mini" transform={ isOpen ? 'rotate(90deg)' : 'rotate(-90deg)' } transitionDuration="faster" boxSize={ 5 }/> <IconSvg name="arrows/east-mini" transform={ isOpen ? 'rotate(90deg)' : 'rotate(-90deg)' } transitionDuration="faster" boxSize={ 5 }/>
</Button> </Button>
</PopoverTrigger> </PopoverTrigger>
...@@ -105,17 +121,13 @@ const AddressEnsDomains = ({ addressHash, mainDomainName }: Props) => { ...@@ -105,17 +121,13 @@ const AddressEnsDomains = ({ addressHash, mainDomainName }: Props) => {
{ ownedDomains.length > 0 && ( { ownedDomains.length > 0 && (
<div> <div>
<chakra.span color="text_secondary" fontSize="xs">Other domain names owned by this address</chakra.span> <chakra.span color="text_secondary" fontSize="xs">Other domain names owned by this address</chakra.span>
<Grid templateColumns={{ base: 'repeat(2, 1fr)', lg: 'repeat(3, 1fr)' }} columnGap={ 8 } rowGap={ 4 } mt={ 2 }> <DomainsGrid data={ ownedDomains }/>
{ ownedDomains.slice(0, 9).map((domain) => <EnsEntity key={ domain.id } name={ domain.name } noCopy/>) }
</Grid>
</div> </div>
) } ) }
{ resolvedDomains.length > 0 && ( { resolvedDomains.length > 0 && (
<div> <div>
<chakra.span color="text_secondary" fontSize="xs">Other domain names resolved to this address</chakra.span> <chakra.span color="text_secondary" fontSize="xs">Other domain names resolved to this address</chakra.span>
<Grid templateColumns={{ base: 'repeat(2, 1fr)', lg: 'repeat(3, 1fr)' }} columnGap={ 8 } rowGap={ 4 } mt={ 2 }> <DomainsGrid data={ resolvedDomains }/>
{ resolvedDomains.slice(0, 9).map((domain) => <EnsEntity key={ domain.id } name={ domain.name } noCopy/>) }
</Grid>
</div> </div>
) } ) }
{ (ownedDomains.length > 9 || resolvedDomains.length > 9) && ( { (ownedDomains.length > 9 || resolvedDomains.length > 9) && (
......
...@@ -91,7 +91,7 @@ const NameDomainDetails = ({ query }: Props) => { ...@@ -91,7 +91,7 @@ const NameDomainDetails = ({ query }: Props) => {
) } ) }
{ query.data?.owner && ( { query.data?.owner && (
<DetailsInfoItem <DetailsInfoItem
title="Controller" title="Owner"
hint="The account that owns the rights to edit the records of this domain name" hint="The account that owns the rights to edit the records of this domain name"
isLoading={ isLoading } isLoading={ isLoading }
columnGap={ 2 } columnGap={ 2 }
...@@ -114,7 +114,7 @@ const NameDomainDetails = ({ query }: Props) => { ...@@ -114,7 +114,7 @@ const NameDomainDetails = ({ query }: Props) => {
) } ) }
{ query.data?.wrapped_owner && ( { query.data?.wrapped_owner && (
<DetailsInfoItem <DetailsInfoItem
title="Wrapped controller" title="Manager"
hint="Owner of this NFT domain in NameWrapper contract" hint="Owner of this NFT domain in NameWrapper contract"
isLoading={ isLoading } isLoading={ isLoading }
columnGap={ 2 } columnGap={ 2 }
......
...@@ -16,18 +16,18 @@ const NameDomainHistoryTableItem = ({ isLoading, transaction_hash: transactionHa ...@@ -16,18 +16,18 @@ const NameDomainHistoryTableItem = ({ isLoading, transaction_hash: transactionHa
return ( return (
<Tr> <Tr>
<Td> <Td verticalAlign="middle">
<TxEntity hash={ transactionHash } isLoading={ isLoading } fontWeight={ 700 }/> <TxEntity hash={ transactionHash } isLoading={ isLoading } fontWeight={ 700 }/>
</Td> </Td>
<Td pl={ 9 }> <Td pl={ 9 } verticalAlign="middle">
<Skeleton isLoaded={ !isLoading } color="text_secondary" display="inline-block"> <Skeleton isLoaded={ !isLoading } color="text_secondary" display="inline-block">
<span>{ dayjs(timestamp).fromNow() }</span> <span>{ dayjs(timestamp).fromNow() }</span>
</Skeleton> </Skeleton>
</Td> </Td>
<Td> <Td verticalAlign="middle">
{ fromAddress && <AddressEntity address={ fromAddress } isLoading={ isLoading }/> } { fromAddress && <AddressEntity address={ fromAddress } isLoading={ isLoading }/> }
</Td> </Td>
<Td> <Td verticalAlign="middle">
{ action && <Tag colorScheme="gray" isLoading={ isLoading }>{ action }</Tag> } { action && <Tag colorScheme="gray" isLoading={ isLoading }>{ action }</Tag> }
</Td> </Td>
</Tr> </Tr>
......
...@@ -42,6 +42,7 @@ const NameDomainsActionBar = ({ ...@@ -42,6 +42,7 @@ const NameDomainsActionBar = ({
const searchInput = ( const searchInput = (
<FilterInput <FilterInput
w={{ base: '100%', lg: '360px' }} w={{ base: '100%', lg: '360px' }}
minW={{ base: 'auto', lg: '250px' }}
size="xs" size="xs"
onChange={ onSearchChange } onChange={ onSearchChange }
placeholder="Search by name" placeholder="Search by name"
......
...@@ -204,7 +204,7 @@ const AddressPageContent = () => { ...@@ -204,7 +204,7 @@ const AddressPageContent = () => {
<AccountActionsMenu isLoading={ isLoading }/> <AccountActionsMenu isLoading={ isLoading }/>
<HStack ml="auto" gap={ 2 }/> <HStack ml="auto" gap={ 2 }/>
{ addressQuery.data?.is_contract && addressQuery.data?.is_verified && config.UI.views.address.solidityscanEnabled && <SolidityscanReport hash={ hash }/> } { addressQuery.data?.is_contract && addressQuery.data?.is_verified && config.UI.views.address.solidityscanEnabled && <SolidityscanReport hash={ hash }/> }
{ addressQuery.data && config.features.nameService.isEnabled && { !isLoading && addressQuery.data && config.features.nameService.isEnabled &&
<AddressEnsDomains addressHash={ hash } mainDomainName={ addressQuery.data.ens_domain_name }/> } <AddressEnsDomains addressHash={ hash } mainDomainName={ addressQuery.data.ens_domain_name }/> }
<NetworkExplorers type="address" pathParam={ hash }/> <NetworkExplorers type="address" pathParam={ hash }/>
</Flex> </Flex>
......
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