mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* envs and feature setup * home page layout * cross-chain txs page * cross-chain transfers page * cross-chain transfers on tx page * cross-chain messages on tx page * cross-chain tx page * cross-chain tx details token transfers * stats and counters for lists * migrate to new API version * add swagger * mobile lists * placeholder views on address page * tests * fix adaptive tabs initial state when there is only one tab in the list * tweaks * bug fixes * fix tests * update screenshots * migrate to new api version * add chain label tooltip, copy button to txs in lists and same address highlight * list views on address page * fix tests * fix links to current address in the list views * update tooltips * update tables layout * review fixes * fix spelling * update screenshots * update screenshot
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import type { StackProps } from '@chakra-ui/react';
|
|
import { Box, Flex, HStack } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import type { ExternalChain } from 'types/externalChains';
|
|
|
|
import { Skeleton } from 'toolkit/chakra/skeleton';
|
|
import { Tooltip } from 'toolkit/chakra/tooltip';
|
|
import CopyToClipboard from 'ui/shared/CopyToClipboard';
|
|
|
|
import ChainIcon from './ChainIcon';
|
|
|
|
interface Props extends StackProps {
|
|
data: Omit<ExternalChain, 'explorer_url'> | undefined;
|
|
isLoading?: boolean;
|
|
fallback?: React.ReactNode;
|
|
}
|
|
|
|
const ChainLabel = ({ data, isLoading, fallback, ...rest }: Props) => {
|
|
if (!data) {
|
|
return fallback || null;
|
|
}
|
|
|
|
const content = (
|
|
<>
|
|
<Box fontWeight={ 600 }>{ data.name }</Box>
|
|
<Flex alignItems="center" justifyContent="center">
|
|
ChainID: { data.id }
|
|
<CopyToClipboard text={ data.id } noTooltip/>
|
|
</Flex>
|
|
</>
|
|
);
|
|
|
|
return (
|
|
<HStack w="full" whiteSpace="nowrap" { ...rest }>
|
|
<ChainIcon data={ data } isLoading={ isLoading } noTooltip/>
|
|
<Tooltip content={ content } interactive>
|
|
<Skeleton loading={ isLoading } overflow="hidden" textOverflow="ellipsis">
|
|
{ data.name }
|
|
</Skeleton>
|
|
</Tooltip>
|
|
</HStack>
|
|
);
|
|
};
|
|
|
|
export default React.memo(ChainLabel);
|