From 90de9dd07afeedb7bb4b362c2dcfef4b52921469 Mon Sep 17 00:00:00 2001 From: Daniel James Smith <2670567+djsmith85@users.noreply.github.com> Date: Tue, 16 Jul 2024 23:12:46 +0200 Subject: [PATCH] Create browsers SendV2 component (#10136) Co-authored-by: Daniel James Smith --- apps/browser/src/_locales/en/messages.json | 8 +++ apps/browser/src/popup/app-routing.module.ts | 6 +-- .../tools/popup/send/send-v2.component.html | 21 ++++++++ .../src/tools/popup/send/send-v2.component.ts | 52 +++++++++++++++++++ 4 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 apps/browser/src/tools/popup/send/send-v2.component.html create mode 100644 apps/browser/src/tools/popup/send/send-v2.component.ts diff --git a/apps/browser/src/_locales/en/messages.json b/apps/browser/src/_locales/en/messages.json index 6cebe0e231..69c3a525f9 100644 --- a/apps/browser/src/_locales/en/messages.json +++ b/apps/browser/src/_locales/en/messages.json @@ -2765,6 +2765,14 @@ "deviceTrusted": { "message": "Device trusted" }, + "sendsNoItemsTitle": { + "message": "No active Sends", + "description": "'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated." + }, + "sendsNoItemsMessage": { + "message": "Use Send to securely share encrypted information with anyone.", + "description": "'Send' is a noun and the name of a feature called 'Bitwarden Send'. It should not be translated." + }, "inputRequired": { "message": "Input is required." }, diff --git a/apps/browser/src/popup/app-routing.module.ts b/apps/browser/src/popup/app-routing.module.ts index 8645cb797b..12d92249fe 100644 --- a/apps/browser/src/popup/app-routing.module.ts +++ b/apps/browser/src/popup/app-routing.module.ts @@ -48,6 +48,7 @@ import { PasswordGeneratorHistoryComponent } from "../tools/popup/generator/pass import { SendAddEditComponent } from "../tools/popup/send/send-add-edit.component"; import { SendGroupingsComponent } from "../tools/popup/send/send-groupings.component"; import { SendTypeComponent } from "../tools/popup/send/send-type.component"; +import { SendV2Component } from "../tools/popup/send/send-v2.component"; import { AboutPageV2Component } from "../tools/popup/settings/about-page/about-page-v2.component"; import { AboutPageComponent } from "../tools/popup/settings/about-page/about-page.component"; import { MoreFromBitwardenPageV2Component } from "../tools/popup/settings/about-page/more-from-bitwarden-page-v2.component"; @@ -450,12 +451,11 @@ const routes: Routes = [ canActivate: [AuthGuard], data: { state: "tabs_settings" }, }), - { + ...extensionRefreshSwap(SendGroupingsComponent, SendV2Component, { path: "send", - component: SendGroupingsComponent, canActivate: [AuthGuard], data: { state: "tabs_send" }, - }, + }), ], }), { diff --git a/apps/browser/src/tools/popup/send/send-v2.component.html b/apps/browser/src/tools/popup/send/send-v2.component.html new file mode 100644 index 0000000000..3499f8c32e --- /dev/null +++ b/apps/browser/src/tools/popup/send/send-v2.component.html @@ -0,0 +1,21 @@ + + + + + + + + + + +
+ + {{ "sendsNoItemsTitle" | i18n }} + {{ "sendsNoItemsMessage" | i18n }} + + +
+
diff --git a/apps/browser/src/tools/popup/send/send-v2.component.ts b/apps/browser/src/tools/popup/send/send-v2.component.ts new file mode 100644 index 0000000000..fba14b762b --- /dev/null +++ b/apps/browser/src/tools/popup/send/send-v2.component.ts @@ -0,0 +1,52 @@ +import { CommonModule } from "@angular/common"; +import { Component, OnDestroy, OnInit } from "@angular/core"; +import { RouterLink } from "@angular/router"; + +import { JslibModule } from "@bitwarden/angular/jslib.module"; +import { SendType } from "@bitwarden/common/tools/send/enums/send-type"; +import { ButtonModule, NoItemsModule } from "@bitwarden/components"; +import { NoSendsIcon, NewSendDropdownComponent } from "@bitwarden/send-ui"; + +import { CurrentAccountComponent } from "../../../auth/popup/account-switching/current-account.component"; +import { PopOutComponent } from "../../../platform/popup/components/pop-out.component"; +import { PopupHeaderComponent } from "../../../platform/popup/layout/popup-header.component"; +import { PopupPageComponent } from "../../../platform/popup/layout/popup-page.component"; + +enum SendsListState { + Empty, +} + +@Component({ + templateUrl: "send-v2.component.html", + standalone: true, + imports: [ + PopupPageComponent, + PopupHeaderComponent, + PopOutComponent, + CurrentAccountComponent, + NoItemsModule, + JslibModule, + CommonModule, + ButtonModule, + RouterLink, + NewSendDropdownComponent, + ], +}) +export class SendV2Component implements OnInit, OnDestroy { + sendType = SendType; + + /** Visual state of the Sends list */ + protected sendsListState: SendsListState | null = null; + + protected noItemIcon = NoSendsIcon; + + protected SendsListStateEnum = SendsListState; + + constructor() { + this.sendsListState = SendsListState.Empty; + } + + ngOnInit(): void {} + + ngOnDestroy(): void {} +}