mirror of
https://github.com/bitwarden/browser.git
synced 2024-10-09 05:57:40 +02:00
3a98b415b0
This reverts commit 5a1940f3f4
.
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import { Component, Input } from "@angular/core";
|
|
import { ActivatedRoute } from "@angular/router";
|
|
import { combineLatest, map, Observable } from "rxjs";
|
|
|
|
import { StateService } from "@bitwarden/common/abstractions/state.service";
|
|
import { AccountProfile } from "@bitwarden/common/models/domain/account";
|
|
|
|
@Component({
|
|
selector: "sm-header",
|
|
templateUrl: "./header.component.html",
|
|
})
|
|
export class HeaderComponent {
|
|
@Input() title: string;
|
|
@Input() searchTitle: string;
|
|
|
|
protected routeData$: Observable<{ title: string; searchTitle: string }>;
|
|
protected account$: Observable<AccountProfile>;
|
|
|
|
constructor(private route: ActivatedRoute, private stateService: StateService) {
|
|
this.routeData$ = this.route.data.pipe(
|
|
map((params) => {
|
|
return {
|
|
title: params.title,
|
|
searchTitle: params.searchTitle,
|
|
};
|
|
})
|
|
);
|
|
|
|
this.account$ = combineLatest([
|
|
this.stateService.activeAccount$,
|
|
this.stateService.accounts$,
|
|
]).pipe(
|
|
map(([activeAccount, accounts]) => {
|
|
return accounts[activeAccount]?.profile;
|
|
})
|
|
);
|
|
}
|
|
}
|