Skip to content

Commit

Permalink
Show edit name icon only when url match selected wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
buberdds committed Oct 13, 2023
1 parent be9ab93 commit be3ba44
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/pages/AccountPage/Features/AccountSummary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export function AccountSummary({ address, balance, wallet, walletHasAccounts }:
const isMobile = useContext(ResponsiveContext) === 'small'
const ticker = useSelector(selectTicker)
const unlockedStatus = useSelector(selectUnlockedStatus)
const unlockedProfile = unlockedStatus === 'unlockedProfile'
const canEditName = unlockedStatus === 'unlockedProfile' && address === wallet?.address
const editHandler = (name: string) => {
if (!wallet) {
throw new Error('Wallet not provided')
Expand Down Expand Up @@ -136,11 +136,11 @@ export function AccountSummary({ address, balance, wallet, walletHasAccounts }:
>
<Box pad="small" direction="row-responsive" flex justify="between">
<Box width={{ max: isMobile ? '100%' : '75%' }}>
{!unlockedProfile && <AddressBox address={address} separator />}
{unlockedProfile && !wallet?.name && (
{!canEditName && <AddressBox address={address} separator />}
{canEditName && !wallet?.name && (
<EditableAddressBox address={address} openEditModal={() => setLayerVisibility(true)} />
)}
{unlockedProfile && wallet?.name && (
{canEditName && wallet?.name && (
<EditableNameBox
address={address}
openEditModal={() => setLayerVisibility(true)}
Expand Down Expand Up @@ -181,7 +181,7 @@ export function AccountSummary({ address, balance, wallet, walletHasAccounts }:
)}
</Box>
</Box>
{layerVisibility && wallet && unlockedProfile && (
{layerVisibility && wallet && canEditName && (
<ManageableAccountEditModal
animation
closeHandler={() => setLayerVisibility(false)}
Expand Down

0 comments on commit be3ba44

Please sign in to comment.