From 123c1841a493d01a2f7861b484bfdfe3b4837a11 Mon Sep 17 00:00:00 2001 From: Hinton Date: Thu, 16 May 2024 16:44:08 +0200 Subject: [PATCH] Create web specific layout --- .../organization-layout.component.html | 19 +--- .../layouts/organization-layout.component.ts | 18 +--- .../app/layouts/user-layout.component.html | 14 +-- .../src/app/layouts/user-layout.component.ts | 19 +--- .../src/app/layouts/web-layout.component.html | 14 +++ .../src/app/layouts/web-layout.component.ts | 33 +++++++ .../providers/providers-layout.component.html | 14 +-- .../providers/providers-layout.component.ts | 16 +--- .../layout/layout.component.html | 4 +- .../secrets-manager/layout/layout.module.ts | 14 +-- .../layout/navigation.component.html | 88 +++++++++---------- 11 files changed, 114 insertions(+), 139 deletions(-) create mode 100644 apps/web/src/app/layouts/web-layout.component.html create mode 100644 apps/web/src/app/layouts/web-layout.component.ts diff --git a/apps/web/src/app/admin-console/organizations/layouts/organization-layout.component.html b/apps/web/src/app/admin-console/organizations/layouts/organization-layout.component.html index d1a48a78e1..e4cb70751e 100644 --- a/apps/web/src/app/admin-console/organizations/layouts/organization-layout.component.html +++ b/apps/web/src/app/admin-console/organizations/layouts/organization-layout.component.html @@ -1,9 +1,5 @@ - - + {{ "accessingUsingProvider" | i18n: organization.providerName }} - - + diff --git a/apps/web/src/app/admin-console/organizations/layouts/organization-layout.component.ts b/apps/web/src/app/admin-console/organizations/layouts/organization-layout.component.ts index 47ca0998bb..5b74407ffc 100644 --- a/apps/web/src/app/admin-console/organizations/layouts/organization-layout.component.ts +++ b/apps/web/src/app/admin-console/organizations/layouts/organization-layout.component.ts @@ -18,15 +18,11 @@ import { import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction"; import { PolicyType } from "@bitwarden/common/admin-console/enums"; import { Organization } from "@bitwarden/common/admin-console/models/domain/organization"; -import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; -import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; -import { BannerModule, IconModule, LayoutComponent, NavigationModule } from "@bitwarden/components"; +import { BannerModule, IconModule, NavigationModule } from "@bitwarden/components"; -import { PaymentMethodWarningsModule } from "../../../billing/shared"; import { OrgSwitcherComponent } from "../../../layouts/org-switcher/org-switcher.component"; -import { ProductSwitcherModule } from "../../../layouts/product-switcher/product-switcher.module"; -import { ToggleWidthComponent } from "../../../layouts/toggle-width.component"; +import { WebLayoutComponent } from "../../../layouts/web-layout.component"; import { AdminConsoleLogo } from "../../icons/admin-console-logo"; @Component({ @@ -37,14 +33,11 @@ import { AdminConsoleLogo } from "../../icons/admin-console-logo"; CommonModule, RouterModule, JslibModule, - LayoutComponent, + WebLayoutComponent, IconModule, NavigationModule, OrgSwitcherComponent, BannerModule, - PaymentMethodWarningsModule, - ToggleWidthComponent, - ProductSwitcherModule, ], }) export class OrganizationLayoutComponent implements OnInit, OnDestroy { @@ -58,15 +51,10 @@ export class OrganizationLayoutComponent implements OnInit, OnDestroy { private _destroy = new Subject(); - protected showPaymentMethodWarningBanners$ = this.configService.getFeatureFlag$( - FeatureFlag.ShowPaymentMethodWarningBanners, - ); - constructor( private route: ActivatedRoute, private organizationService: OrganizationService, private platformUtilsService: PlatformUtilsService, - private configService: ConfigService, private policyService: PolicyService, ) {} diff --git a/apps/web/src/app/layouts/user-layout.component.html b/apps/web/src/app/layouts/user-layout.component.html index a1c1273674..17e917801b 100644 --- a/apps/web/src/app/layouts/user-layout.component.html +++ b/apps/web/src/app/layouts/user-layout.component.html @@ -1,5 +1,5 @@ - - - - + diff --git a/apps/web/src/app/layouts/user-layout.component.ts b/apps/web/src/app/layouts/user-layout.component.ts index 1ce8d4d227..5a7d0756e9 100644 --- a/apps/web/src/app/layouts/user-layout.component.ts +++ b/apps/web/src/app/layouts/user-layout.component.ts @@ -7,17 +7,12 @@ import { JslibModule } from "@bitwarden/angular/jslib.module"; import { ApiService } from "@bitwarden/common/abstractions/api.service"; import { OrganizationService } from "@bitwarden/common/admin-console/abstractions/organization/organization.service.abstraction"; import { BillingAccountProfileStateService } from "@bitwarden/common/billing/abstractions/account/billing-account-profile-state.service"; -import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; -import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction"; -import { IconModule, LayoutComponent, NavigationModule } from "@bitwarden/components"; - -import { PaymentMethodWarningsModule } from "../billing/shared"; +import { IconModule, NavigationModule } from "@bitwarden/components"; import { PasswordManagerLogo } from "./password-manager-logo"; -import { ProductSwitcherModule } from "./product-switcher/product-switcher.module"; -import { ToggleWidthComponent } from "./toggle-width.component"; +import { WebLayoutComponent } from "./web-layout.component"; @Component({ selector: "app-user-layout", @@ -27,12 +22,9 @@ import { ToggleWidthComponent } from "./toggle-width.component"; CommonModule, RouterModule, JslibModule, - LayoutComponent, + WebLayoutComponent, IconModule, NavigationModule, - PaymentMethodWarningsModule, - ToggleWidthComponent, - ProductSwitcherModule, ], }) export class UserLayoutComponent implements OnInit { @@ -40,16 +32,11 @@ export class UserLayoutComponent implements OnInit { protected hasFamilySponsorshipAvailable$: Observable; protected showSubscription$: Observable; - protected showPaymentMethodWarningBanners$ = this.configService.getFeatureFlag$( - FeatureFlag.ShowPaymentMethodWarningBanners, - ); - constructor( private platformUtilsService: PlatformUtilsService, private organizationService: OrganizationService, private apiService: ApiService, private syncService: SyncService, - private configService: ConfigService, private billingAccountProfileStateService: BillingAccountProfileStateService, ) {} diff --git a/apps/web/src/app/layouts/web-layout.component.html b/apps/web/src/app/layouts/web-layout.component.html new file mode 100644 index 0000000000..650a0ad05e --- /dev/null +++ b/apps/web/src/app/layouts/web-layout.component.html @@ -0,0 +1,14 @@ + + + + + + + diff --git a/apps/web/src/app/layouts/web-layout.component.ts b/apps/web/src/app/layouts/web-layout.component.ts new file mode 100644 index 0000000000..ac5751f072 --- /dev/null +++ b/apps/web/src/app/layouts/web-layout.component.ts @@ -0,0 +1,33 @@ +import { CommonModule } from "@angular/common"; +import { Component, Input } from "@angular/core"; + +import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; +import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; +import { LayoutComponent, LayoutVariant } from "@bitwarden/components"; + +import { PaymentMethodWarningsModule } from "../billing/shared"; + +import { ProductSwitcherModule } from "./product-switcher/product-switcher.module"; +import { ToggleWidthComponent } from "./toggle-width.component"; + +@Component({ + selector: "app-layout", + templateUrl: "web-layout.component.html", + standalone: true, + imports: [ + CommonModule, + LayoutComponent, + ProductSwitcherModule, + ToggleWidthComponent, + PaymentMethodWarningsModule, + ], +}) +export class WebLayoutComponent { + @Input() variant: LayoutVariant = "primary"; + + protected showPaymentMethodWarningBanners$ = this.configService.getFeatureFlag$( + FeatureFlag.ShowPaymentMethodWarningBanners, + ); + + constructor(private configService: ConfigService) {} +} diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.html b/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.html index d16b0a8aa2..6554da30b7 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.html +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.html @@ -1,5 +1,5 @@ - - - - + diff --git a/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.ts b/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.ts index 7de46feb74..696e97e8bc 100644 --- a/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.ts +++ b/bitwarden_license/bit-web/src/app/admin-console/providers/providers-layout.component.ts @@ -8,13 +8,10 @@ import { JslibModule } from "@bitwarden/angular/jslib.module"; import { ProviderService } from "@bitwarden/common/admin-console/abstractions/provider.service"; import { Provider } from "@bitwarden/common/admin-console/models/domain/provider"; import { canAccessBilling } from "@bitwarden/common/billing/abstractions/provider-billing.service.abstraction"; -import { FeatureFlag } from "@bitwarden/common/enums/feature-flag.enum"; import { ConfigService } from "@bitwarden/common/platform/abstractions/config/config.service"; -import { IconModule, LayoutComponent, NavigationModule } from "@bitwarden/components"; +import { IconModule, NavigationModule } from "@bitwarden/components"; import { ProviderPortalLogo } from "@bitwarden/web-vault/app/admin-console/icons/provider-portal-logo"; -import { PaymentMethodWarningsModule } from "@bitwarden/web-vault/app/billing/shared"; -import { ProductSwitcherModule } from "@bitwarden/web-vault/app/layouts/product-switcher/product-switcher.module"; -import { ToggleWidthComponent } from "@bitwarden/web-vault/app/layouts/toggle-width.component"; +import { WebLayoutComponent } from "@bitwarden/web-vault/app/layouts/web-layout.component"; @Component({ selector: "providers-layout", @@ -24,12 +21,9 @@ import { ToggleWidthComponent } from "@bitwarden/web-vault/app/layouts/toggle-wi CommonModule, RouterModule, JslibModule, - LayoutComponent, + WebLayoutComponent, IconModule, NavigationModule, - PaymentMethodWarningsModule, - ToggleWidthComponent, - ProductSwitcherModule, ], }) export class ProvidersLayoutComponent implements OnInit, OnDestroy { @@ -39,10 +33,6 @@ export class ProvidersLayoutComponent implements OnInit, OnDestroy { protected provider$: Observable; protected canAccessBilling$: Observable; - protected showPaymentMethodWarningBanners$ = this.configService.getFeatureFlag$( - FeatureFlag.ShowPaymentMethodWarningBanners, - ); - constructor( private route: ActivatedRoute, private providerService: ProviderService, diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/layout/layout.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/layout/layout.component.html index 462c15311a..9dbee71634 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/layout/layout.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/layout/layout.component.html @@ -1,4 +1,4 @@ - + - + diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/layout/layout.module.ts b/bitwarden_license/bit-web/src/app/secrets-manager/layout/layout.module.ts index 848b22864c..64510152f0 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/layout/layout.module.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/layout/layout.module.ts @@ -1,23 +1,15 @@ import { NgModule } from "@angular/core"; -import { LayoutComponent as BitLayoutComponent, NavigationModule } from "@bitwarden/components"; +import { NavigationModule } from "@bitwarden/components"; import { OrgSwitcherComponent } from "@bitwarden/web-vault/app/layouts/org-switcher/org-switcher.component"; -import { ProductSwitcherModule } from "@bitwarden/web-vault/app/layouts/product-switcher/product-switcher.module"; -import { ToggleWidthComponent } from "@bitwarden/web-vault/app/layouts/toggle-width.component"; +import { WebLayoutComponent } from "@bitwarden/web-vault/app/layouts/web-layout.component"; import { SharedModule } from "@bitwarden/web-vault/app/shared/shared.module"; import { LayoutComponent } from "./layout.component"; import { NavigationComponent } from "./navigation.component"; @NgModule({ - imports: [ - SharedModule, - NavigationModule, - BitLayoutComponent, - OrgSwitcherComponent, - ToggleWidthComponent, - ProductSwitcherModule, - ], + imports: [SharedModule, NavigationModule, WebLayoutComponent, OrgSwitcherComponent], declarations: [LayoutComponent, NavigationComponent], }) export class LayoutModule {} diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/layout/navigation.component.html b/bitwarden_license/bit-web/src/app/secrets-manager/layout/navigation.component.html index ad608ff458..3fb70e3bbc 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/layout/navigation.component.html +++ b/bitwarden_license/bit-web/src/app/secrets-manager/layout/navigation.component.html @@ -1,54 +1,48 @@ - +