mirror of
https://github.com/bitwarden/browser
synced 2026-02-19 10:54:00 +00:00
30 lines
957 B
TypeScript
30 lines
957 B
TypeScript
import { Component, OnDestroy } from "@angular/core";
|
|
import { NavigationEnd, Router } from "@angular/router";
|
|
import { Subscription } from "rxjs";
|
|
import { filter } from "rxjs/operators";
|
|
|
|
// FIXME(https://bitwarden.atlassian.net/browse/CL-764): Migrate to OnPush
|
|
// eslint-disable-next-line @angular-eslint/prefer-on-push-component-change-detection
|
|
@Component({
|
|
selector: "app-reports-layout",
|
|
templateUrl: "reports-layout.component.html",
|
|
standalone: false,
|
|
})
|
|
export class ReportsLayoutComponent implements OnDestroy {
|
|
homepage = true;
|
|
subscription: Subscription;
|
|
|
|
constructor(router: Router) {
|
|
this.subscription = router.events
|
|
.pipe(filter((event) => event instanceof NavigationEnd))
|
|
// eslint-disable-next-line rxjs-angular/prefer-takeuntil
|
|
.subscribe((event) => {
|
|
this.homepage = (event as NavigationEnd).url == "/reports";
|
|
});
|
|
}
|
|
|
|
ngOnDestroy(): void {
|
|
this.subscription?.unsubscribe();
|
|
}
|
|
}
|