Skip to content

Commit

Permalink
[name] Shorten ANS names down to a shorter name
Browse files Browse the repository at this point in the history
  • Loading branch information
gregnazario committed Oct 23, 2024
1 parent 5d5f981 commit 7aea428
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/components/HashButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from "../themes/colors/aptosColorPalette";
import ChevronRightRoundedIcon from "@mui/icons-material/ChevronRightRounded";
import ChevronLeftRoundedIcon from "@mui/icons-material/ChevronLeftRounded";
import {truncateAddress, truncateAddressMiddle} from "../pages/utils";
import {truncate, truncateAddress, truncateAddressMiddle} from "../pages/utils";
import {assertNever} from "../utils";
import {useGetNameFromAddress} from "../api/hooks/useGetANS";
import ContentCopyIcon from "@mui/icons-material/ContentCopy";
Expand Down Expand Up @@ -157,8 +157,8 @@ function AccountHashButtonInner({
textDecoration: "none",
}}
>
<Tooltip title={hash} enterDelay={500} enterNextDelay={500}>
<span>{name ?? truncateHash}</span>
<Tooltip title={name ?? hash} enterDelay={500} enterNextDelay={500}>
<span>{name ? truncate(name, 9, 9, "...") : truncateHash}</span>
</Tooltip>
<Tooltip title="Copied" open={copyTooltipOpen}>
<Button
Expand Down
2 changes: 1 addition & 1 deletion src/pages/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export function timestampDisplay(timestamp: moment.Moment): TimestampDisplay {
};
}

function truncate(
export function truncate(
str: string,
frontLen: number,
backLen: number,
Expand Down

0 comments on commit 7aea428

Please sign in to comment.