import { chakra } from '@chakra-ui/react'; import React from 'react'; import { route } from 'nextjs/routes'; import * as EntityBase from 'ui/shared/entities/base/components'; import getChainTooltipText from 'ui/shared/externalChains/getChainTooltipText'; import { distributeEntityProps } from '../base/utils'; type LinkProps = EntityBase.LinkBaseProps & Pick; const Link = chakra((props: LinkProps) => { const defaultHref = route( { pathname: '/cross-chain-tx/[id]', query: { id: props.id } }, { chain: props.chain, external: props.external }, ); return ( { props.children } ); }); type IconProps = EntityBase.IconBaseProps; const Icon = ({ noIcon, ...props }: IconProps) => { // by default, we don't show the icon if (noIcon !== false) { return null; } const hint = (() => { if ('hint' in props) { return props.hint; } if (props.chain && props.shield !== false) { return getChainTooltipText(props.chain, 'Cross-chain transaction on '); } })(); return ( ); }; type ContentProps = Omit & Pick; const Content = chakra((props: ContentProps) => { return ( ); }); type CopyProps = Omit & Pick; const Copy = (props: CopyProps) => { return ( ); }; const Container = EntityBase.Container; export interface EntityProps extends EntityBase.EntityBaseProps { id: string; } const CrossChainMessageEntity = (props: EntityProps) => { const partsProps = distributeEntityProps(props); const content = ; return ( { props.noLink ? content : { content } } ); }; export default React.memo(chakra(CrossChainMessageEntity)); export { Container, Link, Icon, Content, Copy, };