Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/mask/src/plugins/Avatar/SNSAdaptor/NFTAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
ChainId,
SocketState,
ERC721TokenDetailed,
formatEthereumAddress,
useAccount,
useChainId,
useCollectibles,
useImageChecker,
Expand All @@ -18,6 +16,7 @@ import { useI18N } from '../../../utils'
import { EthereumChainBoundary } from '../../../web3/UI/EthereumChainBoundary'
import { AddNFT } from './AddNFT'
import { NFTImage } from './NFTImage'
import { useAccount, useWeb3State } from '@masknet/plugin-infra'

const useStyles = makeStyles()((theme) => ({
root: {},
Expand Down Expand Up @@ -99,6 +98,7 @@ export function NFTAvatar(props: NFTAvatarProps) {
const [open_, setOpen_] = useState(false)
const [collectibles_, setCollectibles_] = useState<ERC721TokenDetailed[]>([])
const { t } = useI18N()
const { Utils } = useWeb3State()
const { data: collectibles, error, retry, state } = useCollectibles(account, ChainId.Mainnet)

const onClick = useCallback(async () => {
Expand Down Expand Up @@ -140,7 +140,7 @@ export function NFTAvatar(props: NFTAvatarProps) {
</Typography>
{account ? (
<Typography variant="body1" color="textPrimary" className={classes.account}>
{t('nft_wallet_label')}: {formatEthereumAddress(account, 4)}
{t('nft_wallet_label')}: {Utils?.formatAddress?.(account, 4) || account}
<Button
variant="text"
onClick={openSelectProviderDialog}
Expand Down
11 changes: 9 additions & 2 deletions packages/mask/src/plugins/Avatar/SNSAdaptor/NFTAvatarRing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export function NFTAvatarRing(props: NFTAvatarRingProps) {
const { classes } = useStyles()
const { stroke, strokeWidth, fontSize, text, width, id, price } = props

const avatarSize = width + 3
const avatarSize = width + 1
const R = avatarSize / 2
const path_r = R - strokeWidth + fontSize / 2
const x1 = R - path_r
Expand Down Expand Up @@ -59,7 +59,14 @@ export function NFTAvatarRing(props: NFTAvatarRingProps) {
</linearGradient>
</defs>

<circle cx={R} cy={R} r={R - strokeWidth / 2} fill="none" stroke={stroke} strokeWidth={strokeWidth} />
<circle
cx={R}
cy={R}
r={R - strokeWidth / 2 + 1}
fill="none"
stroke={stroke}
strokeWidth={strokeWidth}
/>
<pattern id={`${id}-pattern`} x="0" y="0" width="300%" height="100%" patternUnits="userSpaceOnUse">
<circle cx={R} cy={R} r={R} fill={`url(#${id}-gradient)`}>
<animateTransform
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ function NFTAvatarInTwitter() {

useUpdateEffect(() => {
const linkParentDom = searchTwitterAvatarLinkSelector().evaluate()?.closest('div')

if (!avatar || !linkParentDom) return
if (!avatar || !linkParentDom || !showAvatar) return

const handler = () => {
window.open(resolveOpenSeaLink(avatar.address, avatar.tokenId), '_blank')
Expand Down