@@ -2,14 +2,15 @@ import { FC } from 'react'
22import { Link as RouterLink } from 'react-router-dom'
33import { useScreenSize } from '../../hooks/useScreensize'
44import MuiLink from '@mui/material/Link'
5- import { TrimLinkLabel , TrimEndLinkLabel } from '../TrimLinkLabel'
65import Typography from '@mui/material/Typography'
76import { COLORS } from '../../../styles/theme/colors'
7+ import { trimLongString } from '../..//utils/trimLongString'
88import { HighlightedText } from '../HighlightedText'
99import Box from '@mui/material/Box'
1010import { AccountMetadataSourceIndicator } from '../Account/AccountMetadataSourceIndicator'
1111import { MaybeWithTooltip } from '../Tooltip/MaybeWithTooltip'
1212import { WithHighlighting } from '../HighlightingContext/WithHighlighting'
13+ import { HighlightedTrimmedText } from '../HighlightedText/HighlightedTrimmedText'
1314
1415type LinkProps = {
1516 address : string
@@ -73,9 +74,13 @@ type CustomTrimEndLinkLabelProps = {
7374 highlightedPart ?: string
7475}
7576
76- const CustomTrimEndLinkLabel : FC < CustomTrimEndLinkLabelProps > = ( { name, to, highlightedPart } ) => (
77- < TrimEndLinkLabel label = { name } to = { to } trimStart = { 14 } highlightedPart = { highlightedPart } />
78- )
77+ const CustomTrimEndLinkLabel : FC < CustomTrimEndLinkLabelProps > = ( { name, to, highlightedPart } ) => {
78+ return (
79+ < MuiLink component = { RouterLink } to = { to } >
80+ < HighlightedTrimmedText text = { name } pattern = { highlightedPart } fragmentLength = { 14 } />
81+ </ MuiLink >
82+ )
83+ }
7984
8085type TabletLinkProps = {
8186 address : string
@@ -88,7 +93,11 @@ const TabletLink: FC<TabletLinkProps> = ({ address, name, to, highlightedPart })
8893 if ( name ) {
8994 return < CustomTrimEndLinkLabel name = { name } to = { to } highlightedPart = { highlightedPart } />
9095 }
91- return < TrimLinkLabel label = { address } to = { to } />
96+ return (
97+ < MuiLink component = { RouterLink } to = { to } >
98+ { trimLongString ( address ) }
99+ </ MuiLink >
100+ )
92101}
93102
94103type DesktopLinkProps = TabletLinkProps & {
@@ -102,7 +111,9 @@ const DesktopLink: FC<DesktopLinkProps> = ({ address, name, to, alwaysTrim, high
102111 { name ? (
103112 < CustomTrimEndLinkLabel name = { name } to = { to } highlightedPart = { highlightedPart } />
104113 ) : (
105- < TrimLinkLabel label = { address } to = { to } />
114+ < MuiLink component = { RouterLink } to = { to } >
115+ { trimLongString ( address ) }
116+ </ MuiLink >
106117 ) }
107118 </ WithHighlighting >
108119 )
0 commit comments