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

send list items container

This commit is contained in:
jaasen-livefront
2024-07-17 17:36:25 -07:00
parent fd93c76c0d
commit b33b82f6be
7 changed files with 115 additions and 16 deletions

View File

@@ -8,14 +8,12 @@
</ng-container>
</popup-header>
<div
*ngIf="sendsListState === SendsListStateEnum.Empty"
class="tw-flex tw-flex-col tw-h-full tw-justify-center"
>
<div *ngIf="sends.length === 0" 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>
<app-send-list-items-container [sends]="sends" />
</popup-page>

View File

@@ -1,21 +1,24 @@
import { CommonModule } from "@angular/common";
import { Component, OnDestroy, OnInit } from "@angular/core";
import { RouterLink } from "@angular/router";
import { mergeMap, Subject, takeUntil } from "rxjs";
import { JslibModule } from "@bitwarden/angular/jslib.module";
import { SendType } from "@bitwarden/common/tools/send/enums/send-type";
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
import { SendService } from "@bitwarden/common/tools/send/services/send.service.abstraction";
import { ButtonModule, NoItemsModule } from "@bitwarden/components";
import { NoSendsIcon, NewSendDropdownComponent } from "@bitwarden/send-ui";
import {
NoSendsIcon,
NewSendDropdownComponent,
SendListItemsContainerComponent,
} 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,
@@ -30,23 +33,30 @@ enum SendsListState {
ButtonModule,
RouterLink,
NewSendDropdownComponent,
SendListItemsContainerComponent,
],
})
export class SendV2Component implements OnInit, OnDestroy {
sendType = SendType;
/** Visual state of the Sends list */
protected sendsListState: SendsListState | null = null;
protected sends: SendView[] = [];
private destroy$ = new Subject<void>();
protected noItemIcon = NoSendsIcon;
protected SendsListStateEnum = SendsListState;
constructor(protected sendService: SendService) {}
constructor() {
this.sendsListState = SendsListState.Empty;
async ngOnInit() {
this.sendService.sendViews$
.pipe(
mergeMap(async (sends) => {
this.sends = sends;
}),
takeUntil(this.destroy$),
)
.subscribe();
}
ngOnInit(): void {}
ngOnDestroy(): void {}
}