Skip to content

Commit 0d6af53

Browse files
authored
chore: only allow to select managed account (#12211)
1 parent 9094b8d commit 0d6af53

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

packages/plugins/Web3Profile/src/SiteAdaptor/components/ProfilePopup.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ const useStyles = makeStyles()((theme) => ({
106106
padding: theme.spacing(1.5),
107107
borderRadius: 8,
108108
},
109+
disabled: {
110+
opacity: 0.5,
111+
cursor: 'not-allowed',
112+
},
109113
listItemText: {
110114
margin: 0,
111115
},
@@ -130,7 +134,7 @@ export const ProfilePopup = memo<ProfilePopupProps>(function ProfilePopup({
130134
onChange,
131135
walletName,
132136
}) {
133-
const { classes } = useStyles()
137+
const { classes, cx } = useStyles()
134138
const Utils = useWeb3Utils()
135139

136140
const { account: walletAddress } = useChainContext()
@@ -161,12 +165,16 @@ export const ProfilePopup = memo<ProfilePopupProps>(function ProfilePopup({
161165
const name = account.metadata?.name || account.username?.localName
162166
const ownerAddress: EvmAddress = account.username?.ownedBy
163167
const accountId = account.username?.id
168+
const disabled =
169+
(currentAccountId && currentAccountId === accountId) ||
170+
available.__typename !== 'AccountManaged'
164171
return (
165172
<ListItemButton
166-
className={classes.item}
173+
className={cx(classes.item, { [classes.disabled]: disabled })}
167174
key={accountId}
175+
disabled={disabled}
168176
onClick={() => {
169-
if (currentAccountId && currentAccountId === accountId) return
177+
if (disabled) return
170178
onChange(account)
171179
}}>
172180
<ListItemIcon>

0 commit comments

Comments
 (0)