@@ -90,6 +90,9 @@ class NavBar extends Component {
90
90
profileAnchorEl : null ,
91
91
} ;
92
92
93
+ this . hoveringProfileArea = false ;
94
+ this . closeTimeout = null ;
95
+
93
96
this . initKeplr = this . initKeplr . bind ( this ) ;
94
97
this . handleFetch = this . handleFetch . bind ( this ) ;
95
98
this . handleFetchValidators = this . handleFetchValidators . bind ( this ) ;
@@ -497,6 +500,24 @@ class NavBar extends Component {
497
500
} ) ;
498
501
} ;
499
502
503
+ handleProfileMouseEnter = ( event ) => {
504
+ this . hoveringProfileArea = true ;
505
+ clearTimeout ( this . closeTimeout ) ;
506
+
507
+ if ( ! this . state . profileAnchorEl ) {
508
+ this . setState ( { profileAnchorEl : event . currentTarget } ) ;
509
+ }
510
+ } ;
511
+
512
+ handleProfileMouseLeave = ( ) => {
513
+ this . hoveringProfileArea = false ;
514
+ this . closeTimeout = setTimeout ( ( ) => {
515
+ if ( ! this . hoveringProfileArea ) {
516
+ this . setState ( { profileAnchorEl : null } ) ;
517
+ }
518
+ } , 200 ) ;
519
+ } ;
520
+
500
521
render ( ) {
501
522
const { profileAnchorEl } = this . state ;
502
523
const profileOpen = Boolean ( profileAnchorEl ) ;
@@ -546,8 +567,8 @@ class NavBar extends Component {
546
567
</ CustomTooltip > : null }
547
568
{ localStorage . getItem ( 'of_co_address' ) || this . props . address
548
569
? ( < div
549
- onMouseEnter = { this . handleProfilePopoverOpen }
550
- onMouseLeave = { this . handleProfilePopoverClose }
570
+ onMouseEnter = { this . handleProfileMouseEnter }
571
+ onMouseLeave = { this . handleProfileMouseLeave }
551
572
className = "profile_button"
552
573
style = { { cursor : 'pointer' , position : 'relative' } }
553
574
>
@@ -556,6 +577,8 @@ class NavBar extends Component {
556
577
< ProfilePopover
557
578
anchorEl = { profileAnchorEl }
558
579
open = { profileOpen }
580
+ onMouseEnter = { this . handleProfileMouseEnter }
581
+ onMouseLeave = { this . handleProfileMouseLeave }
559
582
onClose = { this . handleProfilePopoverClose }
560
583
/>
561
584
) }
0 commit comments