Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
82f49a49
Unverified
Commit
82f49a49
authored
Mar 24, 2025
by
tom goriunov
Committed by
GitHub
Mar 24, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
`Add token info` button is missing for accounts without an email (#2627)
Fixes #2604
parent
c54a8048
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
15 deletions
+34
-15
AccountActionsMenu.tsx
ui/shared/AccountActionsMenu/AccountActionsMenu.tsx
+1
-6
TokenInfoMenuItem.tsx
ui/shared/AccountActionsMenu/items/TokenInfoMenuItem.tsx
+2
-2
AuthGuard.tsx
ui/snippets/auth/AuthGuard.tsx
+31
-7
No files found.
ui/shared/AccountActionsMenu/AccountActionsMenu.tsx
View file @
82f49a49
...
@@ -10,7 +10,6 @@ import getQueryParamString from 'lib/router/getQueryParamString';
...
@@ -10,7 +10,6 @@ import getQueryParamString from 'lib/router/getQueryParamString';
import
Menu
from
'
ui/shared/chakra/Menu
'
;
import
Menu
from
'
ui/shared/chakra/Menu
'
;
import
Skeleton
from
'
ui/shared/chakra/Skeleton
'
;
import
Skeleton
from
'
ui/shared/chakra/Skeleton
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
useProfileQuery
from
'
ui/snippets/auth/useProfileQuery
'
;
import
MetadataUpdateMenuItem
from
'
./items/MetadataUpdateMenuItem
'
;
import
MetadataUpdateMenuItem
from
'
./items/MetadataUpdateMenuItem
'
;
import
PrivateTagMenuItem
from
'
./items/PrivateTagMenuItem
'
;
import
PrivateTagMenuItem
from
'
./items/PrivateTagMenuItem
'
;
...
@@ -31,14 +30,10 @@ const AccountActionsMenu = ({ isLoading, className, showUpdateMetadataItem }: Pr
...
@@ -31,14 +30,10 @@ const AccountActionsMenu = ({ isLoading, className, showUpdateMetadataItem }: Pr
const
isTokenInstancePage
=
router
.
pathname
===
'
/token/[hash]/instance/[id]
'
;
const
isTokenInstancePage
=
router
.
pathname
===
'
/token/[hash]/instance/[id]
'
;
const
isTxPage
=
router
.
pathname
===
'
/tx/[hash]
'
;
const
isTxPage
=
router
.
pathname
===
'
/tx/[hash]
'
;
const
profileQuery
=
useProfileQuery
();
const
handleButtonClick
=
React
.
useCallback
(()
=>
{
const
handleButtonClick
=
React
.
useCallback
(()
=>
{
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Address actions (more button)
'
});
mixpanel
.
logEvent
(
mixpanel
.
EventTypes
.
PAGE_WIDGET
,
{
Type
:
'
Address actions (more button)
'
});
},
[]);
},
[]);
const
userWithoutEmail
=
profileQuery
.
data
&&
!
profileQuery
.
data
.
email
;
const
items
=
[
const
items
=
[
{
{
render
:
(
props
:
ItemProps
)
=>
<
MetadataUpdateMenuItem
{
...
props
}
/>,
render
:
(
props
:
ItemProps
)
=>
<
MetadataUpdateMenuItem
{
...
props
}
/>,
...
@@ -46,7 +41,7 @@ const AccountActionsMenu = ({ isLoading, className, showUpdateMetadataItem }: Pr
...
@@ -46,7 +41,7 @@ const AccountActionsMenu = ({ isLoading, className, showUpdateMetadataItem }: Pr
},
},
{
{
render
:
(
props
:
ItemProps
)
=>
<
TokenInfoMenuItem
{
...
props
}
/>,
render
:
(
props
:
ItemProps
)
=>
<
TokenInfoMenuItem
{
...
props
}
/>,
enabled
:
config
.
features
.
account
.
isEnabled
&&
isTokenPage
&&
config
.
features
.
addressVerification
.
isEnabled
&&
!
userWithoutEmail
,
enabled
:
config
.
features
.
account
.
isEnabled
&&
isTokenPage
&&
config
.
features
.
addressVerification
.
isEnabled
,
},
},
{
{
render
:
(
props
:
ItemProps
)
=>
<
PrivateTagMenuItem
{
...
props
}
entityType=
{
isTxPage
?
'
tx
'
:
'
address
'
}
/>,
render
:
(
props
:
ItemProps
)
=>
<
PrivateTagMenuItem
{
...
props
}
entityType=
{
isTxPage
?
'
tx
'
:
'
address
'
}
/>,
...
...
ui/shared/AccountActionsMenu/items/TokenInfoMenuItem.tsx
View file @
82f49a49
...
@@ -70,7 +70,7 @@ const TokenInfoMenuItem = ({ className, hash, type }: ItemProps) => {
...
@@ -70,7 +70,7 @@ const TokenInfoMenuItem = ({ className, hash, type }: ItemProps) => {
switch
(
type
)
{
switch
(
type
)
{
case
'
button
'
:
{
case
'
button
'
:
{
return
(
return
(
<
AuthGuard
onAuthSuccess=
{
onAuthSuccess
}
>
<
AuthGuard
onAuthSuccess=
{
onAuthSuccess
}
ensureEmail
>
{
({
onClick
})
=>
(
{
({
onClick
})
=>
(
<
ButtonItem
label=
{
label
}
icon=
{
icon
}
onClick=
{
onClick
}
className=
{
className
}
/>
<
ButtonItem
label=
{
label
}
icon=
{
icon
}
onClick=
{
onClick
}
className=
{
className
}
/>
)
}
)
}
...
@@ -79,7 +79,7 @@ const TokenInfoMenuItem = ({ className, hash, type }: ItemProps) => {
...
@@ -79,7 +79,7 @@ const TokenInfoMenuItem = ({ className, hash, type }: ItemProps) => {
}
}
case
'
menu_item
'
:
{
case
'
menu_item
'
:
{
return
(
return
(
<
AuthGuard
onAuthSuccess=
{
onAuthSuccess
}
>
<
AuthGuard
onAuthSuccess=
{
onAuthSuccess
}
ensureEmail
>
{
({
onClick
})
=>
(
{
({
onClick
})
=>
(
<
MenuItem
className=
{
className
}
onClick=
{
onClick
}
>
<
MenuItem
className=
{
className
}
onClick=
{
onClick
}
>
{
icon
}
{
icon
}
...
...
ui/snippets/auth/AuthGuard.tsx
View file @
82f49a49
...
@@ -2,7 +2,7 @@ import { useDisclosure } from '@chakra-ui/react';
...
@@ -2,7 +2,7 @@ import { useDisclosure } from '@chakra-ui/react';
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
AuthModal
from
'
./AuthModal
'
;
import
AuthModal
from
'
./AuthModal
'
;
import
use
IsAuth
from
'
./useIsAuth
'
;
import
use
ProfileQuery
from
'
./useProfileQuery
'
;
interface
InjectedProps
{
interface
InjectedProps
{
onClick
:
()
=>
void
;
onClick
:
()
=>
void
;
...
@@ -11,27 +11,51 @@ interface InjectedProps {
...
@@ -11,27 +11,51 @@ interface InjectedProps {
interface
Props
{
interface
Props
{
children
:
(
props
:
InjectedProps
)
=>
React
.
ReactNode
;
children
:
(
props
:
InjectedProps
)
=>
React
.
ReactNode
;
onAuthSuccess
:
()
=>
void
;
onAuthSuccess
:
()
=>
void
;
ensureEmail
?:
boolean
;
}
}
const
AuthGuard
=
({
children
,
onAuthSuccess
}:
Props
)
=>
{
const
AuthGuard
=
({
children
,
onAuthSuccess
,
ensureEmail
}:
Props
)
=>
{
const
authModal
=
useDisclosure
();
const
authModal
=
useDisclosure
();
const
isAuth
=
useIsAuth
();
const
profileQuery
=
useProfileQuery
();
const
handleClick
=
React
.
useCallback
(()
=>
{
const
handleClick
=
React
.
useCallback
(()
=>
{
isAuth
?
onAuthSuccess
()
:
authModal
.
onOpen
();
if
(
profileQuery
.
data
)
{
},
[
authModal
,
isAuth
,
onAuthSuccess
]);
if
(
ensureEmail
&&
!
profileQuery
.
data
.
email
)
{
authModal
.
onOpen
();
}
else
{
onAuthSuccess
();
}
}
else
{
authModal
.
onOpen
();
}
},
[
authModal
,
ensureEmail
,
profileQuery
.
data
,
onAuthSuccess
]);
const
handleModalClose
=
React
.
useCallback
((
isSuccess
?:
boolean
)
=>
{
const
handleModalClose
=
React
.
useCallback
((
isSuccess
?:
boolean
)
=>
{
if
(
isSuccess
)
{
if
(
isSuccess
)
{
if
(
ensureEmail
&&
!
profileQuery
.
data
?.
email
)
{
// If the user has logged in and has not added an email
// we need to close the modal and open it again
// so the initial screen will be correct
authModal
.
onClose
();
window
.
setTimeout
(()
=>
{
authModal
.
onOpen
();
},
500
);
return
;
}
onAuthSuccess
();
onAuthSuccess
();
}
}
authModal
.
onClose
();
authModal
.
onClose
();
},
[
authModal
,
onAuthSuccess
]);
},
[
authModal
,
ensureEmail
,
profileQuery
.
data
,
onAuthSuccess
]);
return
(
return
(
<>
<>
{
children
({
onClick
:
handleClick
})
}
{
children
({
onClick
:
handleClick
})
}
{
authModal
.
isOpen
&&
<
AuthModal
onClose=
{
handleModalClose
}
initialScreen=
{
{
type
:
'
select_method
'
}
}
/>
}
{
authModal
.
isOpen
&&
(
<
AuthModal
onClose=
{
handleModalClose
}
initialScreen=
{
profileQuery
.
data
&&
!
profileQuery
.
data
.
email
&&
ensureEmail
?
{
type
:
'
email
'
}
:
{
type
:
'
select_method
'
}
}
/>
)
}
</>
</>
);
);
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment