Merge pull request #3849 from mempool/mononaut/icon-reset-scroll
Reset blockchain scroll on logo click
This commit is contained in:
		
						commit
						73f69d5312
					
				@ -1,7 +1,7 @@
 | 
			
		||||
<ng-container *ngIf="{ val: network$ | async } as network">
 | 
			
		||||
<header>
 | 
			
		||||
  <nav class="navbar navbar-expand-md navbar-dark bg-dark">
 | 
			
		||||
  <a class="navbar-brand" [ngClass]="{'dual-logos': subdomain}" [routerLink]="['/' | relativeUrl]">
 | 
			
		||||
  <a class="navbar-brand" [ngClass]="{'dual-logos': subdomain}" [routerLink]="['/' | relativeUrl]" (click)="brandClick($event)">
 | 
			
		||||
  <ng-template [ngIf]="subdomain">
 | 
			
		||||
    <div class="subdomain_container">
 | 
			
		||||
      <img [src]="'/api/v1/enterprise/images/' + subdomain + '/logo'" class="subdomain_logo">
 | 
			
		||||
 | 
			
		||||
@ -53,4 +53,8 @@ export class MasterPageComponent implements OnInit {
 | 
			
		||||
  onResize(): void {
 | 
			
		||||
    this.isMobile = window.innerWidth <= 767.98;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  brandClick(e): void {
 | 
			
		||||
    this.stateService.resetScroll$.next(true);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -25,6 +25,7 @@ export class StartComponent implements OnInit, OnDestroy {
 | 
			
		||||
  markBlockSubscription: Subscription;
 | 
			
		||||
  blockCounterSubscription: Subscription;
 | 
			
		||||
  @ViewChild('blockchainContainer') blockchainContainer: ElementRef;
 | 
			
		||||
  resetScrollSubscription: Subscription; 
 | 
			
		||||
 | 
			
		||||
  isMobile: boolean = false;
 | 
			
		||||
  isiOS: boolean = false;
 | 
			
		||||
@ -106,6 +107,12 @@ export class StartComponent implements OnInit, OnDestroy {
 | 
			
		||||
          }, 60 * 60 * 1000);
 | 
			
		||||
        }
 | 
			
		||||
      });
 | 
			
		||||
    this.resetScrollSubscription = this.stateService.resetScroll$.subscribe(reset => {
 | 
			
		||||
      if (reset) {
 | 
			
		||||
        this.resetScroll();
 | 
			
		||||
        this.stateService.resetScroll$.next(false);
 | 
			
		||||
      } 
 | 
			
		||||
    });
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @HostListener('window:resize', ['$event'])
 | 
			
		||||
@ -385,5 +392,6 @@ export class StartComponent implements OnInit, OnDestroy {
 | 
			
		||||
    this.chainTipSubscription.unsubscribe();
 | 
			
		||||
    this.markBlockSubscription.unsubscribe();
 | 
			
		||||
    this.blockCounterSubscription.unsubscribe();
 | 
			
		||||
    this.resetScrollSubscription.unsubscribe();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -126,6 +126,7 @@ export class StateService {
 | 
			
		||||
  keyNavigation$ = new Subject<KeyboardEvent>();
 | 
			
		||||
 | 
			
		||||
  blockScrolling$: Subject<boolean> = new Subject<boolean>();
 | 
			
		||||
  resetScroll$: Subject<boolean> = new Subject<boolean>();
 | 
			
		||||
  timeLtr: BehaviorSubject<boolean>;
 | 
			
		||||
  hideFlow: BehaviorSubject<boolean>;
 | 
			
		||||
  hideAudit: BehaviorSubject<boolean>;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user