1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 17:23:37 +00:00

[PM-8368] AnonLayout Footer Updates (#9397)

* add hostname to footer via env service

* add logic for showing/hiding environment

* add docs

* add web env-selector

* refactor to use one slot for env-selector

* add storybook docs

* add env hostname to stories

* remove sample route
This commit is contained in:
rr-bw
2024-05-29 13:31:04 -07:00
committed by GitHub
parent 05f5d632aa
commit 828e26f93c
7 changed files with 155 additions and 47 deletions

View File

@@ -1,9 +1,13 @@
import { CommonModule } from "@angular/common";
import { Component, Input } from "@angular/core";
import { firstValueFrom } from "rxjs";
import { ClientType } from "@bitwarden/common/enums";
import { EnvironmentService } from "@bitwarden/common/platform/abstractions/environment.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { IconModule, Icon } from "../../../../components/src/icon";
import { SharedModule } from "../../../../components/src/shared";
import { TypographyModule } from "../../../../components/src/typography";
import { BitwardenLogo } from "../icons/bitwarden-logo.icon";
@@ -11,21 +15,34 @@ import { BitwardenLogo } from "../icons/bitwarden-logo.icon";
standalone: true,
selector: "auth-anon-layout",
templateUrl: "./anon-layout.component.html",
imports: [IconModule, CommonModule, TypographyModule],
imports: [IconModule, CommonModule, TypographyModule, SharedModule],
})
export class AnonLayoutComponent {
@Input() title: string;
@Input() subtitle: string;
@Input() icon: Icon;
@Input() showReadonlyHostname: boolean;
protected logo = BitwardenLogo;
protected version: string;
protected year = "2024";
constructor(private platformUtilsService: PlatformUtilsService) {}
protected year = "2024";
protected clientType: ClientType;
protected hostname: string;
protected version: string;
protected showYearAndVersion = true;
constructor(
private environmentService: EnvironmentService,
private platformUtilsService: PlatformUtilsService,
) {
this.year = new Date().getFullYear().toString();
this.clientType = this.platformUtilsService.getClientType();
this.showYearAndVersion = this.clientType === ClientType.Web;
}
async ngOnInit() {
this.year = new Date().getFullYear().toString();
this.hostname = (await firstValueFrom(this.environmentService.environment$)).getHostname();
this.version = await this.platformUtilsService.getApplicationVersion();
}
}