Skip to content

Commit

Permalink
Create browsers SendV2 component (#10136)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel James Smith <[email protected]>
  • Loading branch information
djsmith85 and djsmith85 authored Jul 16, 2024
1 parent dbc9b9c commit 90de9dd
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 3 deletions.
8 changes: 8 additions & 0 deletions apps/browser/src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
},
Expand Down
6 changes: 3 additions & 3 deletions apps/browser/src/popup/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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" },
},
}),
],
}),
{
Expand Down
21 changes: 21 additions & 0 deletions apps/browser/src/tools/popup/send/send-v2.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<popup-page>
<popup-header slot="header" [pageTitle]="'send' | i18n">
<ng-container slot="end">
<tools-new-send-dropdown></tools-new-send-dropdown>

<app-pop-out></app-pop-out>
<app-current-account></app-current-account>
</ng-container>
</popup-header>

<div
*ngIf="sendsListState === SendsListStateEnum.Empty"
class="tw-flex tw-flex-col tw-h-full tw-justify-center"
>
<bit-no-items [icon]="noItemIcon" class="tw-text-main">
<ng-container slot="title">{{ "sendsNoItemsTitle" | i18n }}</ng-container>
<ng-container slot="description">{{ "sendsNoItemsMessage" | i18n }}</ng-container>
<tools-new-send-dropdown slot="button"></tools-new-send-dropdown>
</bit-no-items>
</div>
</popup-page>
52 changes: 52 additions & 0 deletions apps/browser/src/tools/popup/send/send-v2.component.ts
Original file line number Diff line number Diff line change
@@ -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 {}
}

0 comments on commit 90de9dd

Please sign in to comment.