Skip to content

Commit

Permalink
fix AccountIcon
Browse files Browse the repository at this point in the history
  • Loading branch information
josepot committed Nov 27, 2024
1 parent b46bf07 commit 6fe4c22
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Components/AccountIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,18 @@ import { FC, SVGAttributes, useMemo } from "react"

export const stringShorten = (input: string, preLen: number): string =>
input.length > preLen * 2 + 2
? `${input.slice(preLen)}${input.slice(-preLen)}`
? `${input.slice(0, preLen)}${input.slice(-preLen)}`
: input

export function AccountIcon({
address,
name,
small,
showAddress,
}: {
address: string
name?: string
small?: boolean
showAddress?: boolean
}) {
const btnTitle = name || address
const publicKey = useMemo(() => AccountId().enc(address), [address])
return (
<div
Expand All @@ -32,7 +29,7 @@ export function AccountIcon({
small ? "text-body-2 " : "text-body"
} whitespace-nowrap`}
>
{stringShorten(btnTitle, 4)}
{stringShorten(address, 8)}
</div>
)}
</div>
Expand Down

0 comments on commit 6fe4c22

Please sign in to comment.