mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
65 lines
1.5 KiB
TypeScript
65 lines
1.5 KiB
TypeScript
import type { UseQueryResult } from '@tanstack/react-query';
|
|
import React from 'react';
|
|
|
|
import type { TokenVerifiedInfo as TTokenVerifiedInfo } from 'types/api/token';
|
|
|
|
import config from 'configs/app';
|
|
import type { ResourceError } from 'lib/api/resources';
|
|
import { Link } from 'toolkit/next/link';
|
|
import { Skeleton } from '@luxfi/ui/skeleton';
|
|
|
|
import TokenProjectInfo from './TokenProjectInfo';
|
|
|
|
interface Props {
|
|
verifiedInfoQuery: UseQueryResult<TTokenVerifiedInfo, ResourceError<unknown>>;
|
|
}
|
|
|
|
const TokenVerifiedInfo = ({ verifiedInfoQuery }: Props) => {
|
|
|
|
const { data, isPending, isError } = verifiedInfoQuery;
|
|
|
|
const content = (() => {
|
|
if (!config.features.verifiedTokens.isEnabled) {
|
|
return null;
|
|
}
|
|
|
|
if (isPending) {
|
|
return (
|
|
<>
|
|
<Skeleton loading w="100px" h="30px" borderRadius="base"/>
|
|
<Skeleton loading w="100px" h="30px" borderRadius="base"/>
|
|
<Skeleton loading w="70px" h="30px" borderRadius="base"/>
|
|
</>
|
|
);
|
|
}
|
|
|
|
if (isError) {
|
|
return null;
|
|
}
|
|
|
|
const websiteLink = (() => {
|
|
try {
|
|
const url = new URL(data.projectWebsite);
|
|
return (
|
|
<Link external href={ data.projectWebsite } variant="underlaid" className="shrink-0 text-sm">
|
|
{ url.host }
|
|
</Link>
|
|
);
|
|
} catch (error) {
|
|
return null;
|
|
}
|
|
})();
|
|
|
|
return (
|
|
<>
|
|
{ websiteLink }
|
|
<TokenProjectInfo data={ data }/>
|
|
</>
|
|
);
|
|
})();
|
|
|
|
return content;
|
|
};
|
|
|
|
export default React.memo(TokenVerifiedInfo);
|