import { useLocaleContext } from '@arcblock/ux/lib/Locale/context'; import type { PaymentDetails, TPaymentMethod } from '@blocklet/payment-types'; import { OpenInNewOutlined } from '@mui/icons-material'; import { Link, Stack, Typography } from '@mui/material'; import { styled } from '@mui/system'; import { getTxLink } from '../../libs/util'; export default function TxLink({ details, method, mode = 'dashboard', align = 'left', size = 20, }: { details: PaymentDetails; method: TPaymentMethod; mode?: 'customer' | 'dashboard'; align?: 'left' | 'right'; size?: number; }) { const { t } = useLocaleContext(); if (!details || (mode === 'customer' && method.type === 'stripe')) { return ( {t('common.none')} ); } const { text, link } = getTxLink(method, details); if (link && text) { return ( {text.length > 40 ? [text.slice(0, 6), text.slice(-6)].join('...') : text} ); } return ( {t('common.none')} ); } const Root = styled(Stack)` @media (max-width: 600px) { svg.MuiSvgIcon-root { display: none !important; } } `;