Browse Source

Clean up viewport scroller (#255)

pull/257/head
Thomas 4 years ago
committed by GitHub
parent
commit
c4b6273886
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 15
      apps/client/src/app/pages/home/home-page.component.ts

15
apps/client/src/app/pages/home/home-page.component.ts

@ -1,6 +1,4 @@
import { ViewportScroller } from '@angular/common';
import { import {
AfterViewInit,
ChangeDetectorRef, ChangeDetectorRef,
Component, Component,
ElementRef, ElementRef,
@ -31,14 +29,14 @@ import { hasPermission, permissions } from '@ghostfolio/common/permissions';
import { DateRange } from '@ghostfolio/common/types'; import { DateRange } from '@ghostfolio/common/types';
import { DeviceDetectorService } from 'ngx-device-detector'; import { DeviceDetectorService } from 'ngx-device-detector';
import { Subject, Subscription } from 'rxjs'; import { Subject, Subscription } from 'rxjs';
import { first, takeUntil } from 'rxjs/operators'; import { takeUntil } from 'rxjs/operators';
@Component({ @Component({
selector: 'gf-home-page', selector: 'gf-home-page',
templateUrl: './home-page.html', templateUrl: './home-page.html',
styleUrls: ['./home-page.scss'] styleUrls: ['./home-page.scss']
}) })
export class HomePageComponent implements AfterViewInit, OnDestroy, OnInit { export class HomePageComponent implements OnDestroy, OnInit {
@HostBinding('class.with-create-account-container') get isDemo() { @HostBinding('class.with-create-account-container') get isDemo() {
return this.canCreateAccount; return this.canCreateAccount;
} }
@ -83,8 +81,7 @@ export class HomePageComponent implements AfterViewInit, OnDestroy, OnInit {
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
private settingsStorageService: SettingsStorageService, private settingsStorageService: SettingsStorageService,
private userService: UserService, private userService: UserService
private viewportScroller: ViewportScroller
) { ) {
this.routeQueryParams = this.route.queryParams this.routeQueryParams = this.route.queryParams
.pipe(takeUntil(this.unsubscribeSubject)) .pipe(takeUntil(this.unsubscribeSubject))
@ -150,12 +147,6 @@ export class HomePageComponent implements AfterViewInit, OnDestroy, OnInit {
this.update(); this.update();
} }
public ngAfterViewInit(): void {
this.route.fragment
.pipe(first())
.subscribe((fragment) => this.viewportScroller.scrollToAnchor(fragment));
}
public onChangeDateRange(aDateRange: DateRange) { public onChangeDateRange(aDateRange: DateRange) {
this.dateRange = aDateRange; this.dateRange = aDateRange;
this.settingsStorageService.setSetting(RANGE, this.dateRange); this.settingsStorageService.setSetting(RANGE, this.dateRange);

Loading…
Cancel
Save