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
e07fd2aa
Commit
e07fd2aa
authored
Mar 13, 2025
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
close user profile dropdown after click on buttons/link inside it
parent
c39a3908
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
31 deletions
+40
-31
popover.tsx
toolkit/chakra/popover.tsx
+7
-1
AuthModal.tsx
ui/snippets/auth/AuthModal.tsx
+0
-1
UserProfileContent.tsx
ui/snippets/user/profile/UserProfileContent.tsx
+8
-7
UserProfileContentWallet.tsx
ui/snippets/user/profile/UserProfileContentWallet.tsx
+5
-0
UserProfileDesktop.tsx
ui/snippets/user/profile/UserProfileDesktop.tsx
+10
-11
UserProfileMobile.tsx
ui/snippets/user/profile/UserProfileMobile.tsx
+10
-11
No files found.
toolkit/chakra/popover.tsx
View file @
e07fd2aa
...
...
@@ -55,10 +55,16 @@ export const PopoverCloseTriggerWrapper = React.forwardRef<
HTMLButtonElement
,
ChakraPopover
.
CloseTriggerProps
>
(
function
PopoverCloseTriggerWrapper
(
props
,
ref
)
{
const
{
disabled
,
...
rest
}
=
props
;
if
(
disabled
)
{
return
props
.
children
;
}
return
(
<
ChakraPopover
.
CloseTrigger
ref=
{
ref
}
{
...
props
}
{
...
rest
}
asChild
/>
);
...
...
ui/snippets/auth/AuthModal.tsx
View file @
e07fd2aa
...
...
@@ -19,7 +19,6 @@ import AuthModalScreenSelectMethod from './screens/AuthModalScreenSelectMethod';
import
AuthModalScreenSuccessEmail
from
'
./screens/AuthModalScreenSuccessEmail
'
;
import
AuthModalScreenSuccessWallet
from
'
./screens/AuthModalScreenSuccessWallet
'
;
// TODO @tom2drum: check login flow
const
feature
=
config
.
features
.
account
;
interface
Props
{
...
...
ui/snippets/user/profile/UserProfileContent.tsx
View file @
e07fd2aa
...
...
@@ -64,6 +64,11 @@ const UserProfileContent = ({ data, onClose, onLogin, onAddEmail, onAddAddress }
const
{
isAutoConnectDisabled
}
=
useMarketplaceContext
();
const
logout
=
useLogout
();
const
handleLogoutClick
=
React
.
useCallback
(()
=>
{
logout
();
onClose
();
},
[
logout
,
onClose
]);
if
(
!
data
)
{
return
(
<
Box
>
...
...
@@ -96,17 +101,13 @@ const UserProfileContent = ({ data, onClose, onLogin, onAddEmail, onAddAddress }
ml=
{
1
}
/>
{
data
?.
address_hash
?
<
Box
ml=
"auto"
>
{
shortenString
(
data
?.
address_hash
)
}
</
Box
>
:
<
Link
ml=
"auto"
onClick=
{
onAddAddress
}
>
Add address
</
Link
>
}
<
Box
ml=
"auto"
>
{
shortenString
(
data
?.
address_hash
)
}
</
Box
>
:
<
Link
ml=
"auto"
onClick=
{
onAddAddress
}
>
Add address
</
Link
>
}
</
Flex
>
)
}
<
Flex
p=
{
2
}
columnGap=
{
4
}
>
<
Box
mr=
"auto"
>
Email
</
Box
>
{
data
?.
email
?
<
TruncatedValue
value=
{
data
.
email
}
/>
:
<
Link
onClick=
{
onAddEmail
}
>
Add email
</
Link
>
}
<
TruncatedValue
value=
{
data
.
email
}
/>
:
<
Link
onClick=
{
onAddEmail
}
>
Add email
</
Link
>
}
</
Flex
>
</
Box
>
...
...
@@ -127,7 +128,7 @@ const UserProfileContent = ({ data, onClose, onLogin, onAddEmail, onAddAddress }
<
UserProfileContentNavLink
text=
"Sign out"
icon=
"sign_out"
onClick=
{
logout
}
onClick=
{
handleLogoutClick
}
/>
</
Box
>
);
...
...
ui/snippets/user/profile/UserProfileContentWallet.tsx
View file @
e07fd2aa
...
...
@@ -32,6 +32,10 @@ const UserProfileContentWallet = ({ onClose, className }: Props) => {
onClose
?.();
},
[
web3Wallet
,
onClose
]);
const
handleAddressClick
=
React
.
useCallback
(()
=>
{
onClose
?.();
},
[
onClose
]);
const
content
=
(()
=>
{
if
(
web3Wallet
.
isConnected
&&
web3AccountWithDomain
.
address
)
{
return
(
...
...
@@ -52,6 +56,7 @@ const UserProfileContentWallet = ({ onClose, className }: Props) => {
fontSize=
"sm"
fontWeight=
{
500
}
noAltHash
onClick=
{
handleAddressClick
}
/>
{
web3Wallet
.
isReconnecting
?
<
Spinner
size=
"sm"
m=
"2px"
flexShrink=
{
0
}
/>
:
(
<
IconButton
...
...
ui/snippets/user/profile/UserProfileDesktop.tsx
View file @
e07fd2aa
...
...
@@ -51,29 +51,28 @@ const UserProfileDesktop = ({ buttonSize, buttonVariant = 'header' }: Props) =>
const
handleAddEmailClick
=
React
.
useCallback
(()
=>
{
setAuthInitialScreen
({
type
:
'
email
'
,
isAuth
:
true
});
authModal
.
onOpen
();
},
[
authModal
]);
profileMenu
.
onClose
();
},
[
authModal
,
profileMenu
]);
const
handleAddAddressClick
=
React
.
useCallback
(()
=>
{
setAuthInitialScreen
({
type
:
'
connect_wallet
'
,
isAuth
:
true
,
loginToRewards
:
true
});
authModal
.
onOpen
();
},
[
authModal
]);
profileMenu
.
onClose
();
},
[
authModal
,
profileMenu
]);
const
handleAuthModalClose
=
React
.
useCallback
(()
=>
{
setAuthInitialScreen
(
initialScreen
);
authModal
.
onClose
();
},
[
authModal
]);
const
handleOpenChange
=
React
.
useCallback
(({
open
}:
{
open
:
boolean
})
=>
{
if
(
open
)
{
profileMenu
.
onOpen
();
}
else
{
profileMenu
.
onClose
();
}
},
[
profileMenu
]);
const
handleLoginClick
=
React
.
useCallback
(()
=>
{
authModal
.
onOpen
();
profileMenu
.
onClose
();
},
[
authModal
,
profileMenu
]);
return
(
<>
<
PopoverRoot
positioning=
{
{
placement
:
'
bottom-end
'
}
}
open=
{
profileMenu
.
open
}
onOpenChange=
{
handle
OpenChange
}
>
<
PopoverRoot
positioning=
{
{
placement
:
'
bottom-end
'
}
}
open=
{
profileMenu
.
open
}
onOpenChange=
{
profileMenu
.
on
OpenChange
}
>
<
PopoverTrigger
>
<
UserProfileButton
profileQuery=
{
profileQuery
}
...
...
@@ -88,7 +87,7 @@ const UserProfileDesktop = ({ buttonSize, buttonVariant = 'header' }: Props) =>
<
UserProfileContent
data=
{
profileQuery
.
data
}
onClose=
{
profileMenu
.
onClose
}
onLogin=
{
authModal
.
onOpen
}
onLogin=
{
handleLoginClick
}
onAddEmail=
{
handleAddEmailClick
}
onAddAddress=
{
handleAddAddressClick
}
/>
...
...
ui/snippets/user/profile/UserProfileMobile.tsx
View file @
e07fd2aa
...
...
@@ -45,31 +45,30 @@ const UserProfileMobile = () => {
const
handleAddEmailClick
=
React
.
useCallback
(()
=>
{
setAuthInitialScreen
({
type
:
'
email
'
,
isAuth
:
true
});
authModal
.
onOpen
();
},
[
authModal
]);
profileMenu
.
onClose
();
},
[
authModal
,
profileMenu
]);
const
handleAddAddressClick
=
React
.
useCallback
(()
=>
{
setAuthInitialScreen
({
type
:
'
connect_wallet
'
,
isAuth
:
true
,
loginToRewards
:
true
});
authModal
.
onOpen
();
},
[
authModal
]);
profileMenu
.
onClose
();
},
[
authModal
,
profileMenu
]);
const
handleAuthModalClose
=
React
.
useCallback
(()
=>
{
setAuthInitialScreen
(
initialScreen
);
authModal
.
onClose
();
},
[
authModal
]);
const
handleDrawerOpenChange
=
React
.
useCallback
(({
open
}:
{
open
:
boolean
})
=>
{
if
(
profileQuery
.
data
||
web3Address
)
{
open
?
profileMenu
.
onOpen
()
:
profileMenu
.
onClose
();
}
else
{
authModal
.
onOpen
();
}
},
[
profileQuery
.
data
,
web3Address
,
authModal
,
profileMenu
]);
const
handleLoginClick
=
React
.
useCallback
(()
=>
{
authModal
.
onOpen
();
profileMenu
.
onClose
();
},
[
authModal
,
profileMenu
]);
return
(
<>
<
DrawerRoot
open=
{
profileMenu
.
open
}
onOpenChange=
{
handleDrawer
OpenChange
}
onOpenChange=
{
profileMenu
.
on
OpenChange
}
>
<
DrawerBackdrop
/>
<
DrawerTrigger
>
...
...
@@ -84,7 +83,7 @@ const UserProfileMobile = () => {
<
UserProfileContent
data=
{
profileQuery
.
data
}
onClose=
{
profileMenu
.
onClose
}
onLogin=
{
authModal
.
onOpen
}
onLogin=
{
handleLoginClick
}
onAddEmail=
{
handleAddEmailClick
}
onAddAddress=
{
handleAddAddressClick
}
/>
...
...
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