Commit 5d19b2a1 authored by tom's avatar tom

manage incomplete data

parent 85f1bcb4
...@@ -38,6 +38,8 @@ export const PAGE_TYPE_DICT: Record<Route['pathname'], string> = { ...@@ -38,6 +38,8 @@ export const PAGE_TYPE_DICT: Record<Route['pathname'], string> = {
'/zkevm-l2-txn-batches': 'ZkEvm L2 Tx batches', '/zkevm-l2-txn-batches': 'ZkEvm L2 Tx batches',
'/zkevm-l2-txn-batch/[number]': 'ZkEvm L2 Tx batch details', '/zkevm-l2-txn-batch/[number]': 'ZkEvm L2 Tx batch details',
'/404': '404', '/404': '404',
'/name-domains': 'Domains search and resolve',
'/name-domains/[name]': 'Domain details',
// service routes, added only to make typescript happy // service routes, added only to make typescript happy
'/login': 'Login', '/login': 'Login',
......
...@@ -3,10 +3,10 @@ export interface EnsDomain { ...@@ -3,10 +3,10 @@ export interface EnsDomain {
name: string; name: string;
resolvedAddress: { resolvedAddress: {
hash: string; hash: string;
}; } | null;
owner: { owner: {
hash: string; hash: string;
}; } | null;
registrationDate?: string; registrationDate?: string;
expiryDate?: string; expiryDate?: string;
} }
...@@ -15,7 +15,7 @@ export interface EnsDomainDetailed extends EnsDomain { ...@@ -15,7 +15,7 @@ export interface EnsDomainDetailed extends EnsDomain {
tokenId: string; tokenId: string;
registrant: { registrant: {
hash: string; hash: string;
}; } | null;
otherAddresses: Record<string, string>; otherAddresses: Record<string, string>;
} }
...@@ -24,7 +24,7 @@ export interface EnsDomainEvent { ...@@ -24,7 +24,7 @@ export interface EnsDomainEvent {
timestamp: string; timestamp: string;
fromAddress: { fromAddress: {
hash: string; hash: string;
}; } | null;
action?: string; action?: string;
} }
......
...@@ -40,10 +40,12 @@ const AddressEnsDomains = ({ addressHash, mainDomainName }: Props) => { ...@@ -40,10 +40,12 @@ const AddressEnsDomains = ({ addressHash, mainDomainName }: Props) => {
const mainDomain = data.items.find((domain) => domain.name === mainDomainName); const mainDomain = data.items.find((domain) => domain.name === mainDomainName);
const ownedDomains = data.items.filter((domain) => const ownedDomains = data.items.filter((domain) =>
domain.owner &&
domain.owner.hash.toLowerCase() === addressHash.toLowerCase() && domain.owner.hash.toLowerCase() === addressHash.toLowerCase() &&
domain.name !== mainDomainName, domain.name !== mainDomainName,
); );
const resolvedDomains = data.items.filter((domain) => const resolvedDomains = data.items.filter((domain) =>
domain.resolvedAddress &&
domain.resolvedAddress.hash.toLowerCase() === addressHash.toLowerCase() && domain.resolvedAddress.hash.toLowerCase() === addressHash.toLowerCase() &&
domain.name !== mainDomainName, domain.name !== mainDomainName,
); );
......
...@@ -71,6 +71,7 @@ const NameDomainDetails = ({ query }: Props) => { ...@@ -71,6 +71,7 @@ const NameDomainDetails = ({ query }: Props) => {
</Skeleton> </Skeleton>
</DetailsInfoItem> </DetailsInfoItem>
) } ) }
{ query.data?.registrant && (
<DetailsInfoItem <DetailsInfoItem
title="Registrant" title="Registrant"
hint="The account that owns the domain name and has the rights to edit its ownership and records" hint="The account that owns the domain name and has the rights to edit its ownership and records"
...@@ -79,7 +80,7 @@ const NameDomainDetails = ({ query }: Props) => { ...@@ -79,7 +80,7 @@ const NameDomainDetails = ({ query }: Props) => {
flexWrap="nowrap" flexWrap="nowrap"
> >
<AddressEntity <AddressEntity
address={ query.data?.registrant } address={ query.data.registrant }
isLoading={ isLoading } isLoading={ isLoading }
/> />
{ /* TODO @tom2drum add correct href */ } { /* TODO @tom2drum add correct href */ }
...@@ -89,6 +90,8 @@ const NameDomainDetails = ({ query }: Props) => { ...@@ -89,6 +90,8 @@ const NameDomainDetails = ({ query }: Props) => {
</LinkInternal> </LinkInternal>
</Tooltip> </Tooltip>
</DetailsInfoItem> </DetailsInfoItem>
) }
{ query.data?.owner && (
<DetailsInfoItem <DetailsInfoItem
title="Controller" title="Controller"
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"
...@@ -97,7 +100,7 @@ const NameDomainDetails = ({ query }: Props) => { ...@@ -97,7 +100,7 @@ const NameDomainDetails = ({ query }: Props) => {
flexWrap="nowrap" flexWrap="nowrap"
> >
<AddressEntity <AddressEntity
address={ query.data?.owner } address={ query.data.owner }
isLoading={ isLoading } isLoading={ isLoading }
/> />
{ /* TODO @tom2drum add correct href */ } { /* TODO @tom2drum add correct href */ }
...@@ -107,6 +110,7 @@ const NameDomainDetails = ({ query }: Props) => { ...@@ -107,6 +110,7 @@ const NameDomainDetails = ({ query }: Props) => {
</LinkInternal> </LinkInternal>
</Tooltip> </Tooltip>
</DetailsInfoItem> </DetailsInfoItem>
) }
<DetailsInfoItem <DetailsInfoItem
title="Token ID" title="Token ID"
hint="The Token ID of this domain name NFT" hint="The Token ID of this domain name NFT"
......
...@@ -14,7 +14,6 @@ import NameDomainDetails from 'ui/nameDomain/NameDomainDetails'; ...@@ -14,7 +14,6 @@ import NameDomainDetails from 'ui/nameDomain/NameDomainDetails';
import NameDomainHistory from 'ui/nameDomain/NameDomainHistory'; import NameDomainHistory from 'ui/nameDomain/NameDomainHistory';
import TextAd from 'ui/shared/ad/TextAd'; import TextAd from 'ui/shared/ad/TextAd';
import Icon from 'ui/shared/chakra/Icon'; import Icon from 'ui/shared/chakra/Icon';
import DataFetchAlert from 'ui/shared/DataFetchAlert';
import AddressEntity from 'ui/shared/entities/address/AddressEntity'; import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import EnsEntity from 'ui/shared/entities/ens/EnsEntity'; import EnsEntity from 'ui/shared/entities/ens/EnsEntity';
import LinkInternal from 'ui/shared/LinkInternal'; import LinkInternal from 'ui/shared/LinkInternal';
...@@ -43,7 +42,7 @@ const NameDomain = () => { ...@@ -43,7 +42,7 @@ const NameDomain = () => {
const tabIndex = useTabIndexFromQuery(tabs); const tabIndex = useTabIndexFromQuery(tabs);
if (infoQuery.isError) { if (infoQuery.isError) {
return <DataFetchAlert/>; throw new Error(undefined, { cause: infoQuery.error });
} }
const isLoading = infoQuery.isPlaceholderData; const isLoading = infoQuery.isPlaceholderData;
...@@ -56,6 +55,7 @@ const NameDomain = () => { ...@@ -56,6 +55,7 @@ const NameDomain = () => {
noLink noLink
maxW="300px" maxW="300px"
/> />
{ infoQuery.data?.resolvedAddress && (
<AddressEntity <AddressEntity
address={ infoQuery.data?.resolvedAddress } address={ infoQuery.data?.resolvedAddress }
isLoading={ isLoading } isLoading={ isLoading }
...@@ -63,6 +63,7 @@ const NameDomain = () => { ...@@ -63,6 +63,7 @@ const NameDomain = () => {
noLink noLink
flexShrink={ 0 } flexShrink={ 0 }
/> />
) }
{ /* TODO @tom2drum add correct href */ } { /* TODO @tom2drum add correct href */ }
<Tooltip label="Lookup for related domain names"> <Tooltip label="Lookup for related domain names">
<LinkInternal flexShrink={ 0 } display="inline-flex"> <LinkInternal flexShrink={ 0 } display="inline-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