From fb3766b6c1cbd1c153b157e39b377a244a03bdc8 Mon Sep 17 00:00:00 2001 From: Daniel James Smith <2670567+djsmith85@users.noreply.github.com> Date: Thu, 9 May 2024 22:36:42 +0200 Subject: [PATCH] [CL-282] Make `app-pop-out` standalone (#9106) * Move pop-out.component into platform ownership * Make pop-out.component standalone * Fix no-floating-promises --------- Co-authored-by: Daniel James Smith --- .../popup/components/pop-out.component.html | 0 .../popup/components/pop-out.component.ts | 12 +++++++----- apps/browser/src/popup/app.module.ts | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) rename apps/browser/src/{ => platform}/popup/components/pop-out.component.html (100%) rename apps/browser/src/{ => platform}/popup/components/pop-out.component.ts (64%) diff --git a/apps/browser/src/popup/components/pop-out.component.html b/apps/browser/src/platform/popup/components/pop-out.component.html similarity index 100% rename from apps/browser/src/popup/components/pop-out.component.html rename to apps/browser/src/platform/popup/components/pop-out.component.html diff --git a/apps/browser/src/popup/components/pop-out.component.ts b/apps/browser/src/platform/popup/components/pop-out.component.ts similarity index 64% rename from apps/browser/src/popup/components/pop-out.component.ts rename to apps/browser/src/platform/popup/components/pop-out.component.ts index d60936a235..154bb55a0c 100644 --- a/apps/browser/src/popup/components/pop-out.component.ts +++ b/apps/browser/src/platform/popup/components/pop-out.component.ts @@ -1,12 +1,16 @@ +import { CommonModule } from "@angular/common"; import { Component, Input, OnInit } from "@angular/core"; +import { JslibModule } from "@bitwarden/angular/jslib.module"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; -import BrowserPopupUtils from "../../platform/popup/browser-popup-utils"; +import BrowserPopupUtils from "../browser-popup-utils"; @Component({ selector: "app-pop-out", templateUrl: "pop-out.component.html", + standalone: true, + imports: [CommonModule, JslibModule], }) export class PopOutComponent implements OnInit { @Input() show = true; @@ -24,9 +28,7 @@ export class PopOutComponent implements OnInit { } } - expand() { - // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. - // eslint-disable-next-line @typescript-eslint/no-floating-promises - BrowserPopupUtils.openCurrentPagePopout(window); + async expand() { + await BrowserPopupUtils.openCurrentPagePopout(window); } } diff --git a/apps/browser/src/popup/app.module.ts b/apps/browser/src/popup/app.module.ts index e33a690aa8..05158d3295 100644 --- a/apps/browser/src/popup/app.module.ts +++ b/apps/browser/src/popup/app.module.ts @@ -41,6 +41,7 @@ import { AutofillComponent } from "../autofill/popup/settings/autofill.component import { ExcludedDomainsComponent } from "../autofill/popup/settings/excluded-domains.component"; import { NotifcationsSettingsComponent } from "../autofill/popup/settings/notifications.component"; import { PremiumComponent } from "../billing/popup/settings/premium.component"; +import { PopOutComponent } from "../platform/popup/components/pop-out.component"; import { HeaderComponent } from "../platform/popup/header.component"; import { PopupFooterComponent } from "../platform/popup/layout/popup-footer.component"; import { PopupHeaderComponent } from "../platform/popup/layout/popup-header.component"; @@ -81,7 +82,6 @@ import { VaultSettingsComponent } from "../vault/popup/settings/vault-settings.c import { AppRoutingModule } from "./app-routing.module"; import { AppComponent } from "./app.component"; -import { PopOutComponent } from "./components/pop-out.component"; import { UserVerificationComponent } from "./components/user-verification.component"; import { ServicesModule } from "./services/services.module"; import { HelpAndFeedbackComponent } from "./settings/help-and-feedback.component"; @@ -118,6 +118,7 @@ import "../platform/popup/locales"; AccountComponent, ButtonModule, ExportScopeCalloutComponent, + PopOutComponent, PopupPageComponent, PopupTabNavigationComponent, PopupFooterComponent, @@ -157,7 +158,6 @@ import "../platform/popup/locales"; GeneratorComponent, PasswordGeneratorHistoryComponent, PasswordHistoryComponent, - PopOutComponent, PremiumComponent, RegisterComponent, SendAddEditComponent,