Files
explore/ui/nameServices/directories/ClustersDirectoryTableItem.tsx

52 lines
1.7 KiB
TypeScript

import React from 'react';
import type { ClustersDirectoryObject } from 'types/api/clusters';
import { isEvmAddress } from 'lib/address/isEvmAddress';
import { Skeleton } from '@luxfi/ui/skeleton';
import { TableCell, TableRow } from '@luxfi/ui/table';
import AddressEntity from 'ui/shared/entities/address/AddressEntity';
import ClustersEntity from 'ui/shared/entities/clusters/ClustersEntity';
import TimeWithTooltip from 'ui/shared/time/TimeWithTooltip';
interface Props {
item: ClustersDirectoryObject;
isLoading?: boolean;
isClusterDetailsLoading?: boolean;
}
const ClustersDirectoryTableItem = ({ item, isLoading, isClusterDetailsLoading }: Props) => {
return (
<TableRow>
<TableCell verticalAlign="middle">
<ClustersEntity clusterName={ item.name } isLoading={ isLoading } className="font-semibold"/>
</TableCell>
<TableCell verticalAlign="middle">
{ item.owner && (
<AddressEntity
address={{ hash: item.owner }}
isLoading={ isLoading }
className="font-medium w-fit max-w-full"
noLink={ !isEvmAddress(item.owner) }
/>
) }
{ !item.owner && <Skeleton loading={ isLoading }>—</Skeleton> }
</TableCell>
<TableCell verticalAlign="middle">
<TimeWithTooltip
timestamp={ item.createdAt }
isLoading={ isLoading }
enableIncrement={ true }
/>
</TableCell>
<TableCell verticalAlign="middle">
<Skeleton loading={ isLoading || isClusterDetailsLoading }>
{ (item.chainIds?.length || 1) } { (item.chainIds?.length || 1) === 1 ? 'chain' : 'chains' }
</Skeleton>
</TableCell>
</TableRow>
);
};
export default React.memo(ClustersDirectoryTableItem);